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