Recommit r310809 with a fix for the spill problem
[llvm-core.git] / test / Object / nm-trivial-object.test
blob0be998e8605b9d0d2868dfc18d19695e809d6cd4
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 %p/Inputs/trivial-object-test.macho-i386 \
22 RUN:         | FileCheck %s -check-prefix macho
23 RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
24 RUN:         | FileCheck %s -check-prefix macho-U
25 RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
26 RUN:         | FileCheck %s -check-prefix macho64
27 RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
28 RUN:         | FileCheck %s -check-prefix macho-tdb
29 RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
30 RUN:         | FileCheck %s -check-prefix macho-j
31 RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
32 RUN:         | FileCheck %s -check-prefix macho-r
33 RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \
34 RUN:         | FileCheck %s -check-prefix macho-s
35 RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \
36 RUN:         | FileCheck %s -check-prefix macho-x
37 RUN: llvm-nm -o %p/Inputs/macho-text-data-bss.macho-x86_64 \
38 RUN:         | FileCheck %s -check-prefix macho-o
39 RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \
40 RUN:         | FileCheck %s -check-prefix macho-pa
41 RUN: llvm-nm -u %p/Inputs/macho-hello-g.macho-x86_64 \
42 RUN:         | FileCheck %s -check-prefix macho-u
43 RUN: llvm-nm -S -a %p/Inputs/common.coff-i386 \
44 RUN:         | FileCheck %s -check-prefix COFF-COMMON
45 RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
46 RUN:         | FileCheck %s -check-prefix ELF-SEC-ADDR64
47 RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
48 RUN:         | FileCheck %s -check-prefix ELF-THUMB
49 RUN: mkdir -p %t
50 RUN: cd %t
51 RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
52 RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
55 COFF32: 00000000 d .data
56 COFF32-NEXT: 00000000 t .text
57 COFF32-NEXT: 00000000 d L_.str
58 COFF32-NEXT:          U _SomeOtherFunction
59 COFF32-NEXT: 00000000 T _main
60 COFF32-NEXT:          U _puts
62 WASM:               U SomeOtherFunction
63 WASM-NEXT: 00000002 T main
64 WASM-NEXT:          U puts
65 WASM-NEXT: 00000010 D var
67 COFF64: 00000000 d .data
68 COFF64-NEXT: 00000000 t .text
69 COFF64-NEXT: 00000000 r ??__Ex@@YAXXZ
70 COFF64-NEXT: 00000000 d L.str
71 COFF64-NEXT:          U SomeOtherFunction
72 COFF64-NEXT: 00000000 T main
73 COFF64-NEXT:          U puts
75 COFF-COMMON: 00000000 b .bss
76 COFF-COMMON-NEXT: 00000000 d .data
77 COFF-COMMON-NEXT: 00000000 d .drectve
78 COFF-COMMON-NEXT: 00000000 n .file
79 COFF-COMMON-NEXT: 00000000 r .rdata$zzz
80 COFF-COMMON-NEXT: 00000000 t .text
81 COFF-COMMON-NEXT:          C _a
84 ELF-NOT:      U
85 ELF:          U SomeOtherFunction
86 ELF: 00000000 T main
87 ELF:          U puts
89 ELF-SIZE:                        U SomeOtherFunction
90 ELF-SIZE-NEXT: 00000000 00000024 T main
91 ELF-SIZE-NEXT:                   U puts
93 ELF-o: {{.*}}/trivial-object-test.elf-i386:          U SomeOtherFunction
94 ELF-o: {{.*}}/trivial-object-test.elf-i386: 00000000 T main
95 ELF-o: {{.*}}/trivial-object-test.elf-i386:          U puts
97 ELF-u:          U SomeOtherFunction
98 ELF-u:          U puts
100 ELF64:                  U SomeOtherFunction
101 ELF64: 0000000000000000 T main
102 ELF64:                  U puts
104 WEAK-ELF64:                  w f1
105 WEAK-ELF64: 0000000000000000 W f2
106 WEAK-ELF64:                  v x1
107 WEAK-ELF64: 0000000000000000 V x2
109 ABSOLUTE-ELF64: 0000000000000123 a a1
110 ABSOLUTE-ELF64: 0000000000000123 A a2
112 macho:          U _SomeOtherFunction
113 macho: 00000000 T _main
114 macho:          U _puts
116 macho-U-NOT:          U _SomeOtherFunction
117 macho-U: 00000000 T _main
118 macho-U-NOT:          U _puts
120 macho64: 0000000000000028 s L_.str
121 macho64:                  U _SomeOtherFunction
122 macho64: 0000000000000000 T _main
123 macho64:                  U _puts
125 macho-tdb: 0000000000000030 s EH_frame0
126 macho-tdb: 0000000000000070 b _b
127 macho-tdb: 000000000000000c D _d
128 macho-tdb: 0000000000000000 T _t
129 macho-tdb: 0000000000000048 S _t.eh
131 macho-j: EH_frame0
132 macho-j: _b
133 macho-j: _d
134 macho-j: _t
135 macho-j: _t.eh
137 macho-r: 0000000000000048 S _t.eh
138 macho-r-NEXT: 0000000000000000 T _t
139 macho-r-NEXT: 000000000000000c D _d
140 macho-r-NEXT: 0000000000000070 b _b
141 macho-r-NEXT: 0000000000000030 s EH_frame0
143 macho-s: 000000000000000c D _d
144 macho-s-NOT: 0000000000000048 S _t.eh
145 macho-s-NOT: 0000000000000000 T _t
146 macho-s-NOT: 0000000000000070 b _b
147 macho-s-NOT: 0000000000000030 s EH_frame0
149 macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
150 macho-x: 0000000000000070 0e 03 0000 0000000d _b
151 macho-x: 000000000000000c 0f 02 0000 00000004 _d
152 macho-x: 0000000000000000 0f 01 0000 00000001 _t
153 macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh
156 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000030 s EH_frame0
157 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000070 b _b
158 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 000000000000000c D _d
159 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000000 T _t
160 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000048 S _t.eh
162 macho-pa: 0000000000000000 - 00 0000    SO /Volumes/SandBox/
163 macho-pa: 0000000000000000 - 00 0000    SO hello.c
164 macho-pa: 0000000053c8408d - 03 0001   OSO /Volumes/SandBox/hello.o
165 macho-pa: 0000000100000f30 - 01 0000 BNSYM 
166 macho-pa: 0000000100000f30 - 01 0000   FUN _main
167 macho-pa: 000000000000003b - 00 0000   FUN 
168 macho-pa: 000000000000003b - 01 0000 ENSYM 
169 macho-pa: 0000000000000000 - 01 0000    SO 
170 macho-pa: 0000000100000000 T __mh_execute_header
171 macho-pa: 0000000100000f30 T _main
172 macho-pa:                  U _printf
173 macho-pa:                  U dyld_stub_binder
175 macho-u: _printf
176 macho-u: dyld_stub_binder
178 Test that nm uses addresses even with ELF .o files.
179 ELF-SEC-ADDR64:      0000000000000058 D a
180 ELF-SEC-ADDR64-NEXT: 000000000000005c D b
181 ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
182 ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
183 ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
186 Test that we drop the thumb bit only from function addresses.
187 ELF-THUMB: 00000000 t f
188 ELF-THUMB: 00000003 t g
190 A-OUT:          U _SomeOtherFunction
191 A-OUT: 00000000 T _main
192 A-OUT:          U _puts