1 RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm -a -S - \
2 RUN: | FileCheck %s -check-prefix COFF32
3 RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm -a -S - \
4 RUN: | FileCheck %s -check-prefix COFF64
5 RUN: llvm-nm %p/Inputs/trivial-object-test.wasm \
6 RUN: | FileCheck %s -check-prefix WASM
7 RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 \
8 RUN: | FileCheck %s -check-prefix ELF
9 RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 -S \
10 RUN: | FileCheck %s -check-prefix ELF-SIZE
11 RUN: llvm-nm -o %p/Inputs/trivial-object-test.elf-i386 \
12 RUN: | FileCheck %s -check-prefix ELF-o
13 RUN: llvm-nm -u %p/Inputs/trivial-object-test.elf-i386 \
14 RUN: | FileCheck %s -check-prefix ELF-u
15 RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \
16 RUN: | FileCheck %s -check-prefix ELF64
17 RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \
18 RUN: | FileCheck %s -check-prefix WEAK-ELF64
19 RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \
20 RUN: | FileCheck %s -check-prefix ABSOLUTE-ELF64
21 RUN: llvm-nm -a %p/Inputs/IsNAN.o \
22 RUN: | FileCheck %s -check-prefix ELF64-DEBUG-SYMS
23 RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
24 RUN: | FileCheck %s -check-prefix macho
25 RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
26 RUN: | FileCheck %s -check-prefix macho-U
27 RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
28 RUN: | FileCheck %s -check-prefix macho64
29 RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
30 RUN: | FileCheck %s -check-prefix macho-tdb
31 RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
32 RUN: | FileCheck %s -check-prefix macho-j
33 RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
34 RUN: | FileCheck %s -check-prefix macho-r
35 RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \
36 RUN: | FileCheck %s -check-prefix macho-s
37 RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \
38 RUN: | FileCheck %s -check-prefix macho-x
39 RUN: llvm-nm -o %p/Inputs/macho-text-data-bss.macho-x86_64 \
40 RUN: | FileCheck %s -check-prefix macho-o
41 RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \
42 RUN: | FileCheck %s -check-prefix macho-pa
43 RUN: llvm-nm -u %p/Inputs/macho-hello-g.macho-x86_64 \
44 RUN: | FileCheck %s -check-prefix macho-u
45 RUN: llvm-nm -S -a %p/Inputs/common.coff-i386 \
46 RUN: | FileCheck %s -check-prefix COFF-COMMON
47 RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
48 RUN: | FileCheck %s -check-prefix ELF-SEC-ADDR64
49 RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
50 RUN: | FileCheck %s -check-prefix ELF-THUMB
53 RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
54 RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
57 COFF32: 00000000 d .data
58 COFF32-NEXT: 00000000 t .text
59 COFF32-NEXT: 00000000 d L_.str
60 COFF32-NEXT: U _SomeOtherFunction
61 COFF32-NEXT: 00000000 T _main
65 WASM: 00000000 d .L.str
66 WASM-NEXT: 00000019 t .LSomeOtherFunction_bitcast
67 WASM-NEXT: U SomeOtherFunction
68 WASM-NEXT: 00000001 T main
70 WASM-NEXT: 00000010 D var
73 COFF64: 00000000 d .data
74 COFF64-NEXT: 00000000 t .text
75 COFF64-NEXT: 00000000 r ??__Ex@@YAXXZ
76 COFF64-NEXT: 00000000 d L.str
77 COFF64-NEXT: U SomeOtherFunction
78 COFF64-NEXT: 00000000 T main
81 COFF-COMMON: 00000000 b .bss
82 COFF-COMMON-NEXT: 00000000 d .data
83 COFF-COMMON-NEXT: 00000000 d .drectve
84 COFF-COMMON-NEXT: 00000000 n .file
85 COFF-COMMON-NEXT: 00000000 r .rdata$zzz
86 COFF-COMMON-NEXT: 00000000 t .text
87 COFF-COMMON-NEXT: C _a
91 ELF: U SomeOtherFunction
95 ELF-SIZE: U SomeOtherFunction
96 ELF-SIZE-NEXT: 00000000 00000024 T main
99 ELF-o: {{.*}}/trivial-object-test.elf-i386: U SomeOtherFunction
100 ELF-o: {{.*}}/trivial-object-test.elf-i386: 00000000 T main
101 ELF-o: {{.*}}/trivial-object-test.elf-i386: U puts
103 ELF-u: U SomeOtherFunction
106 ELF64: U SomeOtherFunction
107 ELF64: 0000000000000000 T main
111 WEAK-ELF64: 0000000000000000 W f2
113 WEAK-ELF64: 0000000000000000 V x2
115 ABSOLUTE-ELF64: 0000000000000123 a a1
116 ABSOLUTE-ELF64: 0000000000000123 A a2
118 ELF64-DEBUG-SYMS: 00000000 b .bss
119 ELF64-DEBUG-SYMS: 00000000 d .data
120 ELF64-DEBUG-SYMS: 00000000 N .debug_abbrev
121 ELF64-DEBUG-SYMS: 00000000 N .debug_aranges
122 ELF64-DEBUG-SYMS: 00000000 N .debug_frame
123 ELF64-DEBUG-SYMS: 00000000 N .debug_info
124 ELF64-DEBUG-SYMS: 00000000 N .debug_line
125 ELF64-DEBUG-SYMS: 00000000 N .debug_pubnames
126 ELF64-DEBUG-SYMS: 00000000 n .note.GNU-stack
127 ELF64-DEBUG-SYMS: 00000000 t .text
128 ELF64-DEBUG-SYMS: 00000000 a IsNAN.cpp
129 ELF64-DEBUG-SYMS: 00000014 T _ZN4llvm5IsNANEd
130 ELF64-DEBUG-SYMS: 00000000 T _ZN4llvm5IsNANEf
131 ELF64-DEBUG-SYMS: U __isnan
132 ELF64-DEBUG-SYMS: U __isnanf
134 macho: U _SomeOtherFunction
135 macho: 00000000 T _main
138 macho-U-NOT: U _SomeOtherFunction
139 macho-U: 00000000 T _main
142 macho64: 0000000000000028 s L_.str
143 macho64: U _SomeOtherFunction
144 macho64: 0000000000000000 T _main
147 macho-tdb: 0000000000000030 s EH_frame0
148 macho-tdb: 0000000000000070 b _b
149 macho-tdb: 000000000000000c D _d
150 macho-tdb: 0000000000000000 T _t
151 macho-tdb: 0000000000000048 S _t.eh
159 macho-r: 0000000000000048 S _t.eh
160 macho-r-NEXT: 0000000000000000 T _t
161 macho-r-NEXT: 000000000000000c D _d
162 macho-r-NEXT: 0000000000000070 b _b
163 macho-r-NEXT: 0000000000000030 s EH_frame0
165 macho-s: 000000000000000c D _d
166 macho-s-NOT: 0000000000000048 S _t.eh
167 macho-s-NOT: 0000000000000000 T _t
168 macho-s-NOT: 0000000000000070 b _b
169 macho-s-NOT: 0000000000000030 s EH_frame0
171 macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
172 macho-x: 0000000000000070 0e 03 0000 0000000d _b
173 macho-x: 000000000000000c 0f 02 0000 00000004 _d
174 macho-x: 0000000000000000 0f 01 0000 00000001 _t
175 macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh
178 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000030 s EH_frame0
179 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000070 b _b
180 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 000000000000000c D _d
181 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000000 T _t
182 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000048 S _t.eh
184 macho-pa: 0000000000000000 - 00 0000 SO /Volumes/SandBox/
185 macho-pa: 0000000000000000 - 00 0000 SO hello.c
186 macho-pa: 0000000053c8408d - 03 0001 OSO /Volumes/SandBox/hello.o
187 macho-pa: 0000000100000f30 - 01 0000 BNSYM
188 macho-pa: 0000000100000f30 - 01 0000 FUN _main
189 macho-pa: 000000000000003b - 00 0000 FUN
190 macho-pa: 000000000000003b - 01 0000 ENSYM
191 macho-pa: 0000000000000000 - 01 0000 SO
192 macho-pa: 0000000100000000 T __mh_execute_header
193 macho-pa: 0000000100000f30 T _main
195 macho-pa: U dyld_stub_binder
198 macho-u: dyld_stub_binder
200 Test that nm uses addresses even with ELF .o files.
201 ELF-SEC-ADDR64: 0000000000000058 D a
202 ELF-SEC-ADDR64-NEXT: 000000000000005c D b
203 ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
204 ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
205 ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
208 Test that we drop the thumb bit only from function addresses.
209 ELF-THUMB: 00000000 t f
210 ELF-THUMB: 00000003 t g
212 A-OUT: U _SomeOtherFunction
213 A-OUT: 00000000 T _main