]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/testsuite/ld-i386/tls.exp
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-i386 / tls.exp
CommitLineData
6eaa7fb5 1# Expect script for i386 TLS tests.
a2c58332 2# Copyright (C) 2016-2022 Free Software Foundation, Inc.
6eaa7fb5
L
3#
4# This file is part of the GNU Binutils.
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19# MA 02110-1301, USA.
20#
21
22# The following tests require running the executable generated by ld,
23# or enough of a build environment to create a fully linked executable.
24# This is not commonly available when testing a cross-built linker.
25if ![isnative] {
26 return
27}
28
29# Only on Linux for now.
30if ![istarget "i?86-*-linux*"] {
31 return
32}
33
34# Check to see if the C compiler works
44ed8092 35if { ![check_compiler_available] } {
6eaa7fb5
L
36 return
37}
38
39run_cc_link_tests [list \
40 [list \
41 "Build tls-def1.o tls-main1.o" \
42 "" \
6c0d3bde 43 "-fPIE -Wa,-mx86-used-note=yes" \
6eaa7fb5
L
44 {tls-def1.c tls-main1.c} \
45 ] \
46 [list \
47 "Build tls-gd1.o tls-ld1.o" \
48 "" \
6c0d3bde 49 "-fPIC -Wa,-mrelax-relocations=yes,-mx86-used-note=yes" \
6eaa7fb5
L
50 {tls-gd1.S tls-ld1.S} \
51 ] \
52 [list \
53 "Build libtls-1a.so" \
54 "-shared tmpdir/tls-def1.o" \
6c0d3bde 55 "-Wa,-mx86-used-note=yes" \
6eaa7fb5
L
56 {dummy.s} \
57 {} \
58 "libtls-1a.so" \
59 ] \
60 [list \
61 "Build libtls-1b.so" \
62 "-shared tmpdir/tls-gd1.o tmpdir/tls-ld1.o" \
6c0d3bde 63 "-Wa,-mx86-used-note=yes" \
6eaa7fb5
L
64 {dummy.s} \
65 {} \
66 "libtls-1b.so" \
67 ] \
d6f48aed
L
68 [list \
69 "Build libtls-1bn.so" \
70 "-Wl,-z,now -shared tmpdir/tls-gd1.o tmpdir/tls-ld1.o" \
6c0d3bde 71 "-Wa,-mx86-used-note=yes" \
d6f48aed
L
72 {dummy.s} \
73 {} \
74 "libtls-1bn.so" \
75 ] \
6eaa7fb5
L
76]
77
982c6f26 78run_ld_link_exec_tests [list \
6eaa7fb5
L
79 [list \
80 "TLS GD/LD -> LE transition without PLT (dynamic)" \
81 "tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \
82 tmpdir/tls-ld1.o" \
6c0d3bde 83 "-Wa,-mx86-used-note=yes" \
6eaa7fb5
L
84 { dummy.s } \
85 "tls-1a" \
86 "pass.out" \
87 ] \
d6f48aed
L
88 [list \
89 "TLS GD/LD -> LE transition without PLT (dynamic, -z now)" \
90 "-Wl,-z,now tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \
91 tmpdir/tls-ld1.o" \
6c0d3bde 92 "-Wa,-mx86-used-note=yes" \
d6f48aed
L
93 { dummy.s } \
94 "tls-1an" \
95 "pass.out" \
96 ] \
6eaa7fb5
L
97 [list \
98 "TLS GD/LD -> LE transition without PLT (PIE)" \
99 "-pie tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \
100 tmpdir/tls-ld1.o" \
6c0d3bde 101 "-Wa,-mx86-used-note=yes" \
6eaa7fb5
L
102 { dummy.s } \
103 "tls-1b" \
104 "pass.out" \
105 ] \
d6f48aed
L
106 [list \
107 "TLS GD/LD -> LE transition without PLT (PIE, -z now)" \
108 "-pie -Wl,-z,now tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \
109 tmpdir/tls-ld1.o" \
6c0d3bde 110 "-Wa,-mx86-used-note=yes" \
d6f48aed
L
111 { dummy.s } \
112 "tls-1bn" \
113 "pass.out" \
114 ] \
6eaa7fb5
L
115 [list \
116 "TLS GD/LD -> LE transition without PLT (static)" \
117 "-static tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \
118 tmpdir/tls-ld1.o" \
6c0d3bde 119 "-Wa,-mx86-used-note=yes" \
6eaa7fb5
L
120 { dummy.s } \
121 "tls-1c" \
122 "pass.out" \
123 ] \
124 [list \
125 "TLS GD/LD -> IE transition without PLT" \
126 "tmpdir/tls-main1.o tmpdir/tls-gd1.o tmpdir/tls-ld1.o \
e9237227 127 tmpdir/libtls-1a.so -Wl,-R,tmpdir" \
6c0d3bde 128 "-Wa,-mx86-used-note=yes" \
6eaa7fb5
L
129 { dummy.s } \
130 "tls-1d" \
131 "pass.out" \
132 ] \
d6f48aed
L
133 [list \
134 "TLS GD/LD -> IE transition without PLT (-z now)" \
135 "-Wl,-z,now tmpdir/tls-main1.o tmpdir/tls-gd1.o tmpdir/tls-ld1.o \
136 tmpdir/libtls-1a.so -Wl,-R,tmpdir" \
6c0d3bde 137 "-Wa,-mx86-used-note=yes" \
d6f48aed
L
138 { dummy.s } \
139 "tls-1dn" \
140 "pass.out" \
141 ] \
6eaa7fb5
L
142 [list \
143 "TLS without PLT (1)" \
3d850592 144 "-Wl,--no-as-needed tmpdir/tls-main1.o \
e9237227 145 tmpdir/libtls-1a.so tmpdir/libtls-1b.so -Wl,-R,tmpdir" \
6c0d3bde 146 "-Wa,-mx86-used-note=yes" \
6eaa7fb5
L
147 { dummy.s } \
148 "tls-1e" \
149 "pass.out" \
150 ] \
151 [list \
152 "TLS without PLT (2)" \
153 "tmpdir/tls-main1.o tmpdir/tls-def1.o \
e9237227 154 tmpdir/libtls-1b.so -Wl,-R,tmpdir" \
6c0d3bde 155 "-Wa,-mx86-used-note=yes" \
6eaa7fb5
L
156 { dummy.s } \
157 "tls-1f" \
158 "pass.out" \
159 ] \
d6f48aed
L
160 [list \
161 "TLS without PLT (3)" \
3d850592 162 "-Wl,--no-as-needed -Wl,-z,now tmpdir/tls-main1.o \
d6f48aed 163 tmpdir/libtls-1a.so tmpdir/libtls-1bn.so -Wl,-R,tmpdir" \
6c0d3bde 164 "-Wa,-mx86-used-note=yes" \
d6f48aed
L
165 { dummy.s } \
166 "tls-1en" \
167 "pass.out" \
168 ] \
169 [list \
170 "TLS without PLT (4)" \
171 "-Wl,-z,now tmpdir/tls-main1.o tmpdir/tls-def1.o \
172 tmpdir/libtls-1bn.so -Wl,-R,tmpdir" \
6c0d3bde 173 "-Wa,-mx86-used-note=yes" \
d6f48aed
L
174 { dummy.s } \
175 "tls-1fn" \
176 "pass.out" \
177 ] \
6eaa7fb5 178]
1670f9c1 179
0aae7e72
L
180# Run-time tests which require working GNU2 TLS support.
181if { ![check_gnu2_tls_available] } {
182 return
183}
184
1670f9c1
L
185run_cc_link_tests [list \
186 [list \
187 "Build libtlsdesc1.so" \
188 "-shared" \
6c0d3bde 189 "-fPIC $GNU2_CFLAGS -Wa,-mx86-used-note=yes" \
1670f9c1
L
190 { tlsdesc1b.c } \
191 {} \
192 "libtlsdesc1.so" \
193 ] \
194 [list \
195 "Build libtlsdesc1n.so" \
196 "-Wl,-z,now -shared" \
6c0d3bde 197 "-fPIC $GNU2_CFLAGS -Wa,-mx86-used-note=yes" \
1670f9c1
L
198 { tlsdesc1b.c } \
199 {} \
200 "libtlsdesc1n.so" \
201 ] \
202]
203
204run_ld_link_exec_tests [list \
205 [list \
206 "Run tlsdesc1" \
207 "-Wl,--no-as-needed tmpdir/libtlsdesc1.so" \
6c0d3bde 208 "-Wa,-mx86-used-note=yes" \
1670f9c1
L
209 { tlsdesc1a.c } \
210 "tlsdesc1a" \
211 "pass.out" \
212 "$GNU2_CFLAGS" \
213 ] \
214 [list \
215 "Run tlsdesc1 (-z now)" \
216 "-Wl,-z,now -Wl,--no-as-needed tmpdir/libtlsdesc1n.so" \
6c0d3bde 217 "-Wa,-mx86-used-note=yes" \
1670f9c1
L
218 { tlsdesc1a.c } \
219 "tlsdesc1b" \
220 "pass.out" \
221 "$GNU2_CFLAGS" \
222 ] \
223 [list \
224 "Run tlsdesc1 with PIE" \
225 "-pie -Wl,--no-as-needed tmpdir/libtlsdesc1.so" \
6c0d3bde 226 "-Wa,-mx86-used-note=yes" \
1670f9c1
L
227 { tlsdesc1a.c } \
228 "tlsdesc1c" \
229 "pass.out" \
230 "-fPIE $GNU2_CFLAGS" \
231 ] \
232 [list \
233 "Run tlsdesc1 with PIE (-z now)" \
234 "-pie -Wl,-z,now -Wl,--no-as-needed tmpdir/libtlsdesc1n.so" \
6c0d3bde 235 "-Wa,-mx86-used-note=yes" \
1670f9c1
L
236 { tlsdesc1a.c } \
237 "tlsdesc1d" \
238 "pass.out" \
239 "-fPIE $GNU2_CFLAGS" \
240 ] \
241]