xref: /llvm-project/llvm/test/tools/llvm-nm/XCOFF/basic.test (revision 6bf20aa59030175139853e48ccdfe31d718c1566)
1## Test llvm-nm for XCOFF object files.
2
3# RUN: yaml2obj %s -o %t.o
4# RUN: llvm-nm  %t.o | FileCheck --match-full-lines %s
5
6--- !XCOFF
7FileHeader:
8  MagicNumber:          0x1DF
9Sections:
10  - Name:                    .text
11    Address:                 0x0
12    Flags:                   [ STYP_TEXT ]
13  - Name:                    .data
14    Flags:                   [ STYP_DATA ]
15  - Name:                    .bss
16    Flags:                   [ STYP_BSS ]
17  - Name:                    .debug
18    Flags:                   [ STYP_DEBUG ]
19  - Name:                    .except
20    Flags:                   [ STYP_EXCEPT ]
21Symbols:
22  - Name: .file
23    Section: N_DEBUG
24    StorageClass: C_FILE
25  - Name:               .text
26    Value:              0x10
27    Section:            .text
28    StorageClass:       C_STAT
29    NumberOfAuxEntries: 1
30  - Name:               .data
31    Value:              0x80
32    Section:            .data
33    StorageClass:       C_STAT
34    NumberOfAuxEntries: 1
35  - Name:               .bss
36    Value:              0x310
37    Section:            .bss
38    StorageClass:       C_STAT
39  - Name:               .debug
40    Section:            .debug
41    StorageClass:       C_STAT
42  - Name:               ._ZL5func0v
43    Section:            .text
44    StorageClass:       C_EXT
45    Type:               0x20
46    AuxEntries:
47     - Type:                   AUX_CSECT
48       SymbolAlignmentAndType: 0x02
49       StorageMappingClass:    XMC_PR
50  - Name:               ._Z3fwpv
51    Section:            .text
52    StorageClass:       C_WEAKEXT
53    Type:               0x20
54    AuxEntries:
55     - Type:                   AUX_CSECT
56       SymbolAlignmentAndType: 0x02
57       StorageMappingClass:    XMC_PR
58  - Name:               val
59    Section:            .data
60    StorageClass:       C_EXT
61    Type:               0x20
62    AuxEntries:
63     - Type:                   AUX_CSECT
64       SymbolAlignmentAndType: 0x01
65       StorageMappingClass:    XMC_RW
66       SectionOrLength:        0x4
67  - Name:               extval
68    Section:            N_UNDEF
69    StorageClass:       C_EXT
70    Type:               0x00
71    AuxEntries:
72     - Type:                   AUX_CSECT
73       SymbolAlignmentAndType: 0x01
74       StorageMappingClass:    XMC_UA
75       SectionOrLength:        0x0
76  - Name:               comval
77    Section:            .bss
78    Value:              0x13C
79    StorageClass:       C_EXT
80    Type:               0x00
81    AuxEntries:
82     - Type:                   AUX_CSECT
83       SymbolAlignmentAndType: 0x03
84       StorageMappingClass:    XMC_RW
85       SectionOrLength:        0x0
86  - Name:      abs
87    Section:   N_ABS
88  - Name:      symIn_N_debug
89    Section:   N_DEBUG
90  - Name:      .except
91    Section:   .except
92
93## Global weak symbol.
94# CHECK:      00000000 W ._Z3fwpv
95## Global symbol in .text section.
96# CHECK-NEXT: 00000000 T ._ZL5func0v
97## Symbol in .bss section.
98# CHECK-NEXT: 00000310 b .bss
99## Local symbol in .data section.
100# CHECK-NEXT: 00000080 d .data
101## Symbol in .debug section.
102# CHECK-NEXT: 00000000 N .debug
103## Symbol in .except section.
104# CHECK-NEXT: 00000000 ? .except
105## Symbol .file.
106# CHECK-NEXT: 00000000 f .file
107## Local symbol in .text section.
108# CHECK-NEXT: 00000010 t .text
109## Absolute symbol.
110# CHECK-NEXT: 00000000 a abs
111## Common symbol.
112# CHECK-NEXT: 0000013c C comval
113## Undefined symbol.
114# CHECK-NEXT:          U extval
115## Symbol in N_DEBUG section.
116# CHECK-NEXT: 00000000 ? symIn_N_debug
117## Global symbol in .data section.
118# CHECK-NEXT: 00000000 D val
119