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