1// RUN: llvm-mc -filetype=obj -triple mipsel-unknown-linux %s -o - | llvm-readobj -r | FileCheck %s
2
3// Check that the appropriate relocations were created.
4
5// CHECK: Relocations [
6// CHECK:   Section (2) .rel.text {
7// CHECK:     R_MIPS_TLS_LDM
8// CHECK:     R_MIPS_TLS_DTPREL_HI16
9// CHECK:     R_MIPS_TLS_DTPREL_LO16
10// CHECK:   }
11// CHECK: ]
12
13	.text
14	.abicalls
15	.section	.mdebug.abi32,"",@progbits
16	.file	"/home/espindola/llvm/llvm/test/MC/Mips/elf-tls.ll"
17	.text
18	.globl	f1
19	.align	2
20	.type	f1,@function
21	.set	nomips16
22	.ent	f1
23f1:                                     # @f1
24	.frame	$sp,24,$ra
25	.mask 	0x80000000,-4
26	.fmask	0x00000000,0
27	.set	noreorder
28	.set	nomacro
29	.set	noat
30# BB#0:                                 # %entry
31	lui	$2, %hi(_gp_disp)
32	addiu	$2, $2, %lo(_gp_disp)
33	addiu	$sp, $sp, -24
34	sw	$ra, 20($sp)            # 4-byte Folded Spill
35	addu	$gp, $2, $25
36	lw	$25, %call16(__tls_get_addr)($gp)
37	jalr	$25
38	addiu	$4, $gp, %tlsgd(t1)
39	lw	$2, 0($2)
40	lw	$ra, 20($sp)            # 4-byte Folded Reload
41	jr	$ra
42	addiu	$sp, $sp, 24
43	.set	at
44	.set	macro
45	.set	reorder
46	.end	f1
47$tmp0:
48	.size	f1, ($tmp0)-f1
49
50	.globl	f2
51	.align	2
52	.type	f2,@function
53	.set	nomips16
54	.ent	f2
55f2:                                     # @f2
56	.frame	$sp,24,$ra
57	.mask 	0x80000000,-4
58	.fmask	0x00000000,0
59	.set	noreorder
60	.set	nomacro
61	.set	noat
62# BB#0:                                 # %entry
63	lui	$2, %hi(_gp_disp)
64	addiu	$2, $2, %lo(_gp_disp)
65	addiu	$sp, $sp, -24
66	sw	$ra, 20($sp)            # 4-byte Folded Spill
67	addu	$gp, $2, $25
68	lw	$25, %call16(__tls_get_addr)($gp)
69	jalr	$25
70	addiu	$4, $gp, %tlsgd(t2)
71	lw	$2, 0($2)
72	lw	$ra, 20($sp)            # 4-byte Folded Reload
73	jr	$ra
74	addiu	$sp, $sp, 24
75	.set	at
76	.set	macro
77	.set	reorder
78	.end	f2
79$tmp1:
80	.size	f2, ($tmp1)-f2
81
82	.globl	f3
83	.align	2
84	.type	f3,@function
85	.set	nomips16
86	.ent	f3
87f3:                                     # @f3
88	.frame	$sp,24,$ra
89	.mask 	0x80000000,-4
90	.fmask	0x00000000,0
91	.set	noreorder
92	.set	nomacro
93	.set	noat
94# BB#0:                                 # %entry
95	lui	$2, %hi(_gp_disp)
96	addiu	$2, $2, %lo(_gp_disp)
97	addiu	$sp, $sp, -24
98	sw	$ra, 20($sp)            # 4-byte Folded Spill
99	addu	$gp, $2, $25
100	lw	$25, %call16(__tls_get_addr)($gp)
101	jalr	$25
102	addiu	$4, $gp, %tlsldm(f3.i)
103	lui	$1, %dtprel_hi(f3.i)
104	addu	$1, $1, $2
105	lw	$2, %dtprel_lo(f3.i)($1)
106	addiu	$2, $2, 1
107	sw	$2, %dtprel_lo(f3.i)($1)
108	lw	$ra, 20($sp)            # 4-byte Folded Reload
109	jr	$ra
110	addiu	$sp, $sp, 24
111	.set	at
112	.set	macro
113	.set	reorder
114	.end	f3
115$tmp2:
116	.size	f3, ($tmp2)-f3
117
118	.type	t1,@object              # @t1
119	.section	.tbss,"awT",@nobits
120	.globl	t1
121	.align	2
122t1:
123	.4byte	0                       # 0x0
124	.size	t1, 4
125
126	.type	f3.i,@object            # @f3.i
127	.section	.tdata,"awT",@progbits
128	.align	2
129f3.i:
130	.4byte	1                       # 0x1
131	.size	f3.i, 4
132
133
134	.text
135