1 # RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm -a -S - \
2 # RUN: | FileCheck %s -check-prefix COFF32
4 # COFF32: 00000000 d .data
5 # COFF32-NEXT: 00000000 t .text
6 # COFF32-NEXT: 00000000 d L_.str
7 # COFF32-NEXT: U _SomeOtherFunction
8 # COFF32-NEXT: 00000000 T _main
11 # RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm -a -S - \
12 # RUN: | FileCheck %s -check-prefix COFF64
14 # COFF64: 00000000 d .data
15 # COFF64-NEXT: 00000000 t .text
16 # COFF64-NEXT: 00000000 r ??__Ex@@YAXXZ
17 # COFF64-NEXT: 00000000 d L.str
18 # COFF64-NEXT: U SomeOtherFunction
19 # COFF64-NEXT: 00000000 T main
22 # RUN: llvm-nm %p/Inputs/trivial-object-test.wasm \
23 # RUN: | FileCheck %s -check-prefix WASM
25 # WASM: 00000000 d .L.str
26 # WASM-NEXT: 00000019 t .LSomeOtherFunction_bitcast
27 # WASM-NEXT: U SomeOtherFunction
28 # WASM-NEXT: 00000001 T main
30 # WASM-NEXT: 00000010 D var
32 # RUN: yaml2obj -docnum=1 %s > %t.elf-i386
43 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
49 Size: 0x0000000000000024
50 - Name: SomeOtherFunction
55 # RUN: llvm-nm %t.elf-i386 | FileCheck %s -check-prefix=ELF
58 # ELF: U SomeOtherFunction
59 # ELF: 00000000 T main
62 # RUN: llvm-nm -o %t.elf-i386 | FileCheck %s -DFILE=%t.elf-i386 -check-prefix=ELF-o
64 # RUN: llvm-nm %t.elf-i386 -S | FileCheck %s -check-prefix ELF-SIZE
66 # ELF-SIZE: U SomeOtherFunction
67 # ELF-SIZE-NEXT: 00000000 00000024 T main
68 # ELF-SIZE-NEXT: U puts
71 # ELF-o: [[FILE]]: U SomeOtherFunction
72 # ELF-o: [[FILE]]: 00000000 T main
73 # ELF-o: [[FILE]]: U puts
75 # RUN: llvm-nm -u %t.elf-i386 | FileCheck %s -check-prefix ELF-u
77 # ELF-u: U SomeOtherFunction
80 ## Test different ELF symbols for 64-bit platform.
82 # RUN: yaml2obj -docnum=2 %s > %t.elf-x86-64
83 # RUN: llvm-nm %t.elf-x86-64 | FileCheck %s -check-prefix ELF64
85 # ELF64: U SomeOtherFunction
86 # ELF64: 0000000000000123 a absSym1
87 # ELF64: 0000000000000123 A absSym2
88 # ELF64: 0000000000002000 D dataSym1
89 # ELF64: 0000000000002004 D dataSym2
90 # ELF64: 0000000000001000 T textSym1
91 # ELF64: 0000000000001004 T textSym2
92 # ELF64: U undefinedSym
93 # ELF64: v weakObject1
94 # ELF64: 0000000000001000 V weakObject2
96 # ELF64: 0000000000001000 W weakSym2
107 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
111 Flags: [ SHF_ALLOC, SHF_WRITE ]
116 Value: 0x0000000000000123
120 Value: 0x0000000000000123
121 - Name: SomeOtherFunction
141 Value: 0x0000000000000000
146 Value: 0x0000000000000004
151 Value: 0x0000000000000000
156 Value: 0x0000000000000004
158 ## Test llvm-nm shows all symbols with -a.
160 # RUN: yaml2obj -docnum=3 %s > %t-a.elf-x86-64
161 # RUN: llvm-nm -a %t-a.elf-x86-64 | FileCheck %s -check-prefix ELF64-a
163 # ELF64-a: 00000000 b .bss
164 # ELF64-a-NEXT: 00000000 n .comment
165 # ELF64-a-NEXT: 00000000 d .data
166 # ELF64-a-NEXT: 00000000 N .debug_sec
167 # ELF64-a-NEXT: 00000000 t .text
168 # ELF64-a-NEXT: 00000000 a fileSym
169 # ELF64-a-NEXT: 00000014 T regularSym
170 # ELF64-a-NEXT: U undefSym
184 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
187 Flags: [ SHF_WRITE, SHF_ALLOC ]
190 Flags: [ SHF_WRITE, SHF_ALLOC ]
220 Value: 0x0000000000000014
222 ## Test that we drop the thumb bit only from function addresses.
224 # RUN: yaml2obj -docnum=4 %s > %t.elf-arm32
225 # RUN: llvm-nm %t.elf-arm32 | FileCheck %s -check-prefix ELF-THUMB
227 # ELF-THUMB: 00000000 t func
228 # ELF-THUMB: 00000003 t sym
239 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
244 Value: 0x0000000000000001
247 Value: 0x0000000000000003
249 # RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
250 # RUN: | FileCheck %s -check-prefix macho
252 # macho: U _SomeOtherFunction
253 # macho: 00000000 T _main
256 # RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
257 # RUN: | FileCheck %s -check-prefix macho-U
259 # macho-U-NOT: U _SomeOtherFunction
260 # macho-U: 00000000 T _main
261 # macho-U-NOT: U _puts
263 # RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
264 # RUN: | FileCheck %s -check-prefix macho64
266 # macho64: 0000000000000028 s L_.str
267 # macho64: U _SomeOtherFunction
268 # macho64: 0000000000000000 T _main
271 # RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
272 # RUN: | FileCheck %s -check-prefix macho-tdb
274 # macho-tdb: 0000000000000030 s EH_frame0
275 # macho-tdb: 0000000000000070 b _b
276 # macho-tdb: 000000000000000c D _d
277 # macho-tdb: 0000000000000000 T _t
278 # macho-tdb: 0000000000000048 S _t.eh
280 # RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
281 # RUN: | FileCheck %s -check-prefix macho-j
289 # RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
290 # RUN: | FileCheck %s -check-prefix macho-r
292 # macho-r: 0000000000000048 S _t.eh
293 # macho-r-NEXT: 0000000000000000 T _t
294 # macho-r-NEXT: 000000000000000c D _d
295 # macho-r-NEXT: 0000000000000070 b _b
296 # macho-r-NEXT: 0000000000000030 s EH_frame0
298 # RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \
299 # RUN: | FileCheck %s -check-prefix macho-s
301 # macho-s: 000000000000000c D _d
302 # macho-s-NOT: 0000000000000048 S _t.eh
303 # macho-s-NOT: 0000000000000000 T _t
304 # macho-s-NOT: 0000000000000070 b _b
305 # macho-s-NOT: 0000000000000030 s EH_frame0
307 # RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \
308 # RUN: | FileCheck %s -check-prefix macho-x
310 # macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
311 # macho-x: 0000000000000070 0e 03 0000 0000000d _b
312 # macho-x: 000000000000000c 0f 02 0000 00000004 _d
313 # macho-x: 0000000000000000 0f 01 0000 00000001 _t
314 # macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh
316 # RUN: llvm-nm -o %p/Inputs/macho-text-data-bss.macho-x86_64 \
317 # RUN: | FileCheck %s -check-prefix macho-o
319 # macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000030 s EH_frame0
320 # macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000070 b _b
321 # macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 000000000000000c D _d
322 # macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000000 T _t
323 # macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000048 S _t.eh
325 # RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \
326 # RUN: | FileCheck %s -check-prefix macho-pa
328 # macho-pa: 0000000000000000 - 00 0000 SO /Volumes/SandBox/
329 # macho-pa: 0000000000000000 - 00 0000 SO hello.c
330 # macho-pa: 0000000053c8408d - 03 0001 OSO /Volumes/SandBox/hello.o
331 # macho-pa: 0000000100000f30 - 01 0000 BNSYM
332 # macho-pa: 0000000100000f30 - 01 0000 FUN _main
333 # macho-pa: 000000000000003b - 00 0000 FUN
334 # macho-pa: 000000000000003b - 01 0000 ENSYM
335 # macho-pa: 0000000000000000 - 01 0000 SO
336 # macho-pa: 0000000100000000 T __mh_execute_header
337 # macho-pa: 0000000100000f30 T _main
338 # macho-pa: U _printf
339 # macho-pa: U dyld_stub_binder
341 # RUN: llvm-nm -u %p/Inputs/macho-hello-g.macho-x86_64 \
342 # RUN: | FileCheck %s -check-prefix macho-u
345 # macho-u: dyld_stub_binder
347 # RUN: llvm-nm -S -a %p/Inputs/common.coff-i386 \
348 # RUN: | FileCheck %s -check-prefix COFF-COMMON
350 # COFF-COMMON: 00000000 b .bss
351 # COFF-COMMON-NEXT: 00000000 d .data
352 # COFF-COMMON-NEXT: 00000000 d .drectve
353 # COFF-COMMON-NEXT: 00000000 n .file
354 # COFF-COMMON-NEXT: 00000000 r .rdata$zzz
355 # COFF-COMMON-NEXT: 00000000 t .text
356 # COFF-COMMON-NEXT: C _a
360 # RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
361 # RUN: llvm-nm a.out | FileCheck %s -check-prefix A-OUT
363 # A-OUT: U _SomeOtherFunction
364 # A-OUT: 00000000 T _main