[PowerPC][NFC] Add a test case for extract and store patterns
[llvm-core.git] / test / Object / nm-trivial-object.test
blob621a1779166aa33698592364bf25d8c86bb931fa
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
63 WASM:      00000000 d .L.str
64 WASM-NEXT:          U SomeOtherFunction
65 WASM-NEXT: 00000002 T main
66 WASM-NEXT:          U puts
67 WASM-NEXT: 00000010 D var
70 COFF64: 00000000 d .data
71 COFF64-NEXT: 00000000 t .text
72 COFF64-NEXT: 00000000 r ??__Ex@@YAXXZ
73 COFF64-NEXT: 00000000 d L.str
74 COFF64-NEXT:          U SomeOtherFunction
75 COFF64-NEXT: 00000000 T main
76 COFF64-NEXT:          U puts
78 COFF-COMMON: 00000000 b .bss
79 COFF-COMMON-NEXT: 00000000 d .data
80 COFF-COMMON-NEXT: 00000000 d .drectve
81 COFF-COMMON-NEXT: 00000000 n .file
82 COFF-COMMON-NEXT: 00000000 r .rdata$zzz
83 COFF-COMMON-NEXT: 00000000 t .text
84 COFF-COMMON-NEXT:          C _a
87 ELF-NOT:      U
88 ELF:          U SomeOtherFunction
89 ELF: 00000000 T main
90 ELF:          U puts
92 ELF-SIZE:                        U SomeOtherFunction
93 ELF-SIZE-NEXT: 00000000 00000024 T main
94 ELF-SIZE-NEXT:                   U puts
96 ELF-o: {{.*}}/trivial-object-test.elf-i386:          U SomeOtherFunction
97 ELF-o: {{.*}}/trivial-object-test.elf-i386: 00000000 T main
98 ELF-o: {{.*}}/trivial-object-test.elf-i386:          U puts
100 ELF-u:          U SomeOtherFunction
101 ELF-u:          U puts
103 ELF64:                  U SomeOtherFunction
104 ELF64: 0000000000000000 T main
105 ELF64:                  U puts
107 WEAK-ELF64:                  w f1
108 WEAK-ELF64: 0000000000000000 W f2
109 WEAK-ELF64:                  v x1
110 WEAK-ELF64: 0000000000000000 V x2
112 ABSOLUTE-ELF64: 0000000000000123 a a1
113 ABSOLUTE-ELF64: 0000000000000123 A a2
115 macho:          U _SomeOtherFunction
116 macho: 00000000 T _main
117 macho:          U _puts
119 macho-U-NOT:          U _SomeOtherFunction
120 macho-U: 00000000 T _main
121 macho-U-NOT:          U _puts
123 macho64: 0000000000000028 s L_.str
124 macho64:                  U _SomeOtherFunction
125 macho64: 0000000000000000 T _main
126 macho64:                  U _puts
128 macho-tdb: 0000000000000030 s EH_frame0
129 macho-tdb: 0000000000000070 b _b
130 macho-tdb: 000000000000000c D _d
131 macho-tdb: 0000000000000000 T _t
132 macho-tdb: 0000000000000048 S _t.eh
134 macho-j: EH_frame0
135 macho-j: _b
136 macho-j: _d
137 macho-j: _t
138 macho-j: _t.eh
140 macho-r: 0000000000000048 S _t.eh
141 macho-r-NEXT: 0000000000000000 T _t
142 macho-r-NEXT: 000000000000000c D _d
143 macho-r-NEXT: 0000000000000070 b _b
144 macho-r-NEXT: 0000000000000030 s EH_frame0
146 macho-s: 000000000000000c D _d
147 macho-s-NOT: 0000000000000048 S _t.eh
148 macho-s-NOT: 0000000000000000 T _t
149 macho-s-NOT: 0000000000000070 b _b
150 macho-s-NOT: 0000000000000030 s EH_frame0
152 macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
153 macho-x: 0000000000000070 0e 03 0000 0000000d _b
154 macho-x: 000000000000000c 0f 02 0000 00000004 _d
155 macho-x: 0000000000000000 0f 01 0000 00000001 _t
156 macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh
159 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000030 s EH_frame0
160 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000070 b _b
161 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 000000000000000c D _d
162 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000000 T _t
163 macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000048 S _t.eh
165 macho-pa: 0000000000000000 - 00 0000    SO /Volumes/SandBox/
166 macho-pa: 0000000000000000 - 00 0000    SO hello.c
167 macho-pa: 0000000053c8408d - 03 0001   OSO /Volumes/SandBox/hello.o
168 macho-pa: 0000000100000f30 - 01 0000 BNSYM 
169 macho-pa: 0000000100000f30 - 01 0000   FUN _main
170 macho-pa: 000000000000003b - 00 0000   FUN 
171 macho-pa: 000000000000003b - 01 0000 ENSYM 
172 macho-pa: 0000000000000000 - 01 0000    SO 
173 macho-pa: 0000000100000000 T __mh_execute_header
174 macho-pa: 0000000100000f30 T _main
175 macho-pa:                  U _printf
176 macho-pa:                  U dyld_stub_binder
178 macho-u: _printf
179 macho-u: dyld_stub_binder
181 Test that nm uses addresses even with ELF .o files.
182 ELF-SEC-ADDR64:      0000000000000058 D a
183 ELF-SEC-ADDR64-NEXT: 000000000000005c D b
184 ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
185 ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
186 ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
189 Test that we drop the thumb bit only from function addresses.
190 ELF-THUMB: 00000000 t f
191 ELF-THUMB: 00000003 t g
193 A-OUT:          U _SomeOtherFunction
194 A-OUT: 00000000 T _main
195 A-OUT:          U _puts