269f70d05b298a71133c558ce8f41409da9a5462
[deliverable/binutils-gdb.git] / ld / testsuite / ld-x86-64 / x86-64.exp
1 # Expect script for ld-x86_64 tests
2 # Copyright (C) 2002-2021 Free Software Foundation, Inc.
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 # Test x86_64 linking; all types of relocs. This tests the assembler and
23 # tools like objdump as well as the linker.
24
25 if { !([istarget "x86_64-*-elf*"] || [istarget "x86_64-*-linux*"]) } {
26 return
27 }
28
29 set emul "elf_x86_64"
30 set saved_ASFLAGS "$ASFLAGS"
31 set ASFLAGS "$ASFLAGS -mx86-used-note=no"
32
33 # List contains test-items with 3 items followed by 2 lists:
34 # 0:name 1:ld early options 2:ld late options 3:assembler options
35 # 4:filenames of assembler files 5: action and options. 6: name of output file
36
37 # Actions:
38 # objdump: Apply objdump options on result. Compare with regex (last arg).
39 # nm: Apply nm options on result. Compare with regex (last arg).
40 # readelf: Apply readelf options on result. Compare with regex (last arg).
41
42 set x86_64tests {
43 {"Helper shared library (basic PLT test)"
44 "-shared -melf_x86_64" "" "--64" {pltlib.s} {} "libpltlib.so"}
45 {"basic PLT generation"
46 "-melf_x86_64 tmpdir/libpltlib.so" "" "--64" {plt.s}
47 {{objdump -drj.plt plt.pd}} "plt"}
48 {"TLS -fpic -shared transitions"
49 "-shared -melf_x86_64 --no-ld-generated-unwind-info \
50 -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
51 "--64" {tlspic1.s tlspic2.s}
52 {{readelf -WSsrl tlspic.rd} {objdump -drj.text\ -Mintel64 tlspic.dd}
53 {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
54 "libtlspic.so"}
55 {"TLS -fpic -shared transitions with r15 as GOT base"
56 "-shared -melf_x86_64 --no-ld-generated-unwind-info \
57 -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
58 "--64 -mrelax-relocations=yes"
59 {tlspic3.s tlspic2.s}
60 {{readelf -WSsrl tlspic2.rd} {objdump -drj.text\ -Mintel64 tlspic2.dd}
61 {objdump -sj.got tlspic2.sd} {objdump -sj.tdata tlspic2.td}}
62 "libtlspic2.so"}
63 {"TLS descriptor -fpic -shared transitions"
64 "-shared -melf_x86_64 --no-ld-generated-unwind-info \
65 -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
66 "--64" {tlsdesc.s tlspic2.s}
67 {{readelf -WSsrld tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
68 {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}
69 {objdump -drj.plt tlsdesc.pd}} "libtlsdesc.so"}
70 {"Helper shared library" "-shared -melf_x86_64" ""
71 "--64" {tlslib.s} {} "libtlslib.so"}
72 {"TLS -fpic and -fno-pic exec transitions"
73 "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info \
74 -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
75 "--64" {tlsbinpic.s tlsbin.s}
76 {{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd}
77 {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}}
78 "tlsbin"}
79 {"TLS -fpic and -fno-pic exec transitions without PLT"
80 "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info \
81 -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
82 "-mrelax-relocations=yes --64" {tlsbinpic2.s tlsbin.s}
83 {{readelf -WSsrl tlsbin2.rd} {objdump -drj.text tlsbin2.dd}
84 {objdump -sj.got tlsbin2.sd} {objdump -sj.tdata tlsbin2.td}}
85 "tlsbin2"}
86 {"TLS descriptor -fpic and -fno-pic exec transitions"
87 "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info \
88 -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
89 "--64" {tlsbindesc.s tlsbin.s}
90 {{readelf -WSsrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
91 {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
92 "tlsbindesc"}
93 {"TLS with global dynamic and descriptors"
94 "-shared -melf_x86_64 --no-ld-generated-unwind-info \
95 -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
96 "--64" {tlsgdesc.s}
97 {{readelf -WSsrl tlsgdesc.rd} {objdump -drj.text\ -Mintel64 tlsgdesc.dd}}
98 "libtlsgdesc.so"}
99 {"TLS in debug sections" "-melf_x86_64" ""
100 "--64" {tlsg.s}
101 {{objdump -sj.debug_foobar tlsg.sd}} "tlsg"}
102 {"TLS GD->LE transition" "-melf_x86_64" ""
103 "--64" {tlsgd1.s}
104 {{objdump -dwr tlsgd1.dd}} "tlsgd1"}
105 {"TLS LD->LE transition" "-melf_x86_64" ""
106 "--64" {tlsld1.s}
107 {{objdump -dwr tlsld1.dd}} "tlsld1"}
108 {"TLS IE->LE transition" "-melf_x86_64" ""
109 "--64" {tlsie1.s}
110 {{objdump -dwr tlsie1.dd}} "tlsie1"}
111 {"Helper 64bit object 1" "-r -melf_x86_64" ""
112 "--64" {mixed1a.s} {} "libmixe1a.o"}
113 {"Helper 32bit object 1" "-r -melf_i386" ""
114 "--32" {mixed1b.s} {} "libmixe1b.o"}
115 {"Helper 64bit object 2" "-r -melf_x86_64" ""
116 "--64" {mixed2a.s} {} "libmixe2a.o"}
117 {"Helper 32bit object 2" "-r -melf_i386" ""
118 "--32" {mixed2b.s} {} "libmixe2b.o"}
119 {"Split by file with 'l' flag on section."
120 "-split-by-file -r -melf_x86_64" ""
121 "--64" {split-by-file1.s split-by-file2.s}
122 {{readelf -SW split-by-file.rd}} "split-by-file.o"}
123 {"TLS X32 IE->LE transition" "-melf32_x86_64" ""
124 "--x32" {tlsie4.s}
125 {{objdump -dwr tlsie4.dd}} "tlsie4"}
126 {"TLS X32 GD->LE transition" "-melf32_x86_64" ""
127 "--x32" {tlsgd4.s}
128 {{objdump -dwr tlsgd4.dd}} "tlsgd4"}
129 {"Helper TLS GD->IE transition DSO" "-shared -melf_x86_64" ""
130 "--64" {tlsgd5b.s} {} "libtlsgd5.so"}
131 {"TLS GD->IE transition" "-melf_x86_64 tmpdir/libtlsgd5.so" ""
132 "--64" {tlsgd5a.s}
133 {{objdump -dwr tlsgd5.dd}} "tlsgd5a"}
134 {"TLS GD->IE transition without PLT"
135 "-melf_x86_64 tmpdir/libtlsgd5.so" ""
136 "-mrelax-relocations=yes --64" {tlsgd5c.s}
137 {{objdump -dwr tlsgd5.dd}} "tlsgd5b"}
138 {"Helper TLS X32 GD->IE transition DSO" "-shared -melf32_x86_64" ""
139 "--x32" {tlsgd6b.s} {} "libtlsgd6.so"}
140 {"TLS X32 GD->IE transition" "-melf32_x86_64 tmpdir/libtlsgd6.so" ""
141 "--x32" {tlsgd6a.s}
142 {{objdump -dwr tlsgd6.dd}} "tlsgd6a"}
143 {"TLS X32 GD->IE transition without PLT"
144 "-melf32_x86_64 tmpdir/libtlsgd6.so" ""
145 "-mrelax-relocations=yes --x32" {tlsgd6c.s}
146 {{objdump -dwr tlsgd6.dd}} "tlsgd6b"}
147 {"TLS X32 LD->LE transition" "-melf32_x86_64" ""
148 "--x32" {tlsld2.s}
149 {{objdump -dwr tlsld2.dd}} "tlsld2"}
150 {"TLS -mcmodel=large GD->LE transition" "-melf_x86_64" ""
151 "--64" {tlsgd7.s}
152 {{objdump -dwr tlsgd7.dd}} "tlsgd7"}
153 {"TLS -mcmodel=large LD->LE transition" "-melf_x86_64" ""
154 "--64" {tlsld3.s}
155 {{objdump -dwr tlsld3.dd}} "tlsld3"}
156 {"TLS -mcmodel=large LD->LE transition with r15 as GOT base"
157 "-melf_x86_64" ""
158 "--64" {tlsld4.s}
159 {{objdump -dwr tlsld4.dd}} "tlsld4"}
160 {"TLS LD->LE transition without PLT"
161 "-melf_x86_64" ""
162 "--64 -mrelax-relocations=yes"
163 {tlsld5.s}
164 {{objdump -dwr tlsld5.dd}} "tlsld5"}
165 {"TLS X32 LD->LE transition without PLT" "-melf32_x86_64" ""
166 "--x32 -mrelax-relocations=yes"
167 {tlsld6.s}
168 {{objdump -dwr tlsld6.dd}} "tlsld6"}
169 {"TLS -mcmodel=large GD->IE transition" "-melf_x86_64 tmpdir/libtlsgd5.so" ""
170 "--64" {tlsgd8.s}
171 {{objdump -dwrj.text tlsgd8.dd}} "tlsgd8"}
172 {"TLS -mcmodel=large GD->LE transition with r15 as GOT base"
173 "-melf_x86_64" ""
174 "--64" {tlsgd9.s}
175 {{objdump -dwr tlsgd9.dd}} "tlsgd9"}
176 {"TLS -mcmodel=large GD->IE transition with r15 as GOT base"
177 "-melf_x86_64 tmpdir/libtlsgd5.so" ""
178 "--64" {tlsgd10.s}
179 {{objdump -dwrj.text tlsgd10.dd}} "tlsgd10"}
180 {"TLS GD->LE transition without PLT"
181 "-melf_x86_64" ""
182 "--64" {tlsgd11.s}
183 {{objdump -dwr tlsgd11.dd}} "tlsgd11"}
184 {"TLS X32 GD->LE transition without PLT"
185 "-melf32_x86_64" ""
186 "--x32" {tlsgd14.s}
187 {{objdump -dwr tlsgd14.dd}} "tlsgd14"}
188 {"build 32-bit object with 33 locals" "-melf_x86_64 -e 0" "" "--32" {32bit.s} {{ ld incompatible.l }} "dummy" }
189 {"build 64-bit object" "-melf_x86_64 -e 0 --defsym foo=1" "" "--64" {64bit.s} {} "dummy" }
190 {"link mixed objects" "-melf_x86_64 -e 0 tmpdir/32bit.o tmpdir/64bit.o" "" "" {} { { ld incompatible.l } } "mixed"}
191 {"PR ld/17313 (1)" "-melf_x86_64" ""
192 "--64" {dummy.s} {} ""}
193 {"PR ld/17313 (2)" "-melf_x86_64 -shared --just-symbols=tmpdir/dummy.o" ""
194 "--64" {lea1.s} {} "libpr17313.so"}
195 {"PR ld/17306 (1)" "-melf_x86_64" ""
196 "--64" {pr17306b.s} {} ""}
197 {"PR ld/17306 (2)" "-melf_x86_64 -shared -Bsymbolic --just-symbols=tmpdir/pr17306b.o" ""
198 "--64" {pr17306a.s} {} "libpr17306.so"}
199 {"PR ld/17709 (1)" "-melf_x86_64 -shared" ""
200 "--64" {pr17709a.s} {} "libpr17709.so"}
201 {"PR ld/17709 (2)" "-melf_x86_64 tmpdir/libpr17709.so" ""
202 "--64" {pr17709b.s} {{readelf -rW pr17709.rd}} "pr17709"}
203 {"Build pr19827a.o" "" ""
204 "--64" { pr19827a.S }}
205 {"Build pr19827b.so" "-melf_x86_64 -shared" ""
206 "--64" { pr19827b.S } {} "pr19827b.so"}
207 {"Build pr19827"
208 "-melf_x86_64 -pie -z notext tmpdir/pr19827a.o tmpdir/pr19827b.so"
209 ""
210 "--64" { dummy.s } {{readelf {-rW} pr19827.rd}} "pr19827"}
211 {"Build pr19827.so"
212 "-melf_x86_64 -shared -Bsymbolic -z notext" ""
213 "--64" { pr19827a.S } {{readelf {-rW} pr19827.rd}} "pr19827.so"}
214 {"Build pr19969.so" "-melf_x86_64 -shared" ""
215 "--64" { pr19969a.S } {} "pr19969.so"}
216 {"Build pr20550a.o" "" ""
217 "--64" { pr20550a.s }}
218 {"Build pr20550b.so" "-melf_x86_64 -shared" ""
219 "--64" { pr20550b.s } {} "pr20550b.so"}
220 {"Build pr20550"
221 "-melf_x86_64 -pie -z notext tmpdir/pr20550a.o tmpdir/pr20550b.so"
222 ""
223 "--64" { dummy.s } {} "pr20550"}
224 {"Build pr27587"
225 "-melf_x86_64 -e main"
226 "" ""
227 { pr27587a.obj.bz2 pr27587b.obj.bz2 }
228 {{ld "pr27587.err"}} "pr27587"}
229 {"Build pr27590.o"
230 "-r -melf_x86_64"
231 "" ""
232 { pr27590a.obj.bz2 pr27590b.obj.bz2 }
233 {{readelf -SW pr27590.rd}} "pr27590.o"}
234 }
235
236 run_ld_link_tests $x86_64tests
237
238 set test_name "Mixed x86_64 and i386 input test 1"
239 set test mixed1
240 if { ![ld_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] } {
241 if [string match "*i386* architecture of input file `tmpdir/${test}b.o' is incompatible with i386:x86-64* output*" $link_output] {
242 pass "$test_name"
243 } {
244 fail "$test_name"
245 }
246 }
247
248 set test_name "Mixed x86_64 and i386 input test 2"
249 set test mixed2
250 if { ![ld_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] } {
251 if [string match "*i386* architecture of input file `tmpdir/${test}b.o' is incompatible with i386:x86-64* output*" $link_output] {
252 pass "$test_name"
253 } {
254 fail "$test_name"
255 }
256 }
257
258 run_dump_test "abs"
259 run_dump_test "abs-k1om"
260 run_dump_test "abs-l1om"
261 run_dump_test "apic"
262 run_dump_test "pcrel8"
263 run_dump_test "pcrel16"
264 run_dump_test "pcrel16-2"
265 run_dump_test "tlsgd2"
266 run_dump_test "tlsgd3"
267 run_dump_test "tlsgd12"
268 run_dump_test "tlsgd13"
269 run_dump_test "tlsie2"
270 run_dump_test "tlsie3"
271 run_dump_test "hidden1"
272 run_dump_test "hidden2"
273 run_dump_test "hidden3"
274 run_dump_test "hidden4"
275 run_dump_test "hidden5"
276 run_dump_test "protected1"
277 run_dump_test "protected2"
278 run_dump_test "protected2-k1om"
279 run_dump_test "protected2-l1om"
280 run_dump_test "protected3"
281 run_dump_test "protected3-k1om"
282 run_dump_test "protected3-l1om"
283 run_dump_test "protected4"
284 run_dump_test "protected5"
285 run_dump_test "protected6a"
286 run_dump_test "protected6b"
287 run_dump_test "protected7a"
288 run_dump_test "protected7b"
289 run_dump_test "protected8"
290 run_dump_test "tlsle1"
291 run_dump_test "tlspie1"
292 run_dump_test "tlspie2a"
293 run_dump_test "tlspie2b"
294 run_dump_test "tlspie2c"
295 run_dump_test "unique1"
296 run_dump_test "nogot1"
297 run_dump_test "nogot2"
298 run_dump_test "discarded1"
299 run_dump_test "pr12718"
300 run_dump_test "pr12921"
301 run_dump_test "pr13947"
302 run_dump_test "pr12570a"
303 run_dump_test "pr12570b"
304 run_dump_test "pr14215"
305 run_dump_test "pr14207"
306 run_dump_test "gotplt1"
307 run_dump_test "pie1"
308 run_dump_test "pie2"
309 run_dump_test "pie3"
310 run_dump_test "pic1"
311 run_dump_test "largecomm-1a"
312 run_dump_test "largecomm-1b"
313 run_dump_test "largecomm-1c"
314 run_dump_test "largecomm-1d"
315 run_dump_test "largecomm-1e"
316 run_dump_test "largecomm-1f"
317 run_dump_test "pr19539a"
318 run_dump_test "pr19539b"
319 run_dump_test "pr19807-1a"
320 run_dump_test "pr19807-1b"
321 run_dump_test "pr19807-2a"
322 run_dump_test "pr19807-2b"
323 run_dump_test "pr19807-2c"
324 run_dump_test "pr19807-2d"
325 run_dump_test "pr19807-2e"
326 run_dump_test "pr19969"
327 run_dump_test "pr20093-1"
328 run_dump_test "pr20093-2"
329 run_dump_test "property-x86-3"
330 run_dump_test "property-x86-4a"
331 run_dump_test "property-x86-4b"
332 run_dump_test "property-x86-3-x32"
333 run_dump_test "property-x86-4a-x32"
334 run_dump_test "property-x86-4b-x32"
335 run_dump_test "property-x86-5"
336 run_dump_test "property-x86-5-x32"
337 run_dump_test "property-x86-6"
338 run_dump_test "property-x86-6-x32"
339 run_dump_test "property-x86-ibt1a"
340 run_dump_test "property-x86-ibt1b"
341 run_dump_test "property-x86-ibt1a-x32"
342 run_dump_test "property-x86-ibt1b-x32"
343 run_dump_test "property-x86-ibt2"
344 run_dump_test "property-x86-ibt2-x32"
345 run_dump_test "property-x86-ibt3a"
346 run_dump_test "property-x86-ibt3b"
347 run_dump_test "property-x86-ibt3a-x32"
348 run_dump_test "property-x86-ibt3b-x32"
349 run_dump_test "property-x86-ibt4"
350 run_dump_test "property-x86-ibt4-x32"
351 run_dump_test "property-x86-ibt5"
352 run_dump_test "property-x86-ibt5-x32"
353 run_dump_test "property-x86-shstk1a"
354 run_dump_test "property-x86-shstk1b"
355 run_dump_test "property-x86-shstk1a-x32"
356 run_dump_test "property-x86-shstk1b-x32"
357 run_dump_test "property-x86-shstk2"
358 run_dump_test "property-x86-shstk2-x32"
359 run_dump_test "property-x86-shstk3a"
360 run_dump_test "property-x86-shstk3b"
361 run_dump_test "property-x86-shstk3a-x32"
362 run_dump_test "property-x86-shstk3b-x32"
363 run_dump_test "property-x86-shstk4"
364 run_dump_test "property-x86-shstk4-x32"
365 run_dump_test "property-x86-shstk5"
366 run_dump_test "property-x86-shstk5-x32"
367 run_dump_test "property-x86-cet1"
368 run_dump_test "property-x86-cet1-x32"
369 run_dump_test "property-x86-cet2a"
370 run_dump_test "property-x86-cet2a-x32"
371 run_dump_test "property-x86-cet2b"
372 run_dump_test "property-x86-cet2b-x32"
373 run_dump_test "property-x86-cet3a"
374 run_dump_test "property-x86-cet3a-x32"
375 run_dump_test "property-x86-cet3b"
376 run_dump_test "property-x86-cet3b-x32"
377 run_dump_test "property-x86-cet4a"
378 run_dump_test "property-x86-cet4a-x32"
379 run_dump_test "property-x86-cet4b"
380 run_dump_test "property-x86-cet4b-x32"
381 run_dump_test "property-x86-cet5a"
382 run_dump_test "property-x86-cet5a-x32"
383 run_dump_test "property-x86-cet5b"
384 run_dump_test "property-x86-cet5b-x32"
385 run_dump_test "property-x86-cet6"
386 run_dump_test "property-x86-cet6-x32"
387 run_dump_test "property-x86-lam-u48-1a"
388 run_dump_test "property-x86-lam-u48-1b"
389 run_dump_test "property-x86-lam-u48-2"
390 run_dump_test "property-x86-lam-u48-3a"
391 run_dump_test "property-x86-lam-u48-3b"
392 run_dump_test "property-x86-lam-u48-4"
393 run_dump_test "property-x86-lam-u48-5"
394 run_dump_test "property-x86-lam-u57-1a"
395 run_dump_test "property-x86-lam-u57-1b"
396 run_dump_test "property-x86-lam-u57-2"
397 run_dump_test "property-x86-lam-u57-3a"
398 run_dump_test "property-x86-lam-u57-3b"
399 run_dump_test "property-x86-lam-u57-4"
400 run_dump_test "property-x86-lam-u57-5"
401 run_dump_test "pr21884"
402 run_dump_test "pr22071"
403 run_dump_test "pr22115-1a"
404 run_dump_test "pr22115-1a-x32"
405 run_dump_test "pr22115-1b"
406 run_dump_test "pr22115-1b-x32"
407 run_dump_test "pr22115-1c"
408 run_dump_test "pr22115-1c-x32"
409 run_dump_test "pr22115-1d"
410 run_dump_test "pr22115-1d-x32"
411 run_dump_test "pr22135"
412 run_dump_test "pr22782a"
413 run_dump_test "pr22782b"
414 run_dump_test "pr23189"
415 run_dump_test "pr23194"
416 run_dump_test "pr23324a"
417 run_dump_test "pr23324b"
418 run_dump_test "pr23372a"
419 run_dump_test "pr23372a-x32"
420 run_dump_test "pr23372b"
421 run_dump_test "pr23372b-x32"
422 run_dump_test "pr23372c"
423 run_dump_test "pr23372c-x32"
424 run_dump_test "pr23372d"
425 run_dump_test "pr23372d-x32"
426 run_dump_test "pr23486a"
427 run_dump_test "pr23486a-x32"
428 run_dump_test "pr23486b"
429 run_dump_test "pr23486b-x32"
430 run_dump_test "pr23486c"
431 run_dump_test "pr23486c-x32"
432 run_dump_test "pr23486d"
433 run_dump_test "pr23486d-x32"
434 run_dump_test "pr23854"
435 run_dump_test "pr23930"
436 run_dump_test "pr23930-x32"
437 run_dump_test "pr24151a"
438 run_dump_test "pr24151a-x32"
439 run_dump_test "pr24322a"
440 run_dump_test "pr24322a-x32"
441 run_dump_test "pr24322b"
442 run_dump_test "pr24322b-x32"
443 run_dump_test "pr24458a"
444 run_dump_test "pr24458a-x32"
445 run_dump_test "pr24458b"
446 run_dump_test "pr24458b-x32"
447 run_dump_test "pr24458c"
448 run_dump_test "pr24458c-x32"
449 run_dump_test "pr24721"
450 run_dump_test "pr24721-x32"
451 run_dump_test "pr24905"
452 run_dump_test "pr24905-x32"
453 run_dump_test "align-branch-1"
454 run_dump_test "pr25416-1a"
455 run_dump_test "pr25416-2b"
456 run_dump_test "pr25416-2a"
457 run_dump_test "pr25416-2b"
458 run_dump_test "pr25416-3"
459 run_dump_test "pr25416-4"
460 run_dump_test "pr26018"
461 run_dump_test "pr26263"
462 run_dump_test "pr26711-1"
463 run_dump_test "pr26711-1-x32"
464 run_dump_test "pr26711-2"
465 run_dump_test "pr26711-2-x32"
466 run_dump_test "pr26711-3"
467 run_dump_test "pr26711-3-x32"
468 run_dump_test "property-x86-isa1"
469 run_dump_test "property-x86-isa1-x32"
470 run_dump_test "property-x86-isa2"
471 run_dump_test "property-x86-isa2-x32"
472 run_dump_test "property-x86-isa3"
473 run_dump_test "property-x86-isa3-x32"
474 run_dump_test "property-x86-isa4"
475 run_dump_test "property-x86-isa4-x32"
476
477 if ![istarget "x86_64-*-linux*"] {
478 return
479 }
480
481 if ![ld_assemble $as "--x32 $srcdir/$subdir/start.s" tmpdir/startx32.o] {
482 fail "Build ILP32 start.o"
483 return
484 }
485
486 if ![ld_assemble $as "--32 $srcdir/$subdir/start.s" tmpdir/start32.o] {
487 fail "Build ia32 start.o"
488 return
489 }
490
491 if ![ld_assemble $as "--64 $srcdir/$subdir/start.s" tmpdir/start64.o] {
492 fail "Build LP64 start.o"
493 return
494 }
495
496 if ![ld_assemble $as "--x32 $srcdir/$subdir/foo.s" tmpdir/foox32.o] {
497 fail "Build ILP32 foo.o"
498 return
499 }
500
501 if ![ld_assemble $as "--32 $srcdir/$subdir/foo.s" tmpdir/foo32.o] {
502 fail "Build ia32 foo.o"
503 return
504 }
505
506 if ![ld_assemble $as "--64 $srcdir/$subdir/foo.s" tmpdir/foo64.o] {
507 fail "Build LP64 foo.o"
508 return
509 }
510
511 run_dump_test "compressed1"
512 run_dump_test "ilp32-1"
513 run_dump_test "ilp32-2"
514 run_dump_test "ilp32-3"
515 run_dump_test "ilp32-4"
516 run_dump_test "ilp32-5"
517 run_dump_test "ilp32-6"
518 run_dump_test "ilp32-7"
519 run_dump_test "ilp32-8"
520 run_dump_test "ilp32-9"
521 run_dump_test "ilp32-10"
522 run_dump_test "ilp32-11"
523 run_dump_test "ia32-1"
524 run_dump_test "ia32-2"
525 run_dump_test "ia32-3"
526 run_dump_test "lp64-1"
527 run_dump_test "lp64-2"
528 run_dump_test "lp64-3"
529 run_dump_test "pr13082-1a"
530 run_dump_test "pr13082-1b"
531 run_dump_test "pr13082-2a"
532 run_dump_test "pr13082-2b"
533 run_dump_test "pr13082-3a"
534 run_dump_test "pr13082-3b"
535 run_dump_test "pr13082-3c"
536 run_dump_test "pr13082-3d"
537 run_dump_test "pr13082-4a"
538 run_dump_test "pr13082-4b"
539 run_dump_test "pr13082-5a"
540 run_dump_test "pr13082-5b"
541 run_dump_test "pr13082-6a"
542 run_dump_test "pr13082-6b"
543 run_dump_test "lea1a"
544 run_dump_test "lea1b"
545 run_dump_test "lea1c"
546 run_dump_test "lea1d"
547 run_dump_test "lea1e"
548 run_dump_test "lea1f"
549 run_dump_test "lea1g"
550 run_dump_test "lea1h"
551 run_dump_test "lea1i"
552 run_dump_test "lea1j"
553 run_dump_test "lea1k"
554 run_dump_test "lea1l"
555 run_dump_test "mov1a"
556 run_dump_test "mov1b"
557 run_dump_test "mov1c"
558 run_dump_test "mov1d"
559 run_dump_test "mov2a"
560 run_dump_test "mov2b"
561 run_dump_test "mov2c"
562 run_dump_test "mov2d"
563 run_dump_test "ljmp1"
564 run_dump_test "ljmp2"
565 run_dump_test "load1a"
566 run_dump_test "load1b"
567 run_dump_test "load1c"
568 run_dump_test "load1d"
569 run_dump_test "load2"
570 run_dump_test "call1a"
571 run_dump_test "call1b"
572 run_dump_test "call1c"
573 run_dump_test "call1d"
574 run_dump_test "call1e"
575 run_dump_test "call1f"
576 run_dump_test "call1g"
577 run_dump_test "call1h"
578 run_dump_test "call1i"
579 run_dump_test "pr17935-1"
580 run_dump_test "pr17935-2"
581 run_dump_test "pr18160"
582 run_dump_test "pr18176"
583 run_dump_test "pr18801a"
584 run_dump_test "pr18801b"
585 run_dump_test "ifunc-textrel-1a"
586 run_dump_test "ifunc-textrel-1b"
587 run_dump_test "ifunc-textrel-2a"
588 run_dump_test "ifunc-textrel-2b"
589 run_dump_test "pr18815"
590 run_dump_test "pr19013"
591 run_dump_test "pr19013-x32"
592 run_dump_test "pr19162"
593 run_dump_test "pr19175"
594 run_dump_test "pr18591"
595 run_dump_test "pr19615"
596 run_dump_test "pr19636-1a"
597 run_dump_test "pr19636-1b"
598 run_dump_test "pr19636-1c"
599 run_dump_test "pr19636-1d"
600 run_dump_test "pr19636-1e"
601 run_dump_test "pr19636-1f"
602 run_dump_test "pr19636-1g"
603 run_dump_test "pr19636-1h"
604 run_dump_test "pr19636-1i"
605 run_dump_test "pr19636-1j"
606 run_dump_test "pr19636-2a"
607 run_dump_test "pr19636-2b"
608 run_dump_test "pr19636-2c"
609 run_dump_test "pr19636-2d"
610 run_dump_test "pr19636-2e"
611 run_dump_test "pr19636-2f"
612 run_dump_test "pr19636-2g"
613 run_dump_test "pr19636-2h"
614 run_dump_test "pr19636-2i"
615 run_dump_test "pr19636-2j"
616 run_dump_test "pr19636-2k"
617 run_dump_test "pr19636-2l"
618 run_dump_test "pr19636-2m"
619 run_dump_test "pr19636-3a"
620 run_dump_test "pr19636-3b"
621 run_dump_test "pr19636-3c"
622 run_dump_test "pr19645"
623 run_dump_test "pr19609-1a"
624 run_dump_test "pr19609-1b"
625 run_dump_test "pr19609-1c"
626 run_dump_test "pr19609-1d"
627 run_dump_test "pr19609-1e"
628 run_dump_test "pr19609-1f"
629 run_dump_test "pr19609-1g"
630 run_dump_test "pr19609-1h"
631 run_dump_test "pr19609-1i"
632 run_dump_test "pr19609-1j"
633 run_dump_test "pr19609-1k"
634 run_dump_test "pr19609-1l"
635 run_dump_test "pr19609-1m"
636 run_dump_test "pr19609-2a"
637 run_dump_test "pr19609-2b"
638 run_dump_test "pr19609-2c"
639 run_dump_test "pr19609-2d"
640 run_dump_test "pr19609-3a"
641 run_dump_test "pr19609-3b"
642 run_dump_test "pr19609-4a"
643 run_dump_test "pr19609-4b"
644 run_dump_test "pr19609-4c"
645 run_dump_test "pr19609-4d"
646 run_dump_test "pr19609-4e"
647 run_dump_test "pr19609-5a"
648 run_dump_test "pr19609-5b"
649 run_dump_test "pr19609-5c"
650 run_dump_test "pr19609-5d"
651 run_dump_test "pr19609-5e"
652 run_dump_test "pr19609-6a"
653 run_dump_test "pr19609-6b"
654 run_dump_test "pr19609-6c"
655 run_dump_test "pr19609-6d"
656 run_dump_test "pr19609-7a"
657 run_dump_test "pr19609-7b"
658 run_dump_test "pr19609-7c"
659 run_dump_test "pr19609-7d"
660 run_dump_test "pr19939a"
661 run_dump_test "pr19939b"
662 run_dump_test "pr19719"
663 run_dump_test "pr20253-1a"
664 run_dump_test "pr20253-1b"
665 run_dump_test "pr20253-1c"
666 run_dump_test "pr20253-1d"
667 run_dump_test "pr20253-1e"
668 run_dump_test "pr20253-1f"
669 run_dump_test "pr20253-1g"
670 run_dump_test "pr20253-1h"
671 run_dump_test "pr20253-1i"
672 run_dump_test "pr20253-1j"
673 run_dump_test "pr20253-1k"
674 run_dump_test "pr20253-1l"
675 run_dump_test "pr20253-3"
676 run_dump_test "pr20253-4a"
677 run_dump_test "pr20253-4b"
678 run_dump_test "pr20253-4c"
679 run_dump_test "pr20253-4d"
680 run_dump_test "pr20253-4e"
681 run_dump_test "pr20253-4f"
682 run_dump_test "pr20253-5a"
683 run_dump_test "pr20253-5b"
684 run_dump_test "tlsdesc2"
685 run_dump_test "pr22048"
686 run_dump_test "pr22929"
687 run_dump_test "pr26939"
688 run_dump_test "pr26939-x32"
689 run_dump_test "pr27016a"
690 run_dump_test "pr27016b"
691 run_dump_test "report-reloc-1"
692 run_dump_test "report-reloc-1-x32"
693
694 proc undefined_weak {cflags ldflags} {
695 set testname "Undefined weak symbol"
696 if { ![ string match "" $cflags$ldflags] } {
697 set testname "$testname ($cflags $ldflags)"
698 }
699
700 if { [string match "*-fPIE*" $cflags]
701 && ![string match "*nodynamic-undefined-weak*" $ldflags] } {
702 set weak_symbol "Weak defined"
703 } else {
704 set weak_symbol "Weak undefined"
705 }
706
707 run_cc_link_tests [list \
708 [list \
709 "Build libpr19704a.so" \
710 "-shared -Wl,-soname,libpr19704.so" \
711 "" \
712 { dummy.s } \
713 {} \
714 "libpr19704a.so" \
715 ] \
716 [list \
717 "Build libpr19704b.so" \
718 "-shared -Wl,-soname,libpr19704.so" \
719 "-fPIC" \
720 { pr19704b.c } \
721 {} \
722 "libpr19704b.so" \
723 ] \
724 ]
725
726 exec cp tmpdir/libpr19704a.so tmpdir/libpr19704.so
727
728 run_ld_link_exec_tests [list \
729 [list \
730 "Run pr19704" \
731 "-Wl,--no-as-needed,-R,tmpdir $ldflags tmpdir/libpr19704.so" \
732 "" \
733 { pr19704a.c } \
734 "pr19704" \
735 "pr19704.out" \
736 "$cflags" \
737 ] \
738 ]
739
740 exec cp tmpdir/libpr19704b.so tmpdir/libpr19704.so
741
742 set exec_output [run_host_cmd tmpdir/pr19704 ""]
743 if {![string match $weak_symbol $exec_output]} {
744 fail $testname
745 } else {
746 pass $testname
747 }
748 }
749
750 # Must be native with the C compiler
751 if { [isnative] && [check_compiler_available] } {
752 run_cc_link_tests [list \
753 [list \
754 "Helper X32 DSO from x86-64 object" "" \
755 "-m64 $NOSANITIZE_CFLAGS -fPIC -g" \
756 {simple.c} {} "libsimple.a" \
757 ] \
758 ]
759
760 set convertx32 "$objcopy -O elf32-x86-64 tmpdir/simple.o tmpdir/simple-x32.o"
761 send_log "$convertx32\n"
762 set got [remote_exec host "$convertx32"]
763 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
764 send_log "$got\n"
765 fail "Convert x86-64 object to x32"
766 return
767 }
768
769 run_ld_link_tests [list \
770 [list \
771 "X32 DSO from x86-64 object" \
772 "-shared -melf32_x86_64 tmpdir/simple-x32.o" \
773 "$NOSANITIZE_CFLAGS" \
774 "--x32 -mx86-used-note=yes" \
775 {dummy.s} {{readelf {-s --wide} x86-64-x32.rd}} \
776 "x86-64-x32" \
777 ] \
778 ]
779
780 run_cc_link_tests [list \
781 [list \
782 "Build plt-lib.so" \
783 "-shared" \
784 "-fPIC -Wa,-mx86-used-note=yes" \
785 { plt-lib.c } \
786 {} \
787 "libplt-lib.so" \
788 ] \
789 [list \
790 "Build libplt-main1.a" \
791 "" \
792 "-fPIC -Wa,-mrelax-relocations=yes,-mx86-used-note=yes" \
793 { plt-main1.c } \
794 {{readelf {-Wr} plt-main1.rd}} \
795 "libplt-main1.a" \
796 ] \
797 [list \
798 "Build libplt-main2.a" \
799 "" \
800 "-fPIC -Wa,-mrelax-relocations=yes,-mx86-used-note=yes" \
801 { plt-main2.c } \
802 {{readelf {-Wr} plt-main2.rd}} \
803 "libplt-main2.a" \
804 ] \
805 [list \
806 "Build libplt-main3.a" \
807 "" \
808 "-fPIC -Wa,-mrelax-relocations=yes,-mx86-used-note=yes $PLT_CFLAGS" \
809 { plt-main3.c } \
810 {{readelf {-Wr} plt-main3.rd}} \
811 "libplt-main3.a" \
812 ] \
813 [list \
814 "Build libplt-main4.a" \
815 "" \
816 "-fPIC -Wa,-mrelax-relocations=yes,-mx86-used-note=yes $PLT_CFLAGS" \
817 { plt-main4.c } \
818 {{readelf {-Wr} plt-main4.rd}} \
819 "libplt-main4.a" \
820 ] \
821 [list \
822 "Build plt-main" \
823 "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
824 tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
825 "" \
826 { plt-main5.c } \
827 {{readelf {-Wr} plt-main.rd}} \
828 "plt-main" \
829 ] \
830 [list \
831 "Build plt-main with PIE" \
832 "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
833 tmpdir/plt-main4.o tmpdir/libplt-lib.so -pie" \
834 "-fPIC -Wa,-mx86-used-note=yes" \
835 { plt-main5.c } \
836 {{readelf {-Wr} plt-main.rd}} \
837 "plt-main" \
838 ] \
839 [list \
840 "Build copyreloc-lib.so" \
841 "-shared" \
842 "-fPIC -Wa,-mx86-used-note=yes" \
843 { copyreloc-lib.c } \
844 {} \
845 "copyreloc-lib.so" \
846 ] \
847 [list \
848 "Build libcopyreloc-main.a" \
849 "" \
850 "-Wa,-mx86-used-note=yes" \
851 { copyreloc-main.S } \
852 {} \
853 "libcopyreloc-main.a" \
854 ] \
855 [list \
856 "Build copyreloc-main with PIE without -fPIE (1)" \
857 "tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so -pie" \
858 "-Wa,-mx86-used-note=yes" \
859 { dummy.s } \
860 {{readelf {-Wr} copyreloc-main1.rd}} \
861 "copyreloc-main" \
862 ] \
863 [list \
864 "Build copyreloc-main with PIE without -fPIE (2)" \
865 "tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so -pie" \
866 "-Wa,-mx86-used-note=yes" \
867 { dummy.s } \
868 {{readelf {-Wr} copyreloc-main2.rd}} \
869 "copyreloc-main" \
870 ] \
871 [list \
872 "Build pr17689.so" \
873 "-shared" \
874 "-fPIC -Wa,-mx86-used-note=yes" \
875 { pr17689a.c } \
876 {} \
877 "pr17689.so" \
878 ] \
879 [list \
880 "Build pr17689now.so with -z now" \
881 "-shared -Wl,-z,now" \
882 "-fPIC -Wa,-mx86-used-note=yes" \
883 { pr17689a.c } \
884 {{readelf {-Wr} pr17689now.rd}} \
885 "pr17689now.so" \
886 ] \
887 [list \
888 "Build pr17689b.o" \
889 "" \
890 "-Wa,-mx86-used-note=yes" \
891 { pr17689b.S } \
892 {} \
893 ] \
894 [list \
895 "Build pr17689 with PIE without -fPIE" \
896 "tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \
897 "-Wa,-mx86-used-note=yes" \
898 { dummy.s } \
899 {{readelf {-Wr} pr17689.rd}} \
900 "pr17689" \
901 ] \
902 [list \
903 "Build pr17689 with PIE -z now without -fPIE" \
904 "tmpdir/pr17689b.o tmpdir/pr17689.so -pie -Wl,-z,now" \
905 "-Wa,-mx86-used-note=yes" \
906 { dummy.s } \
907 {{readelf {-Wr} pr17689now.rd}} \
908 "pr17689now" \
909 ] \
910 [list \
911 "Build pr17827 with PIE without -fPIE" \
912 "-Wl,--as-needed tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \
913 "-Wa,-mx86-used-note=yes" \
914 { dummy.s } \
915 {{readelf {-Wr} pr17827.rd}} \
916 "pr17827" \
917 ] \
918 [list \
919 "Build pr18900.so" \
920 "-shared" \
921 "-fPIC -Wa,-mx86-used-note=yes" \
922 { pr18900a.c } \
923 "" \
924 "pr18900.so" \
925 ] \
926 [list \
927 "Build pr18900.o" \
928 "-r -nostdlib" \
929 "-Wa,-mx86-used-note=yes" \
930 { pr18900b.c pr18900c.c } \
931 "" \
932 "pr18900.o" \
933 ] \
934 [list \
935 "Build pr18900a" \
936 "tmpdir/pr18900.o tmpdir/pr18900.so" \
937 "-Wa,-mx86-used-note=yes" \
938 { dummy.s } \
939 {{readelf {-Wrd} pr18900a.rd}} \
940 "pr18900a" \
941 ] \
942 [list \
943 "Build pr18900b" \
944 "-Wl,--as-needed tmpdir/pr18900.o tmpdir/pr18900.so" \
945 "-Wa,-mx86-used-note=yes" \
946 { dummy.s } \
947 {{readelf {-Wrd} pr18900b.rd}} \
948 "pr18900b" \
949 ] \
950 [list \
951 "Build pr19031.so" \
952 "-shared" \
953 "-fPIC -Wa,-mx86-used-note=yes" \
954 { pr19031a.c } \
955 "" \
956 "pr19031.so" \
957 ] \
958 [list \
959 "Build gotpcrel1d.so" \
960 "-shared" \
961 "-Wa,-mx86-used-note=yes" \
962 { gotpcrel1d.S } \
963 "" \
964 "gotpcrel1d.so" \
965 ] \
966 [list \
967 "Build gotpcrel1a.o gotpcrel1b.o gotpcrel1c.o" \
968 "" \
969 "-Wa,-mrelax-relocations=yes,-mx86-used-note=yes" \
970 { gotpcrel1a.S gotpcrel1b.c gotpcrel1c.c } \
971 ] \
972 [list \
973 "Build gotpcrel1" \
974 "$NOPIE_LDFLAGS -Wl,--as-needed tmpdir/gotpcrel1a.o \
975 tmpdir/gotpcrel1b.o tmpdir/gotpcrel1c.o \
976 tmpdir/gotpcrel1d.so" \
977 "-Wa,-mx86-used-note=yes" \
978 { dummy.s } \
979 {{objdump {-dw} gotpcrel1.dd}} \
980 "gotpcrel1" \
981 ] \
982 [list \
983 "Build pr19319.so" \
984 "-shared" \
985 "-Wa,-mx86-used-note=yes" \
986 { pr19319a.S } \
987 "" \
988 "pr19319.so" \
989 ] \
990 [list \
991 "Build pr19319" \
992 "-pie -nostdlib -nostartfiles tmpdir/pr19319.so" \
993 "-Wa,-mx86-used-note=yes" \
994 { pr19319b.S } \
995 {{objdump {-dw} pr19319.dd}} \
996 "pr19319" \
997 ] \
998 [list \
999 "Build pr24276.so" \
1000 "-shared -nostdlib -nostartfiles \
1001 -Ltmpdir $srcdir/$subdir/pr24276.dso" \
1002 "-Wa,-mx86-used-note=yes" \
1003 { pr19319b.S } \
1004 {{warning_output pr24276.warn}} \
1005 "pr24276.so" \
1006 ] \
1007 [list \
1008 "Build property 1" \
1009 "" \
1010 "-Wa,-mx86-used-note=no" \
1011 {pass.c property-no-copy.S} \
1012 {{readelf {-n} property-1.r}} \
1013 "property-1" \
1014 ] \
1015 [list \
1016 "Build property 1 (.o)" \
1017 "-r -nostdlib" \
1018 "-Wa,-mx86-used-note=yes" \
1019 {pass.c property-no-copy.S} \
1020 {{readelf {-n} property-1a.r}} \
1021 "property-1.o" \
1022 ] \
1023 [list \
1024 "Build property 1 (.so)" \
1025 "-shared" \
1026 "-fPIC -Wa,-mx86-used-note=no" \
1027 {pass.c property-no-copy.S} \
1028 {{readelf {-n} property-1.r}} \
1029 "property-1.so" \
1030 ] \
1031 [list \
1032 "Build property 2" \
1033 "" \
1034 "-Wa,-mx86-used-note=no" \
1035 {pass.c property-stack.S} \
1036 {{readelf {-n} property-2.r}} \
1037 "property-2" \
1038 ] \
1039 [list \
1040 "Build property 2 (.o)" \
1041 "-r -nostdlib" \
1042 "-Wa,-mx86-used-note=yes" \
1043 {pass.c property-stack.S} \
1044 {{readelf {-n} property-2a.r}} \
1045 "property-2.o" \
1046 ] \
1047 [list \
1048 "Build property 2 (.so)" \
1049 "-shared" \
1050 "-fPIC -Wa,-mx86-used-note=yes" \
1051 {pass.c property-stack.S} \
1052 {{readelf {-n} property-2.r}} \
1053 "property-2.so" \
1054 ] \
1055 [list \
1056 "Build property 3" \
1057 "" \
1058 "-Wa,-mx86-used-note=yes" \
1059 {pass.c property-stack.S property-x86-1.S} \
1060 {{readelf {-n} property-3.r}} \
1061 "property-3" \
1062 ] \
1063 [list \
1064 "Build property 3 (.o)" \
1065 "-r -nostdlib" \
1066 "-Wa,-mx86-used-note=yes" \
1067 {pass.c property-x86-1.S property-stack.S} \
1068 {{readelf {-n} property-3a.r}} \
1069 "property-3.o" \
1070 ] \
1071 [list \
1072 "Build property 3 (.so)" \
1073 "-shared" \
1074 "-fPIC -Wa,-mx86-used-note=yes" \
1075 {property-x86-1.S pass.c property-stack.S} \
1076 {{readelf {-n} property-3.r}} \
1077 "property-3.so" \
1078 ] \
1079 [list \
1080 "Build property 4" \
1081 "" \
1082 "-Wa,-mx86-used-note=yes" \
1083 {pass.c property-stack.S property-x86-1.S property-x86-2.S} \
1084 {{readelf {-n} property-4.r}} \
1085 "property-4" \
1086 ] \
1087 [list \
1088 "Build property 4 (.o)" \
1089 "-r -nostdlib" \
1090 "-Wa,-mx86-used-note=yes" \
1091 {pass.c property-x86-2.S property-x86-1.S property-stack.S} \
1092 {{readelf {-n} property-4a.r}} \
1093 "property-4.o" \
1094 ] \
1095 [list \
1096 "Build property 4 (.so)" \
1097 "-shared" \
1098 "-fPIC -Wa,-mx86-used-note=yes" \
1099 {property-x86-2.S property-x86-1.S pass.c property-stack.S} \
1100 {{readelf {-n} property-4.r}} \
1101 "property-4.so" \
1102 ] \
1103 [list \
1104 "Build property 4 (-Wl,-z,stack-size=0)" \
1105 "-Wl,-z,stack-size=0" \
1106 "-Wa,-mx86-used-note=yes" \
1107 {pass.c property-stack.S property-x86-1.S property-x86-2.S} \
1108 {{readelf {-n} property-4.r}} \
1109 "property-4" \
1110 ] \
1111 [list \
1112 "Build property 5" \
1113 "-Wl,-z,stack-size=0x900000" \
1114 "-Wa,-mx86-used-note=yes" \
1115 {pass.c property-stack.S property-x86-1.S property-x86-2.S} \
1116 {{readelf {-n} property-5.r}} \
1117 "property-5" \
1118 ] \
1119 [list \
1120 "Build property 5 (.o)" \
1121 "-r -nostdlib -Wl,-z,stack-size=0x900000" \
1122 "-Wa,-mx86-used-note=yes" \
1123 {pass.c property-x86-2.S property-x86-1.S property-stack.S} \
1124 {{readelf {-n} property-5a.r}} \
1125 "property-5.o" \
1126 ] \
1127 [list \
1128 "Build property 5 (.so)" \
1129 "-shared -Wl,-z,stack-size=0x900000" \
1130 "-fPIC -Wa,-mx86-used-note=yes" \
1131 {property-x86-2.S property-x86-1.S pass.c property-stack.S} \
1132 {{readelf {-n} property-5.r}} \
1133 "property-5.so" \
1134 ] \
1135 [list \
1136 "Build property-6.so" \
1137 "-shared" \
1138 "-fPIC -Wa,-mx86-used-note=yes" \
1139 {property-6a.c property-6c.S} \
1140 {{readelf {-n} property-6.r}} \
1141 "property-6.so" \
1142 ] \
1143 [list \
1144 "Build property-6.o" \
1145 "-r -nostdlib" \
1146 "-Wa,-mx86-used-note=yes" \
1147 {property-6b.c property-stack.S} \
1148 {{readelf {-n} property-2a.r}} \
1149 "property-6.o" \
1150 ] \
1151 [list \
1152 "Build property-6" \
1153 "-Wl,--as-needed tmpdir/property-6.o tmpdir/property-6.so" \
1154 "-Wa,-mx86-used-note=yes" \
1155 { dummy.s } \
1156 {{readelf {-n} property-2.r}} \
1157 "property-6" \
1158 ] \
1159 [list \
1160 "Build property 7a (.o)" \
1161 "-r -nostdlib" \
1162 "-Wa,-mx86-used-note=yes" \
1163 {property-unsorted-1.S} \
1164 {{readelf {-n} property-7a.r}} \
1165 "property-7a.o" \
1166 ] \
1167 [list \
1168 "Build property 7b (.o)" \
1169 "-r -nostdlib" \
1170 "-Wa,-mx86-used-note=yes" \
1171 {property-unsorted-2.S} \
1172 {{readelf {-n} property-7a.r}} \
1173 "property-7b.o" \
1174 ] \
1175 [list \
1176 "Build pr22001-1.so" \
1177 "-shared" \
1178 "-fPIC -Wa,-mx86-used-note=yes" \
1179 { pr22001-1a.c } \
1180 {} \
1181 "pr22001-1.so" \
1182 ] \
1183 [list \
1184 "Build pr22001-1a" \
1185 "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext tmpdir/pr22001-1.so" \
1186 "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
1187 { pr22001-1b.c } \
1188 {{error_output "pr22001-1a.err"}} \
1189 "pr22001-1a" \
1190 ] \
1191 [list \
1192 "Build pr21997-1.so" \
1193 "-shared" \
1194 "-Wa,-mx86-used-note=yes" \
1195 { property-stack.S property-no-copy.S pr21997-1a.S } \
1196 {} \
1197 "pr21997-1.so" \
1198 ] \
1199 [list \
1200 "Build pr21997-1a" \
1201 "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/pr21997-1.so" \
1202 "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
1203 { pr21997-1b.c } \
1204 {{error_output "pr21997-1a.err"}} \
1205 "pr21997-1a" \
1206 ] \
1207 [list \
1208 "Build pr22064a.o" \
1209 "" \
1210 "-Wa,-mx86-used-note=yes" \
1211 { pr22064a.S } \
1212 ] \
1213 [list \
1214 "Build pr22064.so" \
1215 "-shared" \
1216 "-fPIC -Wa,-mx86-used-note=yes" \
1217 { pr22064b.c } \
1218 {} \
1219 "pr22064.so" \
1220 ] \
1221 [list \
1222 "Build pr22393-3a.so" \
1223 "-shared -Wl,-z,separate-code,-z,max-page-size=0x1000" \
1224 "-fPIC -Wa,-mx86-used-note=yes" \
1225 {pr22393-3a.c} \
1226 {{readelf -lW pr22393-3a.rd} \
1227 {readelf -lW pr22393-3b.rd}} \
1228 "pr22393-3a.so" \
1229 ] \
1230 [list \
1231 "Build pr22393-3a-now.so" \
1232 "-shared -Wl,-z,separate-code,-z,now,-z,max-page-size=0x1000" \
1233 "-fPIC -Wa,-mx86-used-note=yes" \
1234 {pr22393-3a.c} \
1235 {{readelf -lW pr22393-3a.rd} \
1236 {readelf -lW pr22393-3b.rd}} \
1237 "pr22393-3a-now.so" \
1238 ] \
1239 [list \
1240 "Build pr22393-3" \
1241 "$NOPIE_LDFLAGS -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-3a.so" \
1242 "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
1243 {pr22393-3b.c} \
1244 {{readelf -lW pr22393-3a.rd} \
1245 {readelf -lW pr22393-3b.rd}} \
1246 "pr22393-3" \
1247 ] \
1248 [list \
1249 "Build pr22393-3 (PIE)" \
1250 "-pie -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-3a-now.so" \
1251 "-fPIE -Wa,-mx86-used-note=yes" \
1252 {pr22393-3b.c} \
1253 {{readelf -lW pr22393-3a.rd} \
1254 {readelf -lW pr22393-3b.rd}} \
1255 "pr22393-3-pie" \
1256 ] \
1257 [list \
1258 "Build pr22393-3 (static)" \
1259 "-static -Wl,-z,separate-code,-z,max-page-size=0x1000" \
1260 "-Wa,-mx86-used-note=yes" \
1261 {pr22393-3a.c pr22393-3b.c} \
1262 {{readelf -lW pr22393-3a.rd} \
1263 {readelf -lW pr22393-3b.rd}} \
1264 "pr22393-3-static" \
1265 ] \
1266 [list \
1267 "Build pr22791-1.so" \
1268 "-shared" \
1269 "-fPIC -Wa,-mx86-used-note=yes" \
1270 { pr22791-1a.c } \
1271 {} \
1272 "pr22791-1.so" \
1273 ] \
1274 [list \
1275 "Build pr22791-1" \
1276 "-pie -Wl,--no-as-needed,-z,notext tmpdir/pr22791-1.so" \
1277 "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
1278 { pr22791-1b.s } \
1279 {{error_output "pr22791-1.err"}} \
1280 "pr22791-1" \
1281 ] \
1282 [list \
1283 "Build pr22791-2a.o" \
1284 "" \
1285 "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
1286 { pr22791-2a.s } \
1287 ] \
1288 [list \
1289 "Build pr22791-2.so" \
1290 "-shared tmpdir/pr22791-2a.o" \
1291 "-fPIC -Wa,-mx86-used-note=yes" \
1292 { pr22791-2b.c } \
1293 {{readelf -drW pr22791-2.rd}} \
1294 "pr22791-2.so" \
1295 ] \
1296 [list \
1297 "Build pr22791-2" \
1298 "-pie -Wl,--no-as-needed tmpdir/pr22791-2.so" \
1299 "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
1300 { pr22791-2c.s } \
1301 {{readelf -drW pr22791-2.rd}} \
1302 "pr22791-2" \
1303 ] \
1304 [list \
1305 "Build pr22842.so" \
1306 "-shared" \
1307 "-fPIC -Wa,-mx86-used-note=yes" \
1308 { pr22842a.c } \
1309 {} \
1310 "pr22842.so" \
1311 ] \
1312 [list \
1313 "Build pr22842" \
1314 "-pie -Wl,--no-as-needed tmpdir/pr22842.so" \
1315 "-Wa,-mx86-used-note=yes" \
1316 { pr22842b.S } \
1317 {{readelf -rW pr22842a.rd} \
1318 {readelf -rW pr22842b.rd}} \
1319 "pr22842" \
1320 ] \
1321 ]
1322
1323 if {[istarget "x86_64-*-linux*-gnux32"]} {
1324 run_cc_link_tests [list \
1325 [list \
1326 "Build pr25416-5b.o (GDesc -maddress-mode=short)" \
1327 "" \
1328 "-Wa,-mx86-used-note=yes" \
1329 { pr25416-5b.s } \
1330 ] \
1331 [list \
1332 "Build pr25416-5b.so (GDesc -> IE -maddress-mode=short)" \
1333 "-shared" \
1334 "-fPIC -Wa,-mx86-used-note=yes" \
1335 { pr25416-5b.s pr25416-5d.s } \
1336 {} \
1337 "pr25416-5b.so" \
1338 ] \
1339 [list \
1340 "Build pr25416-5c.o (GDesc -maddress-mode=long)" \
1341 "" \
1342 "-Wa,-mx86-used-note=yes" \
1343 { pr25416-5c.s } \
1344 ] \
1345 [list \
1346 "Build pr25416-5c.so (GDesc -> IE -maddress-mode=long)" \
1347 "-shared" \
1348 "-fPIC -Wa,-mx86-used-note=yes" \
1349 { pr25416-5c.s pr25416-5d.s } \
1350 {} \
1351 "pr25416-5c.so" \
1352 ] \
1353 [list \
1354 "Build pr25416-5d.so (GDesc -maddress-mode=short)" \
1355 "-shared" \
1356 "-fPIC -Wa,-mx86-used-note=yes" \
1357 { pr25416-5b.s pr25416-5e.s } \
1358 {} \
1359 "pr25416-5d.so" \
1360 ] \
1361 [list \
1362 "Build pr25416-5d.o (IE -maddress-mode=short)" \
1363 "" \
1364 "-Wa,-mx86-used-note=yes" \
1365 { pr25416-5d.s } \
1366 ] \
1367 ]
1368
1369 run_ld_link_exec_tests [list \
1370 [list \
1371 "Run pr22001-1b" \
1372 "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext tmpdir/pr22001-1.so" \
1373 "-Wa,-mx86-used-note=yes" \
1374 { pr22001-1c.c } \
1375 "pr22001-1b" \
1376 "pass.out" \
1377 "$NOPIE_CFLAGS" \
1378 ] \
1379 [list \
1380 "Run pr21997-1b" \
1381 "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/pr21997-1.so" \
1382 "-Wa,-mx86-used-note=yes" \
1383 { pr21997-1c.c } \
1384 "pr21997-1b" \
1385 "pass.out" \
1386 "$NOPIE_CFLAGS" \
1387 ] \
1388 [list \
1389 "Run pr25416-5a (GDesc -> IE -maddress-mode=short)" \
1390 "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr25416-5b.so" \
1391 "-Wa,-mx86-used-note=yes" \
1392 { pr25416-5a.c } \
1393 "pr25416-5a" \
1394 "pass.out" \
1395 "$NOPIE_CFLAGS" \
1396 ] \
1397 [list \
1398 "Run pr25416-5b (GDesc -> LE -maddress-mode=short" \
1399 "$NOPIE_LDFLAGS tmpdir/pr25416-5b.o tmpdir/pr25416-5d.o" \
1400 "-Wa,-mx86-used-note=yes" \
1401 { pr25416-5a.c } \
1402 "pr25416-5b" \
1403 "pass.out" \
1404 "$NOPIE_CFLAGS" \
1405 ] \
1406 [list \
1407 "Run pr25416-5c (GDesc -> IE -maddress-mode=long)" \
1408 "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr25416-5c.so" \
1409 "-Wa,-mx86-used-note=yes" \
1410 { pr25416-5a.c } \
1411 "pr25416-5c" \
1412 "pass.out" \
1413 "$NOPIE_CFLAGS" \
1414 ] \
1415 [list \
1416 "Run pr25416-5d (GDesc -> LE -maddress-mode=long)" \
1417 "$NOPIE_LDFLAGS tmpdir/pr25416-5c.o tmpdir/pr25416-5d.o" \
1418 "-Wa,-mx86-used-note=yes" \
1419 { pr25416-5a.c } \
1420 "pr25416-5d" \
1421 "pass.out" \
1422 "$NOPIE_CFLAGS" \
1423 ] \
1424 [list \
1425 "Run pr25416-5e (GDesc -maddress-mode=short)" \
1426 "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr25416-5d.so" \
1427 "-Wa,-mx86-used-note=yes" \
1428 { pr25416-5a.c } \
1429 "pr25416-5e" \
1430 "pass.out" \
1431 "$NOPIE_CFLAGS" \
1432 ] \
1433 [list \
1434 "Run pr25416-5f (PIE GDesc -> LE -maddress-mode=short)" \
1435 "-pie -Wl,-z,notext tmpdir/pr25416-5b.o tmpdir/pr25416-5d.o" \
1436 "-Wa,-mx86-used-note=yes" \
1437 { pr25416-5a.c } \
1438 "pr25416-5f" \
1439 "pass.out" \
1440 ] \
1441 [list \
1442 "Run pr25416-5g (PIE GDesc -> LE -maddress-mode=long)" \
1443 "-pie -Wl,-z,notext tmpdir/pr25416-5c.o tmpdir/pr25416-5d.o" \
1444 "-Wa,-mx86-used-note=yes" \
1445 { pr25416-5a.c } \
1446 "pr25416-5g" \
1447 "pass.out" \
1448 ] \
1449 ]
1450 } else {
1451 run_cc_link_tests [list \
1452 [list \
1453 "Build pr22001-1b" \
1454 "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext tmpdir/pr22001-1.so" \
1455 "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
1456 { pr22001-1c.c } \
1457 {{error_output "pr22001-1b.err"}} \
1458 "pr22001-1b" \
1459 ] \
1460 [list \
1461 "Build pr21997-1b" \
1462 "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/pr21997-1.so" \
1463 "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
1464 { pr21997-1c.c } \
1465 {{error_output "pr21997-1b.err"}} \
1466 "pr21997-1b" \
1467 ] \
1468 [list \
1469 "Build lam-u48.so" \
1470 "-shared -Wl,-z,lam-u48" \
1471 "" \
1472 {dummy.s} \
1473 {{readelf -n lam-u48.rd}} \
1474 "lam-u48.so" \
1475 ] \
1476 [list \
1477 "Build lam-u57.so" \
1478 "-shared -Wl,-z,lam-u57" \
1479 "" \
1480 {dummy.s} \
1481 {{readelf -n lam-u57.rd}} \
1482 "lam-u57.so" \
1483 ] \
1484 ]
1485 }
1486
1487 run_ld_link_exec_tests [list \
1488 [list \
1489 "Run plt-main" \
1490 "-Wl,--no-as-needed tmpdir/plt-main1.o tmpdir/plt-main2.o \
1491 tmpdir/plt-main3.o tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
1492 "-Wa,-mx86-used-note=yes" \
1493 { plt-main5.c } \
1494 "plt-main" \
1495 "plt-main.out" \
1496 ] \
1497 [list \
1498 "Run plt-main with PIE" \
1499 "-Wl,--no-as-needed -pie tmpdir/plt-main1.o tmpdir/plt-main2.o \
1500 tmpdir/plt-main3.o tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
1501 "-Wa,-mx86-used-note=yes" \
1502 { plt-main5.c } \
1503 "plt-main-pie" \
1504 "plt-main.out" \
1505 "-fPIC" \
1506 ] \
1507 [list \
1508 "Run copyreloc-main with PIE without -fPIE" \
1509 "-Wl,--as-needed -pie tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so" \
1510 "-Wa,-mx86-used-note=yes" \
1511 { dummy.s } \
1512 "copyreloc-main" \
1513 "copyreloc-main.out" \
1514 ] \
1515 [list \
1516 "Run pr17689 with PIE without -fPIE" \
1517 "-Wl,--no-as-needed -pie tmpdir/pr17689b.o tmpdir/pr17689.so" \
1518 "-Wa,-mx86-used-note=yes" \
1519 { dummy.s } \
1520 "pr17689" \
1521 "pr17689.out" \
1522 ] \
1523 [list \
1524 "Run pr17689 with PIE -z now without -fPIE" \
1525 "-Wl,--as-needed,-z,now -pie tmpdir/pr17689b.o tmpdir/pr17689.so" \
1526 "-Wa,-mx86-used-note=yes" \
1527 { dummy.s } \
1528 "pr17689now" \
1529 "pr17689.out" \
1530 ] \
1531 [list \
1532 "Run pr18900" \
1533 "-Wl,--no-as-needed tmpdir/pr18900.o tmpdir/pr18900.so" \
1534 "-Wa,-mx86-used-note=yes" \
1535 { dummy.s } \
1536 "pr18900" \
1537 "pr18900.out" \
1538 ] \
1539 [list \
1540 "Run pr19031" \
1541 "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr19031.so" \
1542 "-Wa,-mx86-used-note=yes" \
1543 { pr19031b.S pr19031c.c } \
1544 "pr19031" \
1545 "pr19031.out" \
1546 "$NOPIE_CFLAGS" \
1547 ] \
1548 [list \
1549 "Run gotpcrel1" \
1550 "-Wl,--no-as-needed tmpdir/gotpcrel1d.so" \
1551 "-Wa,-mx86-used-note=yes" \
1552 { gotpcrel1a.S gotpcrel1b.c gotpcrel1c.c } \
1553 "gotpcrel1" \
1554 "gotpcrel1.out" \
1555 ] \
1556 [list \
1557 "Run property 1" \
1558 "" \
1559 "-Wa,-mx86-used-note=yes" \
1560 {pass.c property-no-copy.S} \
1561 "property-1" "pass.out" \
1562 ] \
1563 [list \
1564 "Run property 1 (PIE)" \
1565 "-pie" \
1566 "-Wa,-mx86-used-note=yes" \
1567 {pass.c property-no-copy.S} \
1568 "property-1-pie" "pass.out" "-fPIE" \
1569 ] \
1570 [list \
1571 "Run property 1 (static)" \
1572 "-static" \
1573 "-Wa,-mx86-used-note=yes" \
1574 {pass.c property-no-copy.S} \
1575 "property-1-static" "pass.out" \
1576 ] \
1577 [list \
1578 "Run property 2" \
1579 "" \
1580 "-Wa,-mx86-used-note=yes" \
1581 {pass.c property-stack.S} \
1582 "property-2" "pass.out" \
1583 ] \
1584 [list \
1585 "Run property 2 (PIE)" \
1586 "-pie" \
1587 "-Wa,-mx86-used-note=yes" \
1588 {pass.c property-stack.S} \
1589 "property-2-pie" "pass.out" "-fPIE" \
1590 ] \
1591 [list \
1592 "Run property 2 (static)" \
1593 "-static" \
1594 "-Wa,-mx86-used-note=yes" \
1595 {pass.c property-stack.S} \
1596 "property-3-static" "pass.out" \
1597 ] \
1598 [list \
1599 "Run pr22001-1a (PIC 1)" \
1600 "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
1601 "-Wa,-mx86-used-note=yes" \
1602 { pr22001-1b.c } \
1603 "pr22001-1a-pic-1" \
1604 "pass.out" \
1605 "-fPIC" \
1606 ] \
1607 [list \
1608 "Run pr22001-1a (PIC 2)" \
1609 "-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
1610 "-Wa,-mx86-used-note=yes" \
1611 { pr22001-1b.c } \
1612 "pr22001-1a-pic-2" \
1613 "pass.out" \
1614 "-fPIC" \
1615 ] \
1616 [list \
1617 "Run pr22001-1b (PIC 1)" \
1618 "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
1619 "-Wa,-mx86-used-note=yes" \
1620 { pr22001-1c.c } \
1621 "pr22001-1b-pic-1" \
1622 "pass.out" \
1623 "-fPIC" \
1624 ] \
1625 [list \
1626 "Run pr22001-1b (PIC 2)" \
1627 "-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
1628 "-Wa,-mx86-used-note=yes" \
1629 { pr22001-1c.c } \
1630 "pr22001-1b-pic-2" \
1631 "pass.out" \
1632 "-fPIC" \
1633 ] \
1634 [list \
1635 "Run pr21997-1a (PIC 1)" \
1636 "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
1637 "-Wa,-mx86-used-note=yes" \
1638 { pr21997-1b.c } \
1639 "pr21997-1a-pic-1" \
1640 "pass.out" \
1641 "-fPIC" \
1642 ] \
1643 [list \
1644 "Run pr21997-1a (PIC 2)" \
1645 "-pie -Wl,--no-as-needed tmpdir/pr21997-1.so" \
1646 "-Wa,-mx86-used-note=yes" \
1647 { pr21997-1b.c } \
1648 "pr21997-1a-pic-2" \
1649 "pass.out" \
1650 "-fPIC" \
1651 ] \
1652 [list \
1653 "Run pr21997-1b (PIC 1)" \
1654 "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
1655 "-Wa,-mx86-used-note=yes" \
1656 { pr21997-1c.c } \
1657 "pr21997-1b-pic-1" \
1658 "pass.out" \
1659 "-fPIC" \
1660 ] \
1661 [list \
1662 "Run pr21997-1b (PIC 2)" \
1663 "-pie -Wl,--no-as-needed tmpdir/pr21997-1.so" \
1664 "-Wa,-mx86-used-note=yes" \
1665 { pr21997-1c.c } \
1666 "pr21997-1b-pic-2" \
1667 "pass.out" \
1668 "-fPIC" \
1669 ] \
1670 [list \
1671 "Run pr22064" \
1672 "-pie -Wl,--no-as-needed tmpdir/pr22064a.o tmpdir/pr22064.so" \
1673 "-Wa,-mx86-used-note=yes" \
1674 { dummy.s } \
1675 "pr22064-pie" \
1676 "pass.out" \
1677 "-fPIE" \
1678 ] \
1679 [list \
1680 "Run pr22393-3" \
1681 "$NOPIE_LDFLAGS -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-3a.so" \
1682 "-Wa,-mx86-used-note=yes" \
1683 {pr22393-3b.c} \
1684 "pr22393-3" \
1685 "pass.out" \
1686 "$NOPIE_CFLAGS" \
1687 ] \
1688 [list \
1689 "Run pr22393-3 (PIE)" \
1690 "-pie -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-3a-now.so" \
1691 "-Wa,-mx86-used-note=yes" \
1692 {pr22393-3b.c} \
1693 "pr22393-3-pie" \
1694 "pass.out" \
1695 "-fPIE" \
1696 ] \
1697 [list \
1698 "Run pr22393-3 (static)" \
1699 "-static -Wl,-z,separate-code,-z,max-page-size=0x1000" \
1700 "-Wa,-mx86-used-note=yes" \
1701 {pr22393-3a.c pr22393-3b.c} \
1702 "pr22393-3-static" \
1703 "pass.out" \
1704 ] \
1705 [list \
1706 "Run pr22791-2" \
1707 "-pie -Wl,--no-as-needed tmpdir/pr22791-2.so" \
1708 "-Wa,-mx86-used-note=yes" \
1709 { pr22791-2c.s } \
1710 "pr22791-2" \
1711 "pass.out" \
1712 "$NOPIE_CFLAGS" \
1713 ] \
1714 [list \
1715 "Run pr22842" \
1716 "-pie -Wl,--no-as-needed tmpdir/pr22842.so" \
1717 "-Wa,-mx86-used-note=yes" \
1718 { pr22842b.S } \
1719 "pr22842" \
1720 "pass.out" \
1721 ] \
1722 [list \
1723 "Run pr23997" \
1724 "" \
1725 "" \
1726 { pr23997a.s pr23997b.c pr23997c.c } \
1727 "pr23997" \
1728 "pass.out" \
1729 ] \
1730 ]
1731
1732 # Run-time tests which require working ifunc attribute support.
1733 if { [check_ifunc_attribute_available] } {
1734 run_cc_link_tests [list \
1735 [list \
1736 "Build libpr19784a.so" \
1737 "-shared -Wl,-Bsymbolic-functions" \
1738 "-fPIC -O2 -g -Wa,-mx86-used-note=yes" \
1739 { pr19784b.c pr19784c.c } \
1740 {} \
1741 "libpr19784a.so" \
1742 ] \
1743 [list \
1744 "Build libpr19784b.so" \
1745 "-shared -Wl,-Bsymbolic-functions" \
1746 "-fPIC -O2 -g -Wa,-mx86-used-note=yes" \
1747 { pr19784c.c pr19784b.c } \
1748 {} \
1749 "libpr19784b.so" \
1750 ] \
1751 [list \
1752 "Build pr19784a.o" \
1753 "" \
1754 "-Wa,-mx86-used-note=yes" \
1755 { pr19784a.c } \
1756 ] \
1757 ]
1758
1759 run_ld_link_exec_tests [list \
1760 [list \
1761 "Run pr19784a" \
1762 "-Wl,--no-as-needed tmpdir/pr19784a.o tmpdir/libpr19784a.so" \
1763 "-Wa,-mx86-used-note=yes" \
1764 { dummy.s } \
1765 "pr19784a" \
1766 "pass.out" \
1767 ] \
1768 [list \
1769 "Run pr19784b" \
1770 "-Wl,--as-needed tmpdir/pr19784a.o tmpdir/libpr19784b.so" \
1771 "-Wa,-mx86-used-note=yes" \
1772 { dummy.s } \
1773 "pr19784b" \
1774 "pass.out" \
1775 ] \
1776 ]
1777 }
1778
1779 if { [istarget "x86_64-*-linux*"] \
1780 && ![istarget "x86_64-*-linux*-gnux32"]} {
1781
1782 run_cc_link_tests [list \
1783 [list \
1784 "Build plt-main with -z bndplt" \
1785 "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
1786 tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt \
1787 -z noseparate-code -z max-page-size=0x200000" \
1788 "-Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \
1789 { plt-main5.c } \
1790 {{objdump {-drw} plt-main-bnd.dd}} \
1791 "plt-main-bnd" \
1792 ] \
1793 [list \
1794 "Build plt-main with PIE and -z bndplt" \
1795 "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
1796 tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt -pie \
1797 -z noseparate-code -z max-page-size=0x200000" \
1798 "-fPIC -Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \
1799 { plt-main5.c } \
1800 {{objdump {-drw} plt-main-bnd.dd}} \
1801 "plt-main-pie-bnd" \
1802 ] \
1803 [list \
1804 "Build plt-main with -z bndplt -z now" \
1805 "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
1806 tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt -z now \
1807 -z noseparate-code -z max-page-size=0x200000" \
1808 "-Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \
1809 { plt-main5.c } \
1810 {{readelf {-SW} plt-main-bnd-now.rd} {objdump {-drw} plt-main-bnd.dd}} \
1811 "plt-main-bnd-now" \
1812 ] \
1813 [list \
1814 "Build plt-main with PIE and -z bndplt -z now" \
1815 "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
1816 tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt -z now -pie \
1817 -z noseparate-code -z max-page-size=0x200000" \
1818 "-fPIC -Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \
1819 { plt-main5.c } \
1820 {{readelf {-SW} plt-main-bnd-now.rd} {objdump {-drw} plt-main-bnd.dd}} \
1821 "plt-main-pie-bnd-now" \
1822 ] \
1823 ]
1824
1825 run_ld_link_exec_tests [list \
1826 [list \
1827 "Run plt-main with -z bndplt" \
1828 "-Wl,--no-as-needed,-z,bndplt tmpdir/plt-main1.o \
1829 tmpdir/plt-main2.o tmpdir/plt-main3.o \
1830 tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
1831 "-Wa,-mx86-used-note=yes" \
1832 { plt-main5.c } \
1833 "plt-main-bnd" \
1834 "plt-main.out" \
1835 ] \
1836 [list \
1837 "Run plt-main with PIE and -z bndplt" \
1838 "-Wl,--no-as-needed,-z,bndplt -pie tmpdir/plt-main1.o \
1839 tmpdir/plt-main2.o tmpdir/plt-main3.o \
1840 tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
1841 "-Wa,-mx86-used-note=yes" \
1842 { plt-main5.c } \
1843 "plt-main-pie-bnd" \
1844 "plt-main.out" \
1845 "-fPIC" \
1846 ] \
1847 [list \
1848 "Run plt-main with -z bndplt -z now" \
1849 "-Wl,--no-as-needed,-z,bndplt,-z,now tmpdir/plt-main1.o \
1850 tmpdir/plt-main2.o tmpdir/plt-main3.o \
1851 tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
1852 "-Wa,-mx86-used-note=yes" \
1853 { plt-main5.c } \
1854 "plt-main-bnd-now" \
1855 "plt-main.out" \
1856 ] \
1857 [list \
1858 "Run plt-main with PIE and -z bndplt -z now" \
1859 "-Wl,--no-as-needed,-z,bndplt,-z,now -pie tmpdir/plt-main1.o \
1860 tmpdir/plt-main2.o tmpdir/plt-main3.o \
1861 tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
1862 "-Wa,-mx86-used-note=yes" \
1863 { plt-main5.c } \
1864 "plt-main-pie-bnd-now" \
1865 "plt-main.out" \
1866 "-fPIC" \
1867 ] \
1868 [list \
1869 "Run pr20800" \
1870 "-Wl,-z,now -pie" \
1871 "-Wa,-mx86-used-note=yes" \
1872 { pr20800a.S pr20800b.S } \
1873 "pr20800" \
1874 "pass.out" \
1875 ] \
1876 ]
1877 if { [check_ifunc_attribute_available] } {
1878 run_ld_link_exec_tests [list \
1879 [list \
1880 "Run pr21481a" \
1881 "$NOPIE_LDFLAGS -Wl,-z,bndplt" \
1882 "-Wa,-mx86-used-note=yes" \
1883 { pr21481a.c pr21481b.S } \
1884 "pr21481a" \
1885 "pass.out" \
1886 "$NOPIE_CFLAGS" \
1887 ] \
1888 [list \
1889 "Run pr21481b" \
1890 "$NOPIE_LDFLAGS -Wl,-z,bndplt,-z,now" \
1891 "-Wa,-mx86-used-note=yes" \
1892 { pr21481a.c pr21481b.S } \
1893 "pr21481b" \
1894 "pass.out" \
1895 "$NOPIE_CFLAGS" \
1896 ] \
1897 ]
1898 }
1899 }
1900
1901 if { [istarget "x86_64-*-linux*"] } {
1902 if { [istarget "x86_64-*-linux*-gnux32"] } {
1903 set pltdump {{objdump {-drw} plt-main-ibt-x32.dd}}
1904 set pltsecdump {{readelf {-SW} plt-main-ibt-now.rd} {objdump {-drw} plt-main-ibt-x32.dd}}
1905 } else {
1906 set pltdump {{objdump {-drw} plt-main-ibt.dd}}
1907 set pltsecdump {{readelf {-SW} plt-main-ibt-now.rd} {objdump {-drw} plt-main-ibt.dd}}
1908 }
1909 run_cc_link_tests [list \
1910 [list \
1911 "Build plt-main with -z ibtplt" \
1912 "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
1913 tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt \
1914 -z noseparate-code -z max-page-size=0x200000" \
1915 "-Wa,-mx86-used-note=yes" \
1916 { plt-main5.c } \
1917 $pltdump \
1918 "plt-main-ibt" \
1919 ] \
1920 [list \
1921 "Build plt-main with PIE and -z ibtplt" \
1922 "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
1923 tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt -pie \
1924 -z noseparate-code -z max-page-size=0x200000" \
1925 "-fPIC -Wa,-mx86-used-note=yes" \
1926 { plt-main5.c } \
1927 $pltdump \
1928 "plt-main-pie-ibt" \
1929 ] \
1930 [list \
1931 "Build plt-main with -z ibtplt -z now" \
1932 "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
1933 tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt -z now \
1934 -z noseparate-code -z max-page-size=0x200000" \
1935 "-Wa,-mx86-used-note=yes" \
1936 { plt-main5.c } \
1937 $pltsecdump \
1938 "plt-main-ibt-now" \
1939 ] \
1940 [list \
1941 "Build plt-main with PIE and -z ibtplt -z now" \
1942 "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
1943 tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt -z now -pie \
1944 -z noseparate-code -z max-page-size=0x200000" \
1945 "-fPIC -Wa,-mx86-used-note=yes" \
1946 { plt-main5.c } \
1947 $pltsecdump \
1948 "plt-main-pie-ibt-now" \
1949 ] \
1950 [list \
1951 "Build libibtplt-lib.so with -z ibtplt" \
1952 "-shared -z ibtplt \
1953 -z noseparate-code -z max-page-size=0x200000" \
1954 "-fPIC -Wa,-mx86-used-note=yes" \
1955 { plt-main1.c plt-main2.c plt-main3.c plt-main4.c} \
1956 $pltdump \
1957 "libibtplt-lib.so" \
1958 ] \
1959 [list \
1960 "Build libibtplt--now-lib.so with -z ibtplt -z now" \
1961 "-shared -z ibtplt -z now \
1962 -z noseparate-code -z max-page-size=0x200000" \
1963 "-fPIC -Wa,-mx86-used-note=yes" \
1964 { plt-main1.c plt-main2.c plt-main3.c plt-main4.c} \
1965 $pltdump \
1966 "libibtplt-now-lib.so" \
1967 ] \
1968 ]
1969
1970 run_ld_link_exec_tests [list \
1971 [list \
1972 "Run plt-main with -z ibtplt" \
1973 "-Wl,--no-as-needed,-z,ibtplt tmpdir/plt-main1.o \
1974 tmpdir/plt-main2.o tmpdir/plt-main3.o \
1975 tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
1976 "-Wa,-mx86-used-note=yes" \
1977 { plt-main5.c } \
1978 "plt-main-ibt" \
1979 "plt-main.out" \
1980 ] \
1981 [list \
1982 "Run plt-main with PIE and -z ibtplt" \
1983 "-Wl,--no-as-needed,-z,ibtplt -pie tmpdir/plt-main1.o \
1984 tmpdir/plt-main2.o tmpdir/plt-main3.o \
1985 tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
1986 "-Wa,-mx86-used-note=yes" \
1987 { plt-main5.c } \
1988 "plt-main-pie-ibt" \
1989 "plt-main.out" \
1990 "-fPIC" \
1991 ] \
1992 [list \
1993 "Run plt-main with -z ibtplt -z now" \
1994 "-Wl,--no-as-needed,-z,ibtplt,-z,now tmpdir/plt-main1.o \
1995 tmpdir/plt-main2.o tmpdir/plt-main3.o \
1996 tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
1997 "-Wa,-mx86-used-note=yes" \
1998 { plt-main5.c } \
1999 "plt-main-ibt-now" \
2000 "plt-main.out" \
2001 ] \
2002 [list \
2003 "Run plt-main with PIE and -z ibtplt -z now" \
2004 "-Wl,--no-as-needed,-z,ibtplt,-z,now -pie tmpdir/plt-main1.o \
2005 tmpdir/plt-main2.o tmpdir/plt-main3.o \
2006 tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
2007 "-Wa,-mx86-used-note=yes" \
2008 { plt-main5.c } \
2009 "plt-main-pie-ibt-now" \
2010 "plt-main.out" \
2011 "-fPIC" \
2012 ] \
2013 [list \
2014 "Run plt-main with libibtplt-lib.so -z ibtplt" \
2015 "-Wl,--no-as-needed,-z,ibtplt tmpdir/libibtplt-lib.so \
2016 tmpdir/libplt-lib.so" \
2017 "-Wa,-mx86-used-note=yes" \
2018 { plt-main5.c } \
2019 "plt-main-ibt-lib" \
2020 "plt-main.out" \
2021 ] \
2022 [list \
2023 "Run plt-main with libibtplt-lib.so -z ibtplt -z now" \
2024 "-Wl,--no-as-needed,-z,ibtplt,-z,now \
2025 tmpdir/libibtplt-now-lib.so tmpdir/libplt-lib.so" \
2026 "-Wa,-mx86-used-note=yes" \
2027 { plt-main5.c } \
2028 "plt-main-ibt-now-lib" \
2029 "plt-main.out" \
2030 ] \
2031 ]
2032
2033 if { [check_ifunc_attribute_available] } {
2034 run_ld_link_exec_tests [list \
2035 [list \
2036 "Run pr21481a" \
2037 "$NOPIE_LDFLAGS -Wl,-z,ibtplt" \
2038 "-Wa,-mx86-used-note=yes" \
2039 { pr21481a.c pr21481b.S } \
2040 "pr21481a" \
2041 "pass.out" \
2042 "$NOPIE_CFLAGS" \
2043 ] \
2044 [list \
2045 "Run pr21481b" \
2046 "$NOPIE_LDFLAGS -Wl,-z,ibtplt,-z,now" \
2047 "-Wa,-mx86-used-note=yes" \
2048 { pr21481a.c pr21481b.S } \
2049 "pr21481b" \
2050 "pass.out" \
2051 "$NOPIE_CFLAGS" \
2052 ] \
2053 ]
2054 }
2055 }
2056
2057 undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
2058 undefined_weak "-fPIE" ""
2059 undefined_weak "-fPIE" "-pie"
2060 undefined_weak "-fPIE" "-Wl,-z,nodynamic-undefined-weak"
2061 undefined_weak "-fPIE" "-pie -Wl,-z,nodynamic-undefined-weak"
2062 }
2063
2064 if { ![istarget "x86_64-*-linux*"]} {
2065 set ASFLAGS "$saved_ASFLAGS"
2066 return
2067 }
2068
2069 run_ld_link_tests [list \
2070 [list \
2071 "basic PLT generation (-z now)" \
2072 "-z now -melf_x86_64 --hash-style=sysv tmpdir/libpltlib.so \
2073 -z noseparate-code -z max-page-size=0x200000" \
2074 "" \
2075 "--64" \
2076 {plt2.s} \
2077 {{readelf -SW plt2.rd} {objdump -dwr plt2.dd}} \
2078 "plt2" \
2079 ] \
2080 [list \
2081 "Build pr21626.so" \
2082 "-shared -melf_x86_64" \
2083 "" \
2084 "--64 -defsym __64_bit__=1 -mx86-used-note=yes" \
2085 {property-x86-3.s} \
2086 "" \
2087 "pr21626.so" \
2088 ] \
2089 [list \
2090 "Build pr21626" \
2091 "-melf_x86_64 tmpdir/pr21626.so" \
2092 "" \
2093 "--64 -mx86-used-note=yes" \
2094 {start.s foo.s} \
2095 "" \
2096 "pr21626" \
2097 ] \
2098 ]
2099
2100 # Linux only tests
2101 if { "$LD_CLASS" == "64bit" } then {
2102 # This test needs 64-bit linker.
2103 run_dump_test "pr17618"
2104 }
2105 run_dump_test "pltgot-1"
2106 run_dump_test "pltgot-2"
2107 run_dump_test "pr20830a"
2108 run_dump_test "pr20830b"
2109 run_dump_test "pr21038a"
2110 run_dump_test "pr21038b"
2111 run_dump_test "pr21038c"
2112 run_dump_test "pr20830a-now"
2113 run_dump_test "pr20830b-now"
2114 run_dump_test "pr21038a-now"
2115 run_dump_test "pr21038b-now"
2116 run_dump_test "pr21038c-now"
2117 run_dump_test "ibt-plt-1"
2118 run_dump_test "ibt-plt-1-x32"
2119 run_dump_test "ibt-plt-2a"
2120 run_dump_test "ibt-plt-2b"
2121 run_dump_test "ibt-plt-2c"
2122 run_dump_test "ibt-plt-2d"
2123 run_dump_test "ibt-plt-2a-x32"
2124 run_dump_test "ibt-plt-2b-x32"
2125 run_dump_test "ibt-plt-2c-x32"
2126 run_dump_test "ibt-plt-2d-x32"
2127 run_dump_test "ibt-plt-3a"
2128 run_dump_test "ibt-plt-3b"
2129 run_dump_test "ibt-plt-3c"
2130 run_dump_test "ibt-plt-3d"
2131 run_dump_test "ibt-plt-3a-x32"
2132 run_dump_test "ibt-plt-3b-x32"
2133 run_dump_test "ibt-plt-3c-x32"
2134 run_dump_test "ibt-plt-3d-x32"
2135
2136 set ASFLAGS "$saved_ASFLAGS"
This page took 0.070809 seconds and 3 git commands to generate.