aboutsummaryrefslogtreecommitdiff
path: root/test/ELF/ppc64-tls-ie-le.s
blob: c9893107a1917717e3056efe1403f27339abad84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// REQUIRES: ppc

// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-tls-ie-le.s -o %t2.o
// RUN: ld.lld -dynamic-linker /lib64/ld64.so.2 %t.o %t2.o -o %t
// RUN: llvm-readelf -r %t.o | FileCheck --check-prefix=InputRelocs %s
// RUN: llvm-readelf -r %t | FileCheck --check-prefix=OutputRelocs %s
// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=Dis %s

// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-tls-ie-le.s -o %t2.o
// RUN: ld.lld -dynamic-linker /lib64/ld64.so.2 %t.o %t2.o -o %t
// RUN: llvm-readelf -r %t.o | FileCheck --check-prefix=InputRelocs %s
// RUN: llvm-readelf -r %t | FileCheck --check-prefix=OutputRelocs %s
// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=Dis %s

	.text
	.abiversion 2
test1:                                  # @test1
	addis 3, 2, c@got@tprel@ha
	ld 3, c@got@tprel@l(3)
	lbzx 3, 3, c@tls
	blr
test2:                                  # @test2
	addis 3, 2, s@got@tprel@ha
	ld 3, s@got@tprel@l(3)
	lhzx 3, 3, s@tls
	blr
test3:                                  # @test3
	addis 3, 2, i@got@tprel@ha
	ld 3, i@got@tprel@l(3)
	lwzx 3, 3, i@tls
	blr
test4:                                  # @test4
	addis 3, 2, l@got@tprel@ha
	ld 3, l@got@tprel@l(3)
	ldx 3, 3, l@tls
	blr
test5:                                  # @test5
	addis 4, 2, c@got@tprel@ha
	ld 4, c@got@tprel@l(4)
	stbx 3, 4, c@tls
	blr
test6:                                  # @test6
	addis 4, 2, s@got@tprel@ha
	ld 4, s@got@tprel@l(4)
	sthx 3, 4, s@tls
	blr
test7:                                  # @test7
	addis 4, 2, i@got@tprel@ha
	ld 4, i@got@tprel@l(4)
	stwx 3, 4, i@tls
	blr
test8:                                  # @test8
	addis 4, 2, l@got@tprel@ha
	ld 4, l@got@tprel@l(4)
	stdx 3, 4, l@tls
	blr
test9:                                  # @test9
	addis 3, 2, i@got@tprel@ha
	ld 3, i@got@tprel@l(3)
	add 3, 3, i@tls
	blr
test_ds:                                  # @test_ds
	ld 4, l@got@tprel(2)
	stdx 3, 4, l@tls
	blr


// Verify that the input has initial-exec tls relocation types.
// InputRelocs: Relocation section '.rela.text'
// InputRelocs: R_PPC64_GOT_TPREL16_HA {{0+}} c + 0
// InputRelocs: R_PPC64_GOT_TPREL16_LO_DS {{0+}} c + 0
// InputRelocs: R_PPC64_TLS {{0+}} c + 0
// InputRelocs: R_PPC64_GOT_TPREL16_HA {{0+}} s + 0
// InputRelocs: R_PPC64_GOT_TPREL16_LO_DS {{0+}} s + 0
// InputRelocs: R_PPC64_TLS {{0+}} s + 0
// InputRelocs: R_PPC64_GOT_TPREL16_HA {{0+}} i + 0
// InputRelocs: R_PPC64_GOT_TPREL16_LO_DS {{0+}} i + 0
// InputRelocs: R_PPC64_TLS {{0+}} i + 0
// InputRelocs: R_PPC64_GOT_TPREL16_HA {{0+}} l + 0
// InputRelocs: R_PPC64_GOT_TPREL16_LO_DS {{0+}} l + 0
// InputRelocs: R_PPC64_TLS {{0+}} l + 0
// InputRelocs: R_PPC64_GOT_TPREL16_DS {{0+}} l + 0
// InputRelocs: R_PPC64_TLS {{0+}} l + 0

// Verify that no initial-exec relocations exist for the dynamic linker.
// OutputRelocs-NOT: R_PPC64_TPREL64  {{0+}}  c + 0
// OutputRelocs-NPT: R_PPC64_TPREL64  {{0+}}  s + 0
// OutputRelocs-NOT: R_PPC64_TPREL64  {{0+}}  i + 0
// OutputRelocs-NOT: R_PPC64_TPREL64  {{0+}}  l + 0

// Dis: test1:
// Dis: nop
// Dis: addis 3, 13, 0
// Dis: lbz 3, -28672(3)

// Dis: test2:
// Dis: nop
// Dis: addis 3, 13, 0
// Dis: lhz 3, -28670(3)

// Dis: test3:
// Dis: nop
// Dis: addis 3, 13, 0
// Dis: lwz 3, -28668(3)

// Dis: test4:
// Dis: nop
// Dis: addis 3, 13, 0
// Dis: ld 3, -28664(3)

// Dis: test5:
// Dis: nop
// Dis: addis 4, 13, 0
// Dis: stb 3, -28672(4)

// Dis: test6:
// Dis: nop
// Dis: addis 4, 13, 0
// Dis: sth 3, -28670(4)

// Dis: test7:
// Dis: nop
// Dis: addis 4, 13, 0
// Dis: stw 3, -28668(4)

// Dis: test8:
// Dis: nop
// Dis: addis 4, 13, 0
// Dis: std 3, -28664(4)

// Dis: test9:
// Dis: nop
// Dis: addis 3, 13, 0
// Dis: addi 3, 3, -28668

// Dis: test_ds:
// Dis: addis 4, 13, 0
// Dis: std 3, -28664(4)