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