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