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