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