Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: add the xcoff symbol type functionality for llvm-nm. Reviewers: James Henderson Differential Revision: https://reviews.llvm.org/D112450
- Loading branch information
Showing
4 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
## Test llvm-nm for XCOFF object files. | ||
|
||
# RUN: yaml2obj %s -o %t.o | ||
# RUN: llvm-nm %t.o | FileCheck --match-full-lines %s | ||
|
||
--- !XCOFF | ||
FileHeader: | ||
MagicNumber: 0x1DF | ||
Sections: | ||
- Name: .text | ||
Address: 0x0 | ||
Flags: [ STYP_TEXT ] | ||
- Name: .data | ||
Flags: [ STYP_DATA ] | ||
- Name: .bss | ||
Flags: [ STYP_BSS ] | ||
- Name: .debug | ||
Flags: [ STYP_DEBUG ] | ||
- Name: .except | ||
Flags: [ STYP_EXCEPT ] | ||
Symbols: | ||
- Name: .file | ||
Section: N_DEBUG | ||
StorageClass: C_FILE | ||
- Name: .text | ||
Value: 0x10 | ||
Section: .text | ||
StorageClass: C_STAT | ||
NumberOfAuxEntries: 1 | ||
- Name: .data | ||
Value: 0x80 | ||
Section: .data | ||
StorageClass: C_STAT | ||
NumberOfAuxEntries: 1 | ||
- Name: .bss | ||
Value: 0x310 | ||
Section: .bss | ||
StorageClass: C_STAT | ||
- Name: .debug | ||
Section: .debug | ||
StorageClass: C_STAT | ||
- Name: ._ZL5func0v | ||
Section: .text | ||
StorageClass: C_EXT | ||
Type: 0x20 | ||
AuxEntries: | ||
- Type: AUX_CSECT | ||
SymbolAlignmentAndType: 0x02 | ||
StorageMappingClass: XMC_PR | ||
- Name: ._Z3fwpv | ||
Section: .text | ||
StorageClass: C_WEAKEXT | ||
Type: 0x20 | ||
AuxEntries: | ||
- Type: AUX_CSECT | ||
SymbolAlignmentAndType: 0x02 | ||
StorageMappingClass: XMC_PR | ||
- Name: val | ||
Section: .data | ||
StorageClass: C_EXT | ||
Type: 0x20 | ||
AuxEntries: | ||
- Type: AUX_CSECT | ||
SymbolAlignmentAndType: 0x01 | ||
StorageMappingClass: XMC_RW | ||
SectionOrLength: 0x4 | ||
- Name: extval | ||
Section: N_UNDEF | ||
StorageClass: C_EXT | ||
Type: 0x00 | ||
AuxEntries: | ||
- Type: AUX_CSECT | ||
SymbolAlignmentAndType: 0x01 | ||
StorageMappingClass: XMC_UA | ||
SectionOrLength: 0x0 | ||
- Name: comval | ||
Section: .bss | ||
Value: 0x13C | ||
StorageClass: C_EXT | ||
Type: 0x00 | ||
AuxEntries: | ||
- Type: AUX_CSECT | ||
SymbolAlignmentAndType: 0x03 | ||
StorageMappingClass: XMC_RW | ||
SectionOrLength: 0x0 | ||
- Name: abs | ||
Section: N_ABS | ||
- Name: symIn_N_debug | ||
Section: N_DEBUG | ||
- Name: .except | ||
Section: .except | ||
|
||
## Global weak symbol. | ||
# CHECK: 00000000 W ._Z3fwpv | ||
## Global symbol in .text section. | ||
# CHECK-NEXT: 00000000 T ._ZL5func0v | ||
## Symbol in .bss section. | ||
# CHECK-NEXT: 00000310 b .bss | ||
## Local symbol in .data section. | ||
# CHECK-NEXT: 00000080 d .data | ||
## Symbol in .debug section. | ||
# CHECK-NEXT: 00000000 N .debug | ||
## Symbol in .except section. | ||
# CHECK-NEXT: 00000000 ? .except | ||
## Symbol .file. | ||
# CHECK-NEXT: 00000000 f .file | ||
## Local symbol in .text section. | ||
# CHECK-NEXT: 00000010 t .text | ||
## Absolute symbol. | ||
# CHECK-NEXT: 00000000 a abs | ||
## Common symbol. | ||
# CHECK-NEXT: 0000013c C comval | ||
## Undefined symbol. | ||
# CHECK-NEXT: U extval | ||
## Symbol in N_DEBUG section. | ||
# CHECK-NEXT: 00000000 ? symIn_N_debug | ||
## Global symbol in .data section. | ||
# CHECK-NEXT: 00000000 D val |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## Test showing 8 byte addresses for llvm-nm for XCOFF 64-bit object files. | ||
|
||
# RUN: yaml2obj %s -o %t.o | ||
# RUN: llvm-nm %t.o | FileCheck --match-full-lines %s | ||
|
||
--- !XCOFF | ||
FileHeader: | ||
MagicNumber: 0x1F7 | ||
Sections: | ||
- Name: .text | ||
Address: 0x0 | ||
Flags: [ STYP_TEXT ] | ||
Symbols: | ||
- Name: .text | ||
Value: 0x10 | ||
Section: .text | ||
StorageClass: C_STAT | ||
NumberOfAuxEntries: 1 | ||
|
||
# CHECK: 0000000000000010 t .text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## Test the behavior of the symbol reference section. | ||
|
||
# RUN: yaml2obj %s -o %t.o | ||
# RUN: llvm-nm %t.o 2>&1 | FileCheck %s -DFILE=%t.o | ||
|
||
# CHECK: llvm-nm{{(\.exe)?}}: warning: [[FILE]]: for symbol with index 0: the section index (4) is invalid | ||
# CHECK-NEXT: 00000000 ? .text | ||
|
||
--- !XCOFF | ||
FileHeader: | ||
MagicNumber: 0x1DF | ||
Sections: | ||
- Name: .text | ||
Symbols: | ||
- Name: .text | ||
Value: 0x0 | ||
SectionIndex: 4 | ||
Type: 0x0 | ||
StorageClass: C_STAT | ||
NumberOfAuxEntries: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters