• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-mc -filetype=obj -triple arm-eabi %s -o - | llvm-readobj -S --symbols - | FileCheck %s
2// Test that global variables and functions are assigned correct section.
3	.text
4	.syntax unified
5	.eabi_attribute	67, "2.09"	@ Tag_conformance
6	.eabi_attribute	6, 1	@ Tag_CPU_arch
7	.eabi_attribute	8, 1	@ Tag_ARM_ISA_use
8	.eabi_attribute	17, 1	@ Tag_ABI_PCS_GOT_use
9	.eabi_attribute	20, 1	@ Tag_ABI_FP_denormal
10	.eabi_attribute	21, 1	@ Tag_ABI_FP_exceptions
11	.eabi_attribute	23, 3	@ Tag_ABI_FP_number_model
12	.eabi_attribute	34, 1	@ Tag_CPU_unaligned_access
13	.eabi_attribute	24, 1	@ Tag_ABI_align_needed
14	.eabi_attribute	25, 1	@ Tag_ABI_align_preserved
15	.eabi_attribute	38, 1	@ Tag_ABI_FP_16bit_format
16	.eabi_attribute	18, 4	@ Tag_ABI_PCS_wchar_t
17	.eabi_attribute	26, 2	@ Tag_ABI_enum_size
18	.eabi_attribute	14, 0	@ Tag_ABI_PCS_R9_use
19	.section	my_text.1,"ax",%progbits
20	.globl	foo
21	.p2align	2
22	.type	foo,%function
23	.code	32                      @ @foo
24foo:
25	.fnstart
26@ %bb.0:                                @ %entry
27	ldr	r0, .LCPI0_0
28	ldr	r0, [r0]
29	mov	pc, lr
30	.p2align	2
31@ %bb.1:
32.LCPI0_0:
33	.long	b
34.Lfunc_end0:
35	.size	foo, .Lfunc_end0-foo
36	.cantunwind
37	.fnend
38
39	.section	my_text.2,"ax",%progbits
40	.globl	goo
41	.p2align	2
42	.type	goo,%function
43	.code	32                      @ @goo
44goo:
45	.fnstart
46@ %bb.0:                                @ %entry
47	.save	{r11, lr}
48	push	{r11, lr}
49	ldr	r0, .LCPI1_0
50	ldr	r1, .LCPI1_1
51	bl	zoo
52	pop	{r11, lr}
53	mov	pc, lr
54	.p2align	2
55@ %bb.1:
56.LCPI1_0:
57	.long	_ZL1g
58.LCPI1_1:
59	.long	_ZZ3gooE7lstat_h
60.Lfunc_end1:
61	.size	goo, .Lfunc_end1-goo
62	.cantunwind
63	.fnend
64
65	.text
66	.globl	hoo
67	.p2align	2
68	.type	hoo,%function
69	.code	32                      @ @hoo
70hoo:
71	.fnstart
72@ %bb.0:                                @ %entry
73	ldr	r0, .LCPI2_0
74	ldr	r0, [r0]
75	mov	pc, lr
76	.p2align	2
77@ %bb.1:
78.LCPI2_0:
79	.long	b
80.Lfunc_end2:
81	.size	hoo, .Lfunc_end2-hoo
82	.cantunwind
83	.fnend
84
85	.type	a,%object               @ @a
86	.section	my_bss.1,"aw",%nobits
87	.globl	a
88	.p2align	2
89a:
90	.long	0                       @ 0x0
91	.size	a, 4
92
93	.type	b,%object               @ @b
94	.section	my_data.1,"aw",%progbits
95	.globl	b
96	.p2align	2
97b:
98	.long	1                       @ 0x1
99	.size	b, 4
100
101	.type	c,%object               @ @c
102	.section	my_bss.1,"aw",%nobits
103	.globl	c
104	.p2align	2
105c:
106	.zero	16
107	.size	c, 16
108
109	.type	d,%object               @ @d
110	.globl	d
111	.p2align	1
112d:
113	.zero	10
114	.size	d, 10
115
116	.type	e,%object               @ @e
117	.section	my_data.1,"aw",%progbits
118	.globl	e
119	.p2align	1
120e:
121	.short	0                       @ 0x0
122	.short	0                       @ 0x0
123	.short	1                       @ 0x1
124	.short	0                       @ 0x0
125	.short	0                       @ 0x0
126	.short	0                       @ 0x0
127	.size	e, 12
128
129	.type	f,%object               @ @f
130	.section	my_rodata.1,"a",%progbits
131	.globl	f
132	.p2align	2
133f:
134	.long	2                       @ 0x2
135	.size	f, 4
136
137	.type	h,%object               @ @h
138	.bss
139	.globl	h
140	.p2align	2
141h:
142	.long	0                       @ 0x0
143	.size	h, 4
144
145	.type	i,%object               @ @i
146	.section	my_bss.2,"aw",%nobits
147	.globl	i
148	.p2align	2
149i:
150	.long	0                       @ 0x0
151	.size	i, 4
152
153	.type	j,%object               @ @j
154	.section	my_rodata.1,"a",%progbits
155	.globl	j
156	.p2align	2
157j:
158	.long	4                       @ 0x4
159	.size	j, 4
160
161	.type	k,%object               @ @k
162	.section	my_bss.2,"aw",%nobits
163	.globl	k
164	.p2align	2
165k:
166	.long	0                       @ 0x0
167	.size	k, 4
168
169	.type	_ZZ3gooE7lstat_h,%object @ @_ZZ3gooE7lstat_h
170	.p2align	2
171_ZZ3gooE7lstat_h:
172	.long	0                       @ 0x0
173	.size	_ZZ3gooE7lstat_h, 4
174
175	.type	_ZL1g,%object           @ @_ZL1g
176	.section	my_bss.1,"aw",%nobits
177	.p2align	2
178_ZL1g:
179	.zero	8
180	.size	_ZL1g, 8
181
182	.type	l,%object               @ @l
183	.section	my_data.2,"aw",%progbits
184	.globl	l
185	.p2align	2
186l:
187	.long	5                       @ 0x5
188	.size	l, 4
189
190	.type	m,%object               @ @m
191	.section	my_rodata.2,"a",%progbits
192	.globl	m
193	.p2align	2
194m:
195	.long	6                       @ 0x6
196	.size	m, 4
197
198	.type	n,%object               @ @n
199	.bss
200	.globl	n
201	.p2align	2
202n:
203	.long	0                       @ 0x0
204	.size	n, 4
205
206	.type	o,%object               @ @o
207	.data
208	.globl	o
209	.p2align	2
210o:
211	.long	6                       @ 0x6
212	.size	o, 4
213
214	.type	p,%object               @ @p
215	.section	.rodata,"a",%progbits
216	.globl	p
217	.p2align	2
218p:
219	.long	7                       @ 0x7
220	.size	p, 4
221
222
223	.ident	"clang version 5.0.0"
224	.section	".note.GNU-stack","",%progbits
225	.eabi_attribute	30, 1	@ Tag_ABI_optimization_goals
226
227//CHECK:   Section {
228//CHECK:     Name: .text
229//CHECK:     Type: SHT_PROGBITS (0x1)
230//CHECK:     Flags [ (0x6)
231//CHECK:       SHF_ALLOC (0x2)
232//CHECK:       SHF_EXECINSTR (0x4)
233//CHECK:     ]
234//CHECK:   }
235//CHECK:   Section {
236//CHECK:     Name: my_text.1
237//CHECK:     Type: SHT_PROGBITS (0x1)
238//CHECK:     Flags [ (0x6)
239//CHECK:       SHF_ALLOC (0x2)
240//CHECK:       SHF_EXECINSTR (0x4)
241//CHECK:     ]
242//CHECK:   }
243//CHECK:   Section {
244//CHECK:     Name: my_text.2
245//CHECK:     Type: SHT_PROGBITS (0x1)
246//CHECK:     Flags [ (0x6)
247//CHECK:       SHF_ALLOC (0x2)
248//CHECK:       SHF_EXECINSTR (0x4)
249//CHECK:     ]
250//CHECK:   }
251//CHECK:   Section {
252//CHECK:     Name: my_bss.1
253//CHECK:     Type: SHT_NOBITS (0x8)
254//CHECK:     Flags [ (0x3)
255//CHECK:       SHF_ALLOC (0x2)
256//CHECK:       SHF_WRITE (0x1)
257//CHECK:     ]
258//CHECK:   }
259//CHECK:   Section {
260//CHECK:     Name: my_data.1
261//CHECK:     Type: SHT_PROGBITS (0x1)
262//CHECK:     Flags [ (0x3)
263//CHECK:       SHF_ALLOC (0x2)
264//CHECK:       SHF_WRITE (0x1)
265//CHECK:     ]
266//CHECK:   }
267//CHECK:   Section {
268//CHECK:     Name: my_rodata.1
269//CHECK:     Type: SHT_PROGBITS (0x1)
270//CHECK:     Flags [ (0x2)
271//CHECK:       SHF_ALLOC (0x2)
272//CHECK:     ]
273//CHECK:   }
274//CHECK:   Section {
275//CHECK:     Name: .bss
276//CHECK:     Type: SHT_NOBITS (0x8)
277//CHECK:     Flags [ (0x3)
278//CHECK:       SHF_ALLOC (0x2)
279//CHECK:       SHF_WRITE (0x1)
280//CHECK:     ]
281//CHECK:   }
282//CHECK:   Section {
283//CHECK:     Name: my_bss.2
284//CHECK:     Type: SHT_NOBITS (0x8)
285//CHECK:     Flags [ (0x3)
286//CHECK:       SHF_ALLOC (0x2)
287//CHECK:       SHF_WRITE (0x1)
288//CHECK:     ]
289//CHECK:   }
290//CHECK:   Section {
291//CHECK:     Name: my_data.2
292//CHECK:     Type: SHT_PROGBITS (0x1)
293//CHECK:     Flags [ (0x3)
294//CHECK:       SHF_ALLOC (0x2)
295//CHECK:       SHF_WRITE (0x1)
296//CHECK:     ]
297//CHECK:   }
298//CHECK:   Section {
299//CHECK:     Name: my_rodata.2
300//CHECK:     Type: SHT_PROGBITS (0x1)
301//CHECK:     Flags [ (0x2)
302//CHECK:       SHF_ALLOC (0x2)
303//CHECK:     ]
304//CHECK:   }
305//CHECK:   Section {
306//CHECK:     Name: .data
307//CHECK:     Type: SHT_PROGBITS (0x1)
308//CHECK:     Flags [ (0x3)
309//CHECK:       SHF_ALLOC (0x2)
310//CHECK:       SHF_WRITE (0x1)
311//CHECK:     ]
312//CHECK:   }
313//CHECK:   Section {
314//CHECK:     Name: .rodata
315//CHECK:     Type: SHT_PROGBITS (0x1)
316//CHECK:     Flags [ (0x2)
317//CHECK:       SHF_ALLOC (0x2)
318//CHECK:     ]
319//CHECK:   }
320//CHECK:   Symbol {
321//CHECK:     Name: _ZL1g
322//CHECK:     Section: my_bss.1 (0xE)
323//CHECK:   }
324//CHECK:   Symbol {
325//CHECK:     Name: _ZZ3gooE7lstat_h
326//CHECK:     Section: my_bss.2 (0x12)
327//CHECK:   }
328//CHECK:   Symbol {
329//CHECK:     Name: a
330//CHECK:     Section: my_bss.1 (0xE)
331//CHECK:   }
332//CHECK:   Symbol {
333//CHECK:     Name: b
334//CHECK:     Section: my_data.1 (0xF)
335//CHECK:   }
336//CHECK:   Symbol {
337//CHECK:     Name: c
338//CHECK:     Section: my_bss.1 (0xE)
339//CHECK:   }
340//CHECK:   Symbol {
341//CHECK:     Name: d
342//CHECK:     Section: my_bss.1 (0xE)
343//CHECK:   }
344//CHECK:   Symbol {
345//CHECK:     Name: e
346//CHECK:     Section: my_data.1 (0xF)
347//CHECK:   }
348//CHECK:   Symbol {
349//CHECK:     Name: f
350//CHECK:     Section: my_rodata.1 (0x10)
351//CHECK:   }
352//CHECK:   Symbol {
353//CHECK:     Name: foo
354//CHECK:     Section: my_text.1 (0x4)
355//CHECK:   }
356//CHECK:   Symbol {
357//CHECK:     Name: goo
358//CHECK:     Section: my_text.2 (0x8)
359//CHECK:   }
360//CHECK:   Symbol {
361//CHECK:     Name: h
362//CHECK:     Section: .bss (0x11)
363//CHECK:   }
364//CHECK:   Symbol {
365//CHECK:     Name: hoo
366//CHECK:     Section: .text (0x2)
367//CHECK:   }
368//CHECK:   Symbol {
369//CHECK:     Name: i
370//CHECK:     Section: my_bss.2 (0x12)
371//CHECK:   }
372//CHECK:   Symbol {
373//CHECK:     Name: j
374//CHECK:     Section: my_rodata.1 (0x10)
375//CHECK:   }
376//CHECK:   Symbol {
377//CHECK:     Name: k
378//CHECK:     Section: my_bss.2 (0x12)
379//CHECK:   }
380//CHECK:   Symbol {
381//CHECK:     Name: l
382//CHECK:     Section: my_data.2 (0x13)
383//CHECK:   }
384//CHECK:   Symbol {
385//CHECK:     Name: m
386//CHECK:     Section: my_rodata.2 (0x14)
387//CHECK:   }
388//CHECK:   Symbol {
389//CHECK:     Name: n
390//CHECK:     Section: .bss (0x11)
391//CHECK:   }
392//CHECK:   Symbol {
393//CHECK:     Name: o
394//CHECK:     Section: .data (0x15)
395//CHECK:   }
396//CHECK:   Symbol {
397//CHECK:     Name: p
398//CHECK:     Section: .rodata (0x16)
399//CHECK:   }
400