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.elf-i386 \
6 RUN: | FileCheck %s -check-prefix ELF
7 RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 -S \
8 RUN: | FileCheck %s -check-prefix ELF-SIZE
9 RUN: llvm-nm -o %p/Inputs/trivial-object-test.elf-i386 \
10 RUN: | FileCheck %s -check-prefix ELF-o
11 RUN: llvm-nm -u %p/Inputs/trivial-object-test.elf-i386 \
12 RUN: | FileCheck %s -check-prefix ELF-u
13 RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \
14 RUN: | FileCheck %s -check-prefix ELF64
15 RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \
16 RUN: | FileCheck %s -check-prefix WEAK-ELF64
17 RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \
18 RUN: | FileCheck %s -check-prefix ABSOLUTE-ELF64
19 RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
20 RUN: | FileCheck %s -check-prefix macho
21 RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
22 RUN: | FileCheck %s -check-prefix macho-U
23 RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
24 RUN: | FileCheck %s -check-prefix macho64
25 RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
26 RUN: | FileCheck %s -check-prefix macho-tdb
27 RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
28 RUN: | FileCheck %s -check-prefix macho-j
29 RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
30 RUN: | FileCheck %s -check-prefix macho-r
31 RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \
32 RUN: | FileCheck %s -check-prefix macho-s
33 RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \
34 RUN: | FileCheck %s -check-prefix macho-x
35 RUN: llvm-nm -o %p/Inputs/macho-text-data-bss.macho-x86_64 \
36 RUN: | FileCheck %s -check-prefix macho-o
37 RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \
38 RUN: | FileCheck %s -check-prefix macho-pa
39 RUN: llvm-nm -u %p/Inputs/macho-hello-g.macho-x86_64 \
40 RUN: | FileCheck %s -check-prefix macho-u
41 RUN: llvm-nm -S -a %p/Inputs/common.coff-i386 \
42 RUN: | FileCheck %s -check-prefix COFF-COMMON
43 RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
44 RUN: | FileCheck %s -check-prefix ELF-SEC-ADDR64
45 RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
46 RUN: | FileCheck %s -check-prefix ELF-THUMB
49 RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
50 RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
53 COFF32: 00000000 d .data
54 COFF32-NEXT: 00000000 t .text
55 COFF32-NEXT: 00000000 d L_.str
56 COFF32-NEXT: U _SomeOtherFunction
57 COFF32-NEXT: 00000000 T _main
60 COFF64: 00000000 d .data
61 COFF64-NEXT: 00000000 t .text
62 COFF64-NEXT: 00000000 r ??__Ex@@YAXXZ
63 COFF64-NEXT: 00000000 d L.str
64 COFF64-NEXT: U SomeOtherFunction
65 COFF64-NEXT: 00000000 T main
68 COFF-COMMON: 00000000 b .bss
69 COFF-COMMON-NEXT: 00000000 d .data
70 COFF-COMMON-NEXT: 00000000 d .drectve
71 COFF-COMMON-NEXT: 00000000 n .file
72 COFF-COMMON-NEXT: 00000000 r .rdata$zzz
73 COFF-COMMON-NEXT: 00000000 t .text
74 COFF-COMMON-NEXT: C _a
78 ELF: U SomeOtherFunction
82 FIXME: we should not print the size of undefined symbols.
83 ELF-SIZE: 00000000 U SomeOtherFunction
84 ELF-SIZE-NEXT: 00000000 00000024 T main
85 ELF-SIZE-NEXT: 00000000 U puts
87 ELF-o: {{.*}}/trivial-object-test.elf-i386: U SomeOtherFunction
88 ELF-o: {{.*}}/trivial-object-test.elf-i386: 00000000 T main
89 ELF-o: {{.*}}/trivial-object-test.elf-i386: U puts
91 ELF-u: U SomeOtherFunction
94 ELF64: U SomeOtherFunction
95 ELF64: 0000000000000000 T main
99 WEAK-ELF64: 0000000000000000 W f2
101 WEAK-ELF64: 0000000000000000 V x2
103 ABSOLUTE-ELF64: 0000000000000123 a a1
104 ABSOLUTE-ELF64: 0000000000000123 A a2
106 macho: U _SomeOtherFunction
107 macho: 00000000 T _main
110 macho-U-NOT: U _SomeOtherFunction
111 macho-U: 00000000 T _main
114 macho64: 0000000000000028 s L_.str
115 macho64: U _SomeOtherFunction
116 macho64: 0000000000000000 T _main
119 macho-tdb: 0000000000000030 s EH_frame0
120 macho-tdb: 0000000000000070 b _b
121 macho-tdb: 000000000000000c D _d
122 macho-tdb: 0000000000000000 T _t
123 macho-tdb: 0000000000000048 S _t.eh
131 macho-r: 0000000000000048 S _t.eh
132 macho-r-NEXT: 0000000000000000 T _t
133 macho-r-NEXT: 000000000000000c D _d
134 macho-r-NEXT: 0000000000000070 b _b
135 macho-r-NEXT: 0000000000000030 s EH_frame0
137 macho-s: 000000000000000c D _d
138 macho-s-NOT: 0000000000000048 S _t.eh
139 macho-s-NOT: 0000000000000000 T _t
140 macho-s-NOT: 0000000000000070 b _b
141 macho-s-NOT: 0000000000000030 s EH_frame0
143 macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
144 macho-x: 0000000000000070 0e 03 0000 0000000d _b
145 macho-x: 000000000000000c 0f 02 0000 00000004 _d
146 macho-x: 0000000000000000 0f 01 0000 00000001 _t
147 macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh
150 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000030 s EH_frame0
151 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000070 b _b
152 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 000000000000000c D _d
153 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000000 T _t
154 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000048 S _t.eh
156 macho-pa: 0000000000000000 - 00 0000 SO /Volumes/SandBox/
157 macho-pa: 0000000000000000 - 00 0000 SO hello.c
158 macho-pa: 0000000053c8408d - 03 0001 OSO /Volumes/SandBox/hello.o
159 macho-pa: 0000000100000f30 - 01 0000 BNSYM
160 macho-pa: 0000000100000f30 - 01 0000 FUN _main
161 macho-pa: 000000000000003b - 00 0000 FUN
162 macho-pa: 000000000000003b - 01 0000 ENSYM
163 macho-pa: 0000000000000000 - 01 0000 SO
164 macho-pa: 0000000100000000 T __mh_execute_header
165 macho-pa: 0000000100000f30 T _main
167 macho-pa: U dyld_stub_binder
170 macho-u: dyld_stub_binder
172 Test that nm uses addresses even with ELF .o files.
173 ELF-SEC-ADDR64: 0000000000000058 D a
174 ELF-SEC-ADDR64-NEXT: 000000000000005c D b
175 ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
176 ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
177 ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
180 Test that we drop the thumb bit only from function addresses.
181 ELF-THUMB: 00000000 t f
182 ELF-THUMB: 00000003 t g
184 A-OUT: U _SomeOtherFunction
185 A-OUT: 00000000 T _main