Revert "[InstCombine] Support gep nuw in icmp folds" (#118698)
[llvm-project.git] / llvm / test / MC / ELF / section.s
blobe4e6f4bccb8a418cd480d64f3db77e0b688955a8
1 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -S - | FileCheck %s
2 // RUN: llvm-mc -filetype=asm -triple x86_64-pc-linux-gnu %s -o - | FileCheck %s --check-prefix=ASM
4 // Test that these names are accepted.
6 .section .note.GNU-stack,"",@progbits
7 .section .note.GNU-stack2,"",%progbits
8 .section .note.GNU-,"",@progbits
9 .section -.note.GNU,"","progbits"
10 .section src/stack.c,"",@progbits
11 .section ~!@$%^&*()_-+={[}]|\\:<>,"",@progbits
13 // CHECK: Name: .note.GNU-stack
14 // CHECK: Name: .note.GNU-stack2
15 // CHECK: Name: .note.GNU-
16 // CHECK: Name: -.note.GNU
17 // CHECK: Name: src/stack.c
18 // CHECK: Name: ~!@$%^&*()_-+={[}]|\\:<>
20 // Test that the defaults are used
22 .section .init
23 .section .fini
24 .section .rodata
25 .section zed, ""
27 // CHECK: Section {
28 // CHECK: Name: .init
29 // CHECK-NEXT: Type: SHT_PROGBITS
30 // CHECK-NEXT: Flags [
31 // CHECK-NEXT: SHF_ALLOC
32 // CHECK-NEXT: SHF_EXECINSTR
33 // CHECK-NEXT: ]
34 // CHECK-NEXT: Address: 0x0
35 // CHECK-NEXT: Offset:
36 // CHECK-NEXT: Size: 0
37 // CHECK-NEXT: Link: 0
38 // CHECK-NEXT: Info: 0
39 // CHECK-NEXT: AddressAlignment: 1
40 // CHECK-NEXT: EntrySize: 0
41 // CHECK-NEXT: }
42 // CHECK-NEXT: Section {
43 // CHECK-NEXT: Index:
44 // CHECK-NEXT: Name: .fini
45 // CHECK-NEXT: Type: SHT_PROGBITS
46 // CHECK-NEXT: Flags [
47 // CHECK-NEXT: SHF_ALLOC
48 // CHECK-NEXT: SHF_EXECINSTR
49 // CHECK-NEXT: ]
50 // CHECK-NEXT: Address: 0x0
51 // CHECK-NEXT: Offset:
52 // CHECK-NEXT: Size: 0
53 // CHECK-NEXT: Link: 0
54 // CHECK-NEXT: Info: 0
55 // CHECK-NEXT: AddressAlignment: 1
56 // CHECK-NEXT: EntrySize: 0
57 // CHECK-NEXT: }
58 // CHECK-NEXT: Section {
59 // CHECK-NEXT: Index:
60 // CHECK-NEXT: Name: .rodata
61 // CHECK-NEXT: Type: SHT_PROGBITS
62 // CHECK-NEXT: Flags [
63 // CHECK-NEXT: SHF_ALLOC
64 // CHECK-NEXT: ]
65 // CHECK-NEXT: Address: 0x0
66 // CHECK-NEXT: Offset:
67 // CHECK-NEXT: Size: 0
68 // CHECK-NEXT: Link: 0
69 // CHECK-NEXT: Info: 0
70 // CHECK-NEXT: AddressAlignment: 1
71 // CHECK-NEXT: EntrySize: 0
72 // CHECK-NEXT: }
73 // CHECK-NEXT: Section {
74 // CHECK-NEXT: Index:
75 // CHECK-NEXT: Name: zed
76 // CHECK-NEXT: Type: SHT_PROGBITS
77 // CHECK-NEXT: Flags [
78 // CHECK-NEXT: ]
79 // CHECK-NEXT: Address: 0x0
80 // CHECK-NEXT: Offset:
81 // CHECK-NEXT: Size: 0
82 // CHECK-NEXT: Link: 0
83 // CHECK-NEXT: Info: 0
84 // CHECK-NEXT: AddressAlignment: 1
85 // CHECK-NEXT: EntrySize: 0
86 // CHECK-NEXT: }
88 .section .note.test,"",@note
89 // CHECK: Section {
90 // CHECK: Name: .note.test
91 // CHECK-NEXT: Type: SHT_NOTE
92 // CHECK-NEXT: Flags [
93 // CHECK-NEXT: ]
94 // CHECK-NEXT: Address: 0x0
95 // CHECK-NEXT: Offset:
96 // CHECK-NEXT: Size: 0
97 // CHECK-NEXT: Link: 0
98 // CHECK-NEXT: Info: 0
99 // CHECK-NEXT: AddressAlignment: 1
100 // CHECK-NEXT: EntrySize: 0
101 // CHECK-NEXT: }
103 // Test that we can parse these
104 foo:
105 bar:
106 .section .text.foo,"axG",@progbits,foo,comdat
107 .section .text.bar,"axMG",@progbits,42,bar,comdat
109 // Test that the default values are not used
111 .section .eh_frame,"a",@unwind
113 // CHECK: Section {
114 // CHECK: Name: .eh_frame
115 // CHECK-NEXT: Type: SHT_X86_64_UNWIND
116 // CHECK-NEXT: Flags [
117 // CHECK-NEXT: SHF_ALLOC
118 // CHECK-NEXT: ]
119 // CHECK-NEXT: Address: 0x0
120 // CHECK-NEXT: Offset:
121 // CHECK-NEXT: Size: 0
122 // CHECK-NEXT: Link: 0
123 // CHECK-NEXT: Info: 0
124 // CHECK-NEXT: AddressAlignment: 1
125 // CHECK-NEXT: EntrySize: 0
126 // CHECK-NEXT: }
128 .section .excluded,"e",@progbits
130 // CHECK: Section {
131 // CHECK: Name: .excluded
132 // CHECK-NEXT: Type: SHT_PROGBITS (0x1)
133 // CHECK-NEXT: Flags [ (0x80000000)
134 // CHECK-NEXT: SHF_EXCLUDE (0x80000000)
135 // CHECK-NEXT: ]
136 // CHECK-NEXT: Address: 0x0
137 // CHECK-NEXT: Offset:
138 // CHECK-NEXT: Size: 0
139 // CHECK-NEXT: Link: 0
140 // CHECK-NEXT: Info: 0
141 // CHECK-NEXT: AddressAlignment: 1
142 // CHECK-NEXT: EntrySize: 0
143 // CHECK-NEXT: }
145 // Test that we handle the strings like gas
146 .section bar-"foo"
147 .section "fooo"
150 // CHECK: Section {
151 // CHECK: Name: bar-"foo"
152 // CHECK: Section {
153 // CHECK: Name: fooo
155 // Test SHF_LINK_ORDER
157 .section .shf_metadata_target1, "a"
158 .quad 0
159 .section .shf_metadata_target2, "a", @progbits, unique, 1
160 .Lshf_metadata_target2_1:
161 .quad 0
162 .section .shf_metadata_target2, "a", @progbits, unique, 2
163 .Lshf_metadata_target2_2:
164 .quad 0
166 .section .shf_metadata1,"ao",@progbits,.Lshf_metadata_target2_1
167 .section .shf_metadata2,"ao",@progbits,.Lshf_metadata_target2_2
168 .section .shf_metadata3,"ao",@progbits,.shf_metadata_target1
169 .section .linkorder_group_zero,"aoG",@progbits,.shf_metadata_target1,foo
170 // ASM: .section .shf_metadata1,"ao",@progbits,.Lshf_metadata_target2_1
171 // ASM: .section .shf_metadata2,"ao",@progbits,.Lshf_metadata_target2_2
172 // ASM: .section .shf_metadata3,"ao",@progbits,.shf_metadata_target1
173 // ASM: .section .linkorder_group_zero,"aoG",@progbits,.shf_metadata_target1,foo{{$}}
175 // CHECK: Section {
176 // CHECK: Index: 22
177 // CHECK-NEXT: Name: .shf_metadata_target1
179 // CHECK: Section {
180 // CHECK: Index: 23
181 // CHECK-NEXT: Name: .shf_metadata_target2
183 // CHECK: Section {
184 // CHECK: Index: 24
185 // CHECK-NEXT: Name: .shf_metadata_target2
187 // CHECK: Section {
188 // CHECK: Name: .shf_metadata1
189 // CHECK-NEXT: Type: SHT_PROGBITS
190 // CHECK-NEXT: Flags [
191 // CHECK-NEXT: SHF_ALLOC
192 // CHECK-NEXT: SHF_LINK_ORDER
193 // CHECK-NEXT: ]
194 // CHECK-NEXT: Address:
195 // CHECK-NEXT: Offset:
196 // CHECK-NEXT: Size:
197 // CHECK-NEXT: Link: 23
198 // CHECK-NEXT: Info: 0
200 // CHECK: Section {
201 // CHECK: Name: .shf_metadata2
202 // CHECK-NEXT: Type: SHT_PROGBITS
203 // CHECK-NEXT: Flags [
204 // CHECK-NEXT: SHF_ALLOC
205 // CHECK-NEXT: SHF_LINK_ORDER
206 // CHECK-NEXT: ]
207 // CHECK-NEXT: Address:
208 // CHECK-NEXT: Offset:
209 // CHECK-NEXT: Size:
210 // CHECK-NEXT: Link: 24
211 // CHECK-NEXT: Info: 0
213 // CHECK: Section {
214 // CHECK: Name: .shf_metadata3
215 // CHECK-NEXT: Type: SHT_PROGBITS
216 // CHECK-NEXT: Flags [
217 // CHECK-NEXT: SHF_ALLOC
218 // CHECK-NEXT: SHF_LINK_ORDER
219 // CHECK-NEXT: ]
220 // CHECK-NEXT: Address:
221 // CHECK-NEXT: Offset:
222 // CHECK-NEXT: Size:
223 // CHECK-NEXT: Link: 22
224 // CHECK-NEXT: Info: 0
226 // CHECK: Section {
227 // CHECK: Name: .linkorder_group_zero
228 // CHECK-NEXT: Type: SHT_PROGBITS
229 // CHECK-NEXT: Flags [
230 // CHECK-NEXT: SHF_ALLOC
231 // CHECK-NEXT: SHF_GROUP
232 // CHECK-NEXT: SHF_LINK_ORDER
233 // CHECK-NEXT: ]
234 // CHECK-NEXT: Address:
235 // CHECK-NEXT: Offset:
236 // CHECK-NEXT: Size:
237 // CHECK-NEXT: Link: 22
238 // CHECK-NEXT: Info: 0
240 .section .text.foo
241 // CHECK: Section {
242 // CHECK: Name: .text.foo
243 // CHECK-NEXT: Type: SHT_PROGBITS
244 // CHECK-NEXT: Flags [
245 // CHECK-NEXT: SHF_ALLOC
246 // CHECK-NEXT: SHF_EXECINSTR
247 // CHECK-NEXT: ]
249 .section .bss
250 // CHECK: Section {
251 // CHECK: Name: .bss
252 // CHECK-NEXT: Type: SHT_NOBITS
253 // CHECK-NEXT: Flags [
254 // CHECK-NEXT: SHF_ALLOC
255 // CHECK-NEXT: SHF_WRITE
256 // CHECK-NEXT: ]
258 .section .bss.foo
259 // CHECK: Section {
260 // CHECK: Name: .bss.foo
261 // CHECK-NEXT: Type: SHT_NOBITS
262 // CHECK-NEXT: Flags [
263 // CHECK-NEXT: SHF_ALLOC
264 // CHECK-NEXT: SHF_WRITE
265 // CHECK-NEXT: ]
267 .section .tbss
268 // CHECK: Section {
269 // CHECK: Name: .tbss
270 // CHECK-NEXT: Type: SHT_NOBITS
271 // CHECK-NEXT: Flags [
272 // CHECK-NEXT: SHF_ALLOC
273 // CHECK-NEXT: SHF_TLS
274 // CHECK-NEXT: SHF_WRITE
275 // CHECK-NEXT: ]
277 .section .tbss.foo
278 // CHECK: Section {
279 // CHECK: Name: .tbss.foo
280 // CHECK-NEXT: Type: SHT_NOBITS
281 // CHECK-NEXT: Flags [
282 // CHECK-NEXT: SHF_ALLOC
283 // CHECK-NEXT: SHF_TLS
284 // CHECK-NEXT: SHF_WRITE
285 // CHECK-NEXT: ]
287 .section .large,"l"
288 // ASM: .section .large,"l"
290 // CHECK: Section {
291 // CHECK: Name: .large
292 // CHECK-NEXT: Type: SHT_PROGBITS
293 // CHECK-NEXT: Flags [
294 // CHECK-NEXT: SHF_X86_64_LARGE
295 // CHECK-NEXT: ]
297 // Test SHT_LLVM_ODRTAB
299 .section .odrtab,"e",@llvm_odrtab
300 // ASM: .section .odrtab,"e",@llvm_odrtab
302 // CHECK: Section {
303 // CHECK: Name: .odrtab
304 // CHECK-NEXT: Type: SHT_LLVM_ODRTAB
305 // CHECK-NEXT: Flags [
306 // CHECK-NEXT: SHF_EXCLUDE
307 // CHECK-NEXT: ]
309 // Test SHT_LLVM_LINKER_OPTIONS
311 .section ".linker-options","e",@llvm_linker_options
312 // ASM: .section ".linker-options","e",@llvm_linker_options
314 // CHECK: Section {
315 // CHECK: Name: .linker-options
316 // CHECK-NEXT: Type: SHT_LLVM_LINKER_OPTIONS
317 // CHECK-NEXT: Flags [
318 // CHECK-NEXT: SHF_EXCLUDE
319 // CHECK-NEXT: ]
320 // CHECK: }
322 // Test SHT_LLVM_DEPENDENT_LIBRARIES
324 .section .deplibs,"MS",@llvm_dependent_libraries,1
325 // ASM: .section .deplibs,"MS",@llvm_dependent_libraries,1
327 // CHECK: Section {
328 // CHECK: Name: .deplibs
329 // CHECK-NEXT: Type: SHT_LLVM_DEPENDENT_LIBRARIES
330 // CHECK-NEXT: Flags [
331 // CHECK-NEXT: SHF_MERGE
332 // CHECK-NEXT: SHF_STRINGS
333 // CHECK-NEXT: ]
334 // CHECK: }
336 // Test SHT_LLVM_SYMPART
338 .section .llvm_sympart,"",@llvm_sympart
339 // ASM: .section .llvm_sympart,"",@llvm_sympart
341 // CHECK: Section {
342 // CHECK: Name: .llvm_sympart
343 // CHECK-NEXT: Type: SHT_LLVM_SYMPART
344 // CHECK-NEXT: Flags [
345 // CHECK-NEXT: ]
346 // CHECK: }
348 .section .llvm.lto,"e",@llvm_lto
349 // ASM: .section .llvm.lto,"e",@llvm_lto
351 // CHECK: Section {
352 // CHECK: Name: .llvm.lto
353 // CHECK-NEXT: Type: SHT_LLVM_LTO
354 // CHECK-NEXT: Flags [
355 // CHECK-NEXT: SHF_EXCLUDE
356 // CHECK-NEXT: ]
357 // CHECK: }