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