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