Commit | Line | Data |
---|---|---|
37e55690 | 1 | # Expect script for ld-i386 tests |
219d1afa | 2 | # Copyright (C) 2002-2018 Free Software Foundation, Inc. |
37e55690 | 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 | |
37e55690 | 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 |
37e55690 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. | |
37e55690 JJ |
20 | # |
21 | ||
6c0d3bde L |
22 | global ASFLAGS |
23 | set saved_ASFLAGS "$ASFLAGS" | |
24 | if { [is_elf_format] \ | |
25 | && ([istarget "i?86-*-*"] || [istarget "x86_64-*-*"]) } { | |
26 | set ASFLAGS "$ASFLAGS -mx86-used-note=no" | |
27 | } | |
28 | ||
37e55690 JJ |
29 | # Test i386 linking; all types of relocs. This tests the assembler and |
30 | # tools like objdump as well as the linker. | |
31 | ||
b9201bb3 RS |
32 | if {[istarget "i?86-*-vxworks"]} { |
33 | set i386tests { | |
bab55c05 AM |
34 | {"VxWorks shared library test 1" |
35 | "-shared -Tvxworks1.ld --hash-style=sysv" "" | |
b9201bb3 | 36 | "" {vxworks1-lib.s} |
711de32c | 37 | {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd} |
e68ed250 | 38 | {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}} |
b9201bb3 | 39 | "libvxworks1.so"} |
4f471f39 | 40 | {"VxWorks executable test 1 (dynamic)" \ |
bab55c05 | 41 | "tmpdir/libvxworks1.so -Tvxworks1.ld --hash-style=sysv -q --force-dynamic" "" |
4f471f39 | 42 | "" {vxworks1.s} |
b9201bb3 RS |
43 | {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}} |
44 | "vxworks1"} | |
4f471f39 | 45 | {"VxWorks executable test 2 (dynamic)" \ |
bab55c05 | 46 | "-Tvxworks1.ld --hash-style=sysv -q --force-dynamic" "" |
4f471f39 RS |
47 | "" {vxworks2.s} |
48 | {{readelf --segments vxworks2.sd}} | |
49 | "vxworks2"} | |
50 | {"VxWorks executable test 2 (static)" | |
bab55c05 | 51 | "-Tvxworks1.ld --hash-style=sysv" "" |
4f471f39 RS |
52 | "" {vxworks2.s} |
53 | {{readelf --segments vxworks2-static.sd}} | |
54 | "vxworks2"} | |
b9201bb3 RS |
55 | } |
56 | run_ld_link_tests $i386tests | |
4f471f39 | 57 | run_dump_test "vxworks1-static" |
b9201bb3 RS |
58 | } |
59 | ||
e39e47bd | 60 | if [istarget "*-*-go32*"] { |
897aea50 | 61 | run_ld_link_tests {{"go32 stub" "" "" "" {zero.s} {} "go32stub"}} |
e39e47bd JK |
62 | |
63 | set src "tmpdir/go32stub" | |
64 | set dest "tmpdir/go32stub-copy" | |
65 | ||
66 | set test "go32 stub patch the source" | |
67 | set fi [open $src r+] | |
68 | fconfigure $fi -translation binary | |
69 | if {[read $fi 2] != "MZ"} { | |
70 | fail $test | |
71 | } else { | |
72 | pass $test | |
73 | seek $fi 0x40 | |
74 | puts -nonewline $fi "objcopy-test-go32stub" | |
75 | } | |
76 | close $fi | |
77 | ||
78 | set test "go32 stub objcopy" | |
79 | set status [remote_exec build $OBJCOPY "$OBJCOPYFLAGS $src $dest"] | |
80 | set exec_output [lindex $status 1] | |
81 | set exec_output [prune_warnings $exec_output] | |
82 | if [string match "" $exec_output] then { | |
83 | pass $test | |
84 | } else { | |
85 | send_log "$exec_output\n" | |
86 | verbose "$exec_output" 1 | |
87 | fail $test | |
88 | } | |
89 | ||
90 | # cmp would compare the whole files and some data after the initial exe | |
91 | # stub could differ. | |
92 | set test "go32 stub comparison after objcopy" | |
93 | set fi [open $src] | |
94 | fconfigure $fi -translation binary | |
95 | set src_stub [read $fi 2048] | |
96 | close $fi | |
97 | set fi [open $dest] | |
98 | fconfigure $fi -translation binary | |
99 | set dest_stub [read $fi 2048] | |
100 | close $fi | |
101 | if {$src_stub == $dest_stub} { | |
102 | pass $test | |
103 | } else { | |
104 | fail $test | |
105 | } | |
106 | } | |
107 | ||
5a68afcf | 108 | if { !([istarget "i?86-*-elf*"] |
c65c21e1 AM |
109 | || [istarget "i?86-*-linux*"] |
110 | || [istarget "i?86-*-gnu*"] | |
5a68afcf RM |
111 | || [istarget "i?86-*-nacl*"] |
112 | || [istarget "x86_64-*-nacl*"] | |
67a4f2b7 AO |
113 | || [istarget "x86_64-*-linux*"] |
114 | || [istarget "amd64-*-linux*"]) } { | |
37e55690 JJ |
115 | return |
116 | } | |
117 | ||
37e55690 | 118 | # List contains test-items with 3 items followed by 2 lists: |
897aea50 MR |
119 | # 0:name 1:ld early options 2:ld late options 3:assembler options |
120 | # 4:filenames of assembler files 5: action and options. 6: name of output file | |
37e55690 JJ |
121 | |
122 | # Actions: | |
123 | # objdump: Apply objdump options on result. Compare with regex (last arg). | |
124 | # nm: Apply nm options on result. Compare with regex (last arg). | |
125 | # readelf: Apply readelf options on result. Compare with regex (last arg). | |
126 | ||
127 | set i386tests { | |
5a68afcf | 128 | {"Helper shared library (basic PLT test)" |
897aea50 | 129 | "-shared -melf_i386" "" "--32" {pltlib.s} {} "libpltlib.so"} |
5a68afcf | 130 | {"basic PLT generation (non-PIC)" |
897aea50 | 131 | "-melf_i386 tmpdir/libpltlib.so" "" "--32" {plt.s} |
5a68afcf RM |
132 | {{objdump -drj.plt plt.pd}} "plt"} |
133 | {"basic PLT generation (PIC)" | |
897aea50 | 134 | "-shared -melf_i386 tmpdir/libpltlib.so" "" "--32" {plt-pic.s} |
5a68afcf | 135 | {{objdump -drj.plt plt-pic.pd}} "libplt-pic.so"} |
e41b3a13 | 136 | {"TLS -fpic -shared transitions" |
760b2893 L |
137 | "-shared -melf_i386 --no-ld-generated-unwind-info \ |
138 | -z noseparate-code --hash-style=sysv" "" | |
37e55690 JJ |
139 | "--32" {tlspic1.s tlspic2.s} |
140 | {{readelf -Ssrl tlspic.rd} {objdump -drj.text tlspic.dd} | |
141 | {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}} | |
142 | "libtlspic.so"} | |
6eaa7fb5 | 143 | {"TLS -fpic -shared transitions without PLT" |
760b2893 L |
144 | "-shared -melf_i386 --no-ld-generated-unwind-info \ |
145 | -z noseparate-code --hash-style=sysv" "" | |
6eaa7fb5 L |
146 | "-mrelax-relocations=yes --32" |
147 | {tlspic3.s tlspic2.s} | |
148 | {{readelf -Ssrl tlspic2.rd} {objdump -drj.text tlspic2.dd} | |
149 | {objdump -sj.got tlspic2.sd} {objdump -sj.tdata tlspic2.td}} | |
150 | "libtlspic2.so"} | |
e41b3a13 | 151 | {"TLS descriptor -fpic -shared transitions" |
760b2893 L |
152 | "-shared -melf_i386 --no-ld-generated-unwind-info \ |
153 | -z noseparate-code --hash-style=sysv" "" | |
67a4f2b7 AO |
154 | "--32" {tlsdesc.s tlspic2.s} |
155 | {{readelf -Ssrl tlsdesc.rd} {objdump -drj.text tlsdesc.dd} | |
156 | {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}} | |
157 | "libtlsdesc.so"} | |
897aea50 | 158 | {"Helper shared library" "-shared -melf_i386" "" |
37e55690 JJ |
159 | "--32" {tlslib.s} {} "libtlslib.so"} |
160 | {"TLS -fpic and -fno-pic exec transitions" | |
760b2893 L |
161 | "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info \ |
162 | -z noseparate-code --hash-style=sysv" "" | |
e41b3a13 | 163 | "--32" {tlsbinpic.s tlsbin.s} |
37e55690 JJ |
164 | {{readelf -Ssrl tlsbin.rd} {objdump -drj.text tlsbin.dd} |
165 | {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}} | |
166 | "tlsbin"} | |
6eaa7fb5 | 167 | {"TLS -fpic and -fno-pic exec transitions without PLT" |
760b2893 L |
168 | "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info \ |
169 | -z noseparate-code --hash-style=sysv" "" | |
6eaa7fb5 L |
170 | "-mrelax-relocations=yes --32" |
171 | {tlsbinpic2.s tlsbin.s} | |
172 | {{readelf -Ssrl tlsbin2.rd} {objdump -drj.text tlsbin2.dd} | |
173 | {objdump -sj.got tlsbin2.sd} {objdump -sj.tdata tlsbin2.td}} | |
174 | "tlsbin2"} | |
67a4f2b7 | 175 | {"TLS descriptor -fpic and -fno-pic exec transitions" |
760b2893 L |
176 | "-melf_i386 tmpdir/libtlslib.so --no-ld-generated-unwind-info \ |
177 | -z noseparate-code --hash-style=sysv" "" | |
e41b3a13 | 178 | "--32" {tlsbindesc.s tlsbin.s} |
67a4f2b7 AO |
179 | {{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd} |
180 | {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}} | |
181 | "tlsbindesc"} | |
897aea50 | 182 | {"TLS -fno-pic -shared" |
760b2893 L |
183 | "-shared -melf_i386 --no-ld-generated-unwind-info \ |
184 | -z noseparate-code --hash-style=sysv" "" | |
37e55690 JJ |
185 | "--32" {tlsnopic1.s tlsnopic2.s} |
186 | {{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd} | |
187 | {objdump -sj.got tlsnopic.sd}} "libtlsnopic.so"} | |
67a4f2b7 | 188 | {"TLS with global dynamic and descriptors" |
760b2893 L |
189 | "-shared -melf_i386 --no-ld-generated-unwind-info \ |
190 | -z noseparate-code --hash-style=sysv" "" | |
e41b3a13 | 191 | "--32" {tlsgdesc.s} |
67a4f2b7 AO |
192 | {{readelf -Ssrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}} |
193 | "libtlsgdesc.so"} | |
897aea50 | 194 | {"TLS in debug sections" "-melf_i386" "" |
a45bb67d JJ |
195 | "--32" {tlsg.s} |
196 | {{objdump -sj.debug_foobar tlsg.sd}} "tlsg"} | |
897aea50 | 197 | {"TLS @indntpoff with %eax" "-melf_i386" "" "--32" {tlsindntpoff.s} |
7c445aa3 | 198 | {{objdump -drj.text tlsindntpoff.dd}} "tlsindntpoff"} |
897aea50 | 199 | {"Reloc section order" "-shared -melf_i386 -z nocombreloc" "" "--32" |
4565652e | 200 | {reloc.s} {{objdump -hw reloc.d}} "reloc.so"} |
897aea50 | 201 | {"Basic --emit-relocs support" "-shared -melf_i386 --emit-relocs" "" "--32" |
5a68afcf | 202 | {emit-relocs.s} {{readelf --relocs emit-relocs.rd}} "emit-relocs.so"} |
897aea50 | 203 | {"-z combreloc relocation sections" "-shared -melf_i386 -z combreloc" "" |
2030e6d7 | 204 | "--32" {combreloc.s} {{readelf -r combreloc.d}} "combreloc.so"} |
897aea50 | 205 | {"TLS GD->LE transition" "-melf_i386" "" |
a3fadc9a L |
206 | "--32" {tlsgd1.s} |
207 | {{objdump -dwr tlsgd1.dd}} "tlsgd1"} | |
6eaa7fb5 L |
208 | {"TLS GD->LE transition without PLT" "-melf_i386" "" |
209 | "-mrelax-relocations=yes --32" | |
210 | {tlsgd3.s} | |
211 | {{objdump -dwr tlsgd3.dd}} "tlsgd3"} | |
897aea50 | 212 | {"TLS LD->LE transition" "-melf_i386" "" |
a3fadc9a L |
213 | "--32" {tlsld1.s} |
214 | {{objdump -dwr tlsld1.dd}} "tlsld1"} | |
6eaa7fb5 L |
215 | {"TLS LD->LE transition without PLT" "-melf_i386" "" |
216 | "-mrelax-relocations=yes --32" | |
217 | {tlsld2.s} | |
218 | {{objdump -dwr tlsld2.dd}} "tlsld2"} | |
897aea50 | 219 | {"TLS IE->LE transition" "-melf_i386" "" |
dd1093aa L |
220 | "--32" {tlsie1.s} |
221 | {{objdump -dwr tlsie1.dd}} "tlsie1"} | |
29a9f53e | 222 | {"PR ld/17313 (1)" "-melf_i386" "" |
6c0d3bde | 223 | "--32 -mx86-used-note=yes" {zero.s} {} ""} |
29a9f53e | 224 | {"PR ld/17313 (2)" "-melf_i386 -shared --just-symbols=tmpdir/zero.o" "" |
6c0d3bde | 225 | "--32 -mx86-used-note=yes" {lea1.s} {} "libpr17313.so"} |
c8831961 | 226 | {"PR ld/17306 (1)" "-melf_i386" "" |
6c0d3bde | 227 | "--32 -mx86-used-note=yes" {pr17306b.s} {} ""} |
c8831961 | 228 | {"PR ld/17306 (2)" "-melf_i386 -shared -Bsymbolic --just-symbols=tmpdir/pr17306b.o" "" |
6c0d3bde | 229 | "--32 -mx86-used-note=yes" {pr17306a.s} {} "libpr17306.so"} |
f7483970 | 230 | {"PR ld/17709 (1)" "-melf_i386 -shared" "" |
6c0d3bde | 231 | "--32 -mx86-used-note=yes" {pr17709a.s} {} "libpr17709.so"} |
f7483970 | 232 | {"PR ld/17709 (2)" "-melf_i386 tmpdir/libpr17709.so" "" |
6c0d3bde L |
233 | "--32 -mx86-used-note=yes" |
234 | {pr17709b.s} {{readelf -r pr17709.rd}} "pr17709"} | |
4e0c91e4 | 235 | {"Build pr19827a.o" "" "" |
6c0d3bde | 236 | "--32 -mx86-used-note=yes" { pr19827a.S }} |
4e0c91e4 | 237 | {"Build pr19827b.so" "-melf_i386 -shared" "" |
6c0d3bde L |
238 | "--32 -mx86-used-note=yes" |
239 | { pr19827b.S } {} "pr19827b.so"} | |
4e0c91e4 | 240 | {"Build pr19827" "-melf_i386 -pie tmpdir/pr19827a.o tmpdir/pr19827b.so" "" |
6c0d3bde L |
241 | "--32 -mx86-used-note=yes" |
242 | { dummy.s } {{readelf {-rW} pr19827.rd}} "pr19827"} | |
4e0c91e4 | 243 | {"Build pr19827.so" "-melf_i386 -shared -Bsymbolic" "" |
6c0d3bde L |
244 | "--32 -mx86-used-note=yes" |
245 | { pr19827a.S } {{readelf {-rW} pr19827.rd}} "pr19827.so"} | |
37e55690 JJ |
246 | } |
247 | ||
5a68afcf RM |
248 | # So as to avoid rewriting every last test case here in a nacl variant, |
249 | # we use black magic to massage the generic cases into nacl-variant cases. | |
250 | if [istarget "*-*-nacl*"] { | |
251 | # Change all the -melf_i386 to -melf_i386_nacl so linking can succeed. | |
252 | regsub -all elf_i386 $i386tests elf_i386_nacl i386tests | |
253 | ||
254 | # Same, applied to all the run_dump_test cases. | |
761e2bd4 | 255 | set options_regsub(ld) {elf_i386 elf_i386_nacl} |
5a68afcf RM |
256 | |
257 | # The section/segment layout differs too much for the vanilla | |
258 | # readelf output files to match. So massage the cases so that | |
259 | # they refer to a foo-nacl.rd file instead of a foo.rd file. | |
260 | regsub -all {([a-z0-9]+)\.rd} $i386tests {\1-nacl.rd} i386tests | |
261 | ||
262 | # Likewise for PLTs. | |
263 | regsub -all -- {([a-z0-9]+)\.pd} $i386tests {\1-nacl.pd} i386tests | |
264 | } | |
265 | ||
7e0a8112 L |
266 | proc iamcu_tests {} { |
267 | if {[istarget "*-*-nacl*"]} then { | |
268 | return | |
269 | } | |
270 | ||
271 | global as | |
272 | global srcdir | |
273 | global subdir | |
274 | ||
275 | if ![ld_assemble $as "--32 -march=iamcu $srcdir/$subdir/start.s" tmpdir/startiamcu.o] { | |
276 | unresolved "Build Intel MCU start.o" | |
277 | return | |
278 | } | |
279 | ||
280 | if ![ld_assemble $as "--32 $srcdir/$subdir/start.s" tmpdir/start32.o] { | |
281 | unresolved "Build ia32 start.o" | |
282 | return | |
283 | } | |
284 | ||
285 | if ![ld_assemble $as "--32 -march=iamcu $srcdir/$subdir/foo.s" tmpdir/fooiamcu.o] { | |
286 | unresolved "Build Intel MCU foo.o" | |
287 | return | |
288 | } | |
289 | ||
290 | if ![ld_assemble $as "--32 $srcdir/$subdir/foo.s" tmpdir/foo32.o] { | |
291 | unresolved "Build ia32 foo.o" | |
292 | return | |
293 | } | |
294 | ||
295 | run_dump_test "abs-iamcu" | |
296 | run_dump_test "iamcu-1" | |
297 | run_dump_test "iamcu-2" | |
298 | run_dump_test "iamcu-3" | |
5197d474 | 299 | run_dump_test "iamcu-4" |
7e0a8112 L |
300 | } |
301 | ||
302 | iamcu_tests | |
303 | ||
37e55690 | 304 | run_ld_link_tests $i386tests |
ac2aa337 JB |
305 | |
306 | run_dump_test "abs" | |
307 | run_dump_test "pcrel8" | |
308 | run_dump_test "pcrel16" | |
ab96bf03 | 309 | run_dump_test "pcrel16abs" |
0920dee7 | 310 | run_dump_test "alloc" |
9267588c | 311 | run_dump_test "warn1" |
4c544807 | 312 | run_dump_test "tlsgd2" |
6eaa7fb5 | 313 | run_dump_test "tlsgd4" |
dd1093aa L |
314 | run_dump_test "tlsie2" |
315 | run_dump_test "tlsie3" | |
316 | run_dump_test "tlsie4" | |
317 | run_dump_test "tlsie5" | |
41bed6dd L |
318 | run_dump_test "hidden1" |
319 | run_dump_test "hidden2" | |
320 | run_dump_test "hidden3" | |
321 | run_dump_test "protected1" | |
322 | run_dump_test "protected2" | |
323 | run_dump_test "protected3" | |
bdb892b9 L |
324 | run_dump_test "protected4" |
325 | run_dump_test "protected5" | |
e3c0e327 | 326 | run_dump_test "protected6a" |
889c2a67 | 327 | run_dump_test "protected6b" |
73784fa5 | 328 | run_dump_test "protected7" |
1d85728f | 329 | run_dump_test "tlspie1" |
959b0961 | 330 | run_dump_test "tlspie2" |
6eaa7fb5 L |
331 | run_dump_test "tlspie3a" |
332 | run_dump_test "tlspie3b" | |
333 | run_dump_test "tlspie3c" | |
a7b16ceb | 334 | run_dump_test "nogot1" |
0629d0af | 335 | run_dump_test "nogot2" |
56d4289c | 336 | run_dump_test "discarded1" |
2abca860 | 337 | run_dump_test "pr12718" |
a81aeffc | 338 | run_dump_test "pr12921" |
2fe0fd06 L |
339 | run_dump_test "pr12570a" |
340 | run_dump_test "pr12570b" | |
80d87326 L |
341 | run_dump_test "lea1a" |
342 | run_dump_test "lea1b" | |
343 | run_dump_test "lea1c" | |
daa67607 L |
344 | run_dump_test "lea1d" |
345 | run_dump_test "lea1e" | |
346 | run_dump_test "lea1f" | |
3f65f599 L |
347 | run_dump_test "mov1a" |
348 | run_dump_test "mov1b" | |
02e2aef8 L |
349 | run_dump_test "mov2a" |
350 | run_dump_test "mov2b" | |
351 | run_dump_test "mov3" | |
02a86693 L |
352 | run_dump_test "branch1" |
353 | run_dump_test "call1" | |
354 | run_dump_test "call2" | |
caa65211 L |
355 | run_dump_test "call3a" |
356 | run_dump_test "call3b" | |
357 | run_dump_test "call3c" | |
358 | run_dump_test "call3d" | |
359 | run_dump_test "call3e" | |
360 | run_dump_test "call3f" | |
361 | run_dump_test "call3g" | |
362 | run_dump_test "call3h" | |
02a86693 L |
363 | run_dump_test "jmp1" |
364 | run_dump_test "jmp2" | |
365 | run_dump_test "load1" | |
caa65211 | 366 | run_dump_test "load1-nacl" |
02a86693 L |
367 | run_dump_test "load2" |
368 | run_dump_test "load3" | |
369 | run_dump_test "load4a" | |
370 | run_dump_test "load4b" | |
371 | run_dump_test "load5a" | |
372 | run_dump_test "load5b" | |
373 | run_dump_test "load6" | |
2856a627 | 374 | run_dump_test "load7" |
7b7e7f1d | 375 | run_dump_test "pr19175" |
e20365c5 | 376 | run_dump_test "pr19615" |
aec6b87e L |
377 | run_dump_test "pr19636-1a" |
378 | run_dump_test "pr19636-1b" | |
379 | run_dump_test "pr19636-1c" | |
380 | run_dump_test "pr19636-1d" | |
381 | run_dump_test "pr19636-1d-nacl" | |
382 | run_dump_test "pr19636-1e" | |
383 | run_dump_test "pr19636-1f" | |
384 | run_dump_test "pr19636-1g" | |
385 | run_dump_test "pr19636-1h" | |
386 | run_dump_test "pr19636-1i" | |
853ee16f L |
387 | run_dump_test "pr19636-1j" |
388 | run_dump_test "pr19636-1k" | |
389 | run_dump_test "pr19636-1l" | |
aec6b87e L |
390 | run_dump_test "pr19636-2a" |
391 | run_dump_test "pr19636-2b" | |
392 | run_dump_test "pr19636-2c" | |
393 | run_dump_test "pr19636-2c-nacl" | |
394 | run_dump_test "pr19636-2d" | |
395 | run_dump_test "pr19636-2d-nacl" | |
396 | run_dump_test "pr19636-2e" | |
bf52d7c7 | 397 | run_dump_test "pr19636-2e-nacl" |
aec6b87e L |
398 | run_dump_test "pr19636-3a" |
399 | run_dump_test "pr19636-3b" | |
400 | run_dump_test "pr19636-3c" | |
401 | run_dump_test "pr19636-3d" | |
402 | run_dump_test "pr19636-3e" | |
403 | run_dump_test "pr19636-3f" | |
404 | run_dump_test "pr19636-3g" | |
853ee16f L |
405 | run_dump_test "pr19636-3h" |
406 | run_dump_test "pr19636-3i" | |
aec6b87e L |
407 | run_dump_test "pr19636-4a" |
408 | run_dump_test "pr19636-4b" | |
409 | run_dump_test "pr19636-4c" | |
410 | run_dump_test "pr19636-4d" | |
b8871f35 | 411 | run_dump_test "pr19645" |
bae420ef L |
412 | run_dump_test "pr19609-1a" |
413 | run_dump_test "pr19609-1b" | |
414 | run_dump_test "pr19609-1c" | |
415 | run_dump_test "pr19609-1d" | |
416 | run_dump_test "pr19609-1e" | |
417 | run_dump_test "pr19609-1f" | |
418 | run_dump_test "pr19609-1g" | |
419 | run_dump_test "pr19609-1h" | |
420 | run_dump_test "pr19609-1i" | |
421 | run_dump_test "pr19609-2a" | |
422 | run_dump_test "pr19609-2b" | |
423 | run_dump_test "pr19609-2c" | |
424 | run_dump_test "undefweaka" | |
425 | run_dump_test "undefweakb" | |
3ab94f96 | 426 | run_dump_test "pr19539" |
7d4d9709 | 427 | run_dump_test "pr20117" |
74d7f0aa L |
428 | run_dump_test "pr20244-1a" |
429 | run_dump_test "pr20244-1b" | |
430 | run_dump_test "pr20244-1c" | |
712ec279 L |
431 | run_dump_test "pr20244-2a" |
432 | run_dump_test "pr20244-2b" | |
433 | run_dump_test "pr20244-2c" | |
434 | run_dump_test "pr20244-2d" | |
a5def14f L |
435 | run_dump_test "pr20244-4a" |
436 | run_dump_test "pr20244-4b" | |
437 | run_dump_test "pr20244-4c" | |
233cc9c1 L |
438 | run_dump_test "pr20253-3" |
439 | run_dump_test "pr20253-4a" | |
440 | run_dump_test "pr20253-4b" | |
441 | run_dump_test "pr20253-4c" | |
442 | run_dump_test "pr20253-5" | |
74437ea2 | 443 | run_dump_test "pr20515" |
73caa85d | 444 | run_dump_test "property-x86-3" |
92f7d783 L |
445 | run_dump_test "property-x86-4a" |
446 | run_dump_test "property-x86-4b" | |
90c745dc | 447 | run_dump_test "property-x86-5" |
ee2fdd6f L |
448 | run_dump_test "property-x86-ibt1a" |
449 | run_dump_test "property-x86-ibt1b" | |
450 | run_dump_test "property-x86-ibt2" | |
451 | run_dump_test "property-x86-ibt3a" | |
452 | run_dump_test "property-x86-ibt3b" | |
453 | run_dump_test "property-x86-ibt4" | |
454 | run_dump_test "property-x86-ibt5" | |
48580982 L |
455 | run_dump_test "property-x86-shstk1a" |
456 | run_dump_test "property-x86-shstk1b" | |
457 | run_dump_test "property-x86-shstk2" | |
458 | run_dump_test "property-x86-shstk3a" | |
459 | run_dump_test "property-x86-shstk3b" | |
460 | run_dump_test "property-x86-shstk4" | |
461 | run_dump_test "property-x86-shstk5" | |
89d249d2 L |
462 | run_dump_test "pie1" |
463 | run_dump_test "pie1-nacl" | |
9593aade | 464 | run_dump_test "pr21884" |
34c4758c | 465 | run_dump_test "pr21884-nacl" |
0a27fed7 L |
466 | run_dump_test "pr22115-1a" |
467 | run_dump_test "pr22115-1b" | |
468 | run_dump_test "pr22115-1c" | |
469 | run_dump_test "pr22115-1d" | |
5e5e02ae | 470 | run_dump_test "pr22135" |
cd048363 | 471 | run_dump_test "pr22782" |
347a8774 | 472 | run_dump_test "pr22929" |
941036f4 | 473 | run_dump_test "pr23189" |
97373b2e | 474 | run_dump_test "pr23194" |
56ad703d L |
475 | run_dump_test "pr23372a" |
476 | run_dump_test "pr23372b" | |
a9eafb08 L |
477 | run_dump_test "pr23372c" |
478 | run_dump_test "pr23372d" | |
f7309df2 L |
479 | run_dump_test "pr23486a" |
480 | run_dump_test "pr23486b" | |
a9eafb08 L |
481 | run_dump_test "pr23486c" |
482 | run_dump_test "pr23486d" | |
25d17eb4 L |
483 | |
484 | if { !([istarget "i?86-*-linux*"] | |
5940a93c | 485 | || [istarget "i?86-*-gnu*"] |
5a68afcf RM |
486 | || [istarget "i?86-*-nacl*"] |
487 | || [istarget "x86_64-*-nacl*"] | |
25d17eb4 | 488 | || [istarget "x86_64-*-linux*"]) } { |
6c0d3bde | 489 | set ASFLAGS "$saved_ASFLAGS" |
25d17eb4 L |
490 | return |
491 | } | |
492 | ||
493 | run_dump_test "compressed1" | |
a3293649 | 494 | run_dump_test "pr12627" |
98920172 | 495 | run_dump_test "pr13302" |
17d6eea5 | 496 | run_dump_test "pr14215" |
998d811a | 497 | run_dump_test "pr17057" |
1952c5cd L |
498 | run_dump_test "pr17935-1" |
499 | run_dump_test "pr17935-2" | |
8efa2874 | 500 | run_dump_test "pr18801" |
13a2df29 | 501 | run_dump_test "pr18815" |
2df3368d L |
502 | run_dump_test "pr19939a" |
503 | run_dump_test "pr19939b" | |
97d343d4 | 504 | run_dump_test "tlsdesc2" |
4a7a7923 | 505 | |
aec6b87e L |
506 | proc undefined_weak {cflags ldflags} { |
507 | set testname "Undefined weak symbol" | |
508 | if { ![ string match "" $cflags$ldflags] } { | |
509 | set testname "$testname ($cflags $ldflags)" | |
510 | } | |
511 | ||
074f6066 L |
512 | if { [string match "*-fPIE*" $cflags] |
513 | && ![string match "*-z nodynamic-undefined-weak*" $ldflags] } { | |
aec6b87e L |
514 | set weak_symbol "Weak defined" |
515 | } else { | |
516 | set weak_symbol "Weak undefined" | |
517 | } | |
518 | ||
519 | run_cc_link_tests [list \ | |
520 | [list \ | |
521 | "Build libpr19704a.so" \ | |
522 | "-shared -Wl,-soname,libpr19704.so" \ | |
6c0d3bde | 523 | "-Wa,-mrelax-relocations=yes" \ |
aec6b87e L |
524 | { dummy.s } \ |
525 | {} \ | |
526 | "libpr19704a.so" \ | |
527 | ] \ | |
528 | [list \ | |
529 | "Build libpr19704b.so" \ | |
530 | "-shared -Wl,-soname,libpr19704.so" \ | |
6c0d3bde | 531 | "-fPIC -Wa,-mrelax-relocations=yes" \ |
aec6b87e L |
532 | { pr19704b.c } \ |
533 | {} \ | |
534 | "libpr19704b.so" \ | |
535 | ] \ | |
536 | ] | |
537 | ||
538 | exec cp tmpdir/libpr19704a.so tmpdir/libpr19704.so | |
539 | ||
982c6f26 | 540 | run_ld_link_exec_tests [list \ |
aec6b87e L |
541 | [list \ |
542 | "Run pr19704" \ | |
e9237227 | 543 | "$ldflags tmpdir/libpr19704.so -Wl,-R,tmpdir" \ |
6c0d3bde | 544 | "-Wa,-mrelax-relocations=yes" \ |
aec6b87e L |
545 | { pr19704a.c } \ |
546 | "pr19704" \ | |
547 | "pr19704.out" \ | |
548 | "$cflags" \ | |
549 | ] \ | |
550 | ] | |
551 | ||
552 | exec cp tmpdir/libpr19704b.so tmpdir/libpr19704.so | |
553 | ||
554 | set exec_output [run_host_cmd tmpdir/pr19704 ""] | |
555 | if {![string match $weak_symbol $exec_output]} { | |
556 | fail $testname | |
557 | } else { | |
558 | pass $testname | |
559 | } | |
560 | } | |
561 | ||
ea9fb8b3 L |
562 | # Add $PLT_CFLAGS if PLT is expected. |
563 | global PLT_CFLAGS | |
564 | ||
4a7a7923 L |
565 | # Must be Linux native with the C compiler |
566 | if { [isnative] | |
567 | && [istarget "i?86-*-linux*"] | |
568 | && [which $CC] != 0 } { | |
569 | run_cc_link_tests [list \ | |
570 | [list \ | |
571 | "Build plt-lib.so" \ | |
572 | "-shared" \ | |
6c0d3bde | 573 | "-fPIC -Wa,-mrelax-relocations=yes" \ |
4a7a7923 L |
574 | { plt-lib.c } \ |
575 | {} \ | |
576 | "libplt-lib.so" \ | |
577 | ] \ | |
578 | [list \ | |
579 | "Build libplt-main1.a" \ | |
580 | "" \ | |
6c0d3bde | 581 | "-fPIC -Wa,-mrelax-relocations=yes,-mrelax-relocations=yes" \ |
4a7a7923 L |
582 | { plt-main1.c } \ |
583 | {{readelf {-Wr} plt-main1.rd}} \ | |
584 | "libplt-main1.a" \ | |
585 | ] \ | |
586 | [list \ | |
587 | "Build libplt-main2.a" \ | |
588 | "" \ | |
6c0d3bde | 589 | "-fPIC -Wa,-mrelax-relocations=yes,-mrelax-relocations=yes" \ |
4a7a7923 L |
590 | { plt-main2.c } \ |
591 | {{readelf {-Wr} plt-main2.rd}} \ | |
592 | "libplt-main2.a" \ | |
593 | ] \ | |
594 | [list \ | |
595 | "Build libplt-main3.a" \ | |
596 | "" \ | |
6c0d3bde | 597 | "-fPIC -Wa,-mrelax-relocations=yes,-mrelax-relocations=yes $PLT_CFLAGS" \ |
4a7a7923 L |
598 | { plt-main3.c } \ |
599 | {{readelf {-Wr} plt-main3.rd}} \ | |
600 | "libplt-main3.a" \ | |
601 | ] \ | |
602 | [list \ | |
603 | "Build libplt-main4.a" \ | |
604 | "" \ | |
6c0d3bde | 605 | "-fPIC -Wa,-mrelax-relocations=yes,-mrelax-relocations=yes $PLT_CFLAGS" \ |
4a7a7923 L |
606 | { plt-main4.c } \ |
607 | {{readelf {-Wr} plt-main4.rd}} \ | |
608 | "libplt-main4.a" \ | |
609 | ] \ | |
dd7e64d4 L |
610 | [list \ |
611 | "Build plt-main" \ | |
612 | "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ | |
613 | tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ | |
6c0d3bde | 614 | "-Wa,-mrelax-relocations=yes" \ |
dd7e64d4 L |
615 | { plt-main5.c } \ |
616 | {{readelf {-Wr} plt-main.rd}} \ | |
617 | "plt-main" \ | |
618 | ] \ | |
619 | [list \ | |
620 | "Build plt-main with PIE" \ | |
621 | "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ | |
622 | tmpdir/plt-main4.o tmpdir/libplt-lib.so -pie" \ | |
6c0d3bde | 623 | "-fPIC -Wa,-mrelax-relocations=yes" \ |
dd7e64d4 L |
624 | { plt-main5.c } \ |
625 | {{readelf {-Wr} plt-main.rd}} \ | |
626 | "plt-main" \ | |
627 | ] \ | |
d5597ebc L |
628 | [list \ |
629 | "Build copyreloc-lib.so" \ | |
630 | "-shared" \ | |
6c0d3bde | 631 | "-fPIC -Wa,-mrelax-relocations=yes" \ |
d5597ebc L |
632 | { copyreloc-lib.c } \ |
633 | {} \ | |
634 | "copyreloc-lib.so" \ | |
635 | ] \ | |
636 | [list \ | |
46175b4e L |
637 | "Build libcopyreloc-main.a" \ |
638 | "" \ | |
6c0d3bde | 639 | "-Wa,-mrelax-relocations=yes" \ |
d5597ebc | 640 | { copyreloc-main.S } \ |
46175b4e L |
641 | {} \ |
642 | "libcopyreloc-main.a" \ | |
643 | ] \ | |
644 | [list \ | |
645 | "Build copyreloc-main with PIE and GOTOFF (1)" \ | |
646 | "tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so -pie" \ | |
6c0d3bde | 647 | "-Wa,-mrelax-relocations=yes" \ |
46175b4e | 648 | { dummy.s } \ |
d5597ebc L |
649 | {{readelf {-Wr} copyreloc-main1.rd}} \ |
650 | "copyreloc-main" \ | |
651 | ] \ | |
652 | [list \ | |
653 | "Build copyreloc-main with PIE and GOTOFF (2)" \ | |
46175b4e | 654 | "tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so -pie" \ |
6c0d3bde | 655 | "-Wa,-mrelax-relocations=yes" \ |
46175b4e | 656 | { dummy.s } \ |
d5597ebc L |
657 | {{readelf {-Wr} copyreloc-main2.rd}} \ |
658 | "copyreloc-main" \ | |
659 | ] \ | |
660 | [list \ | |
661 | "Build pr17689.so" \ | |
662 | "-shared" \ | |
6c0d3bde | 663 | "-fPIC -Wa,-mrelax-relocations=yes" \ |
d5597ebc L |
664 | { pr17689a.c } \ |
665 | {} \ | |
666 | "pr17689.so" \ | |
667 | ] \ | |
25070364 L |
668 | [list \ |
669 | "Build pr17689.so with -z now" \ | |
670 | "-shared -Wl,-z,now" \ | |
6c0d3bde | 671 | "-fPIC -Wa,-mrelax-relocations=yes" \ |
25070364 L |
672 | { pr17689a.c } \ |
673 | {{readelf {-Wr} pr17689now.rd}} \ | |
674 | "pr17689now.so" \ | |
675 | ] \ | |
d5597ebc L |
676 | [list \ |
677 | "Build pr17689ver.so" \ | |
678 | "-shared -Wl,--version-script,pr17689a.t" \ | |
6c0d3bde | 679 | "-fPIC -Wa,-mrelax-relocations=yes" \ |
d5597ebc L |
680 | { pr17689a.c } \ |
681 | {} \ | |
682 | "pr17689ver.so" \ | |
683 | ] \ | |
684 | [list \ | |
685 | "Build pr17689.a" \ | |
686 | "" \ | |
6c0d3bde | 687 | "-Wa,-mrelax-relocations=yes" \ |
d5597ebc L |
688 | { pr17689b.S } \ |
689 | {} \ | |
690 | "pr17689.a" \ | |
691 | ] \ | |
692 | [list \ | |
693 | "Build pr17689 with PIE and GOTOFF" \ | |
694 | "tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \ | |
6c0d3bde | 695 | "-Wa,-mrelax-relocations=yes" \ |
d5597ebc L |
696 | { dummy.c } \ |
697 | {{readelf {-Wr} pr17689.rd}} \ | |
698 | "pr17689" \ | |
699 | ] \ | |
25070364 L |
700 | [list \ |
701 | "Build pr17689 with PIE, -z now and GOTOFF" \ | |
702 | "tmpdir/pr17689b.o tmpdir/pr17689.so -pie -Wl,-z,now" \ | |
6c0d3bde | 703 | "-Wa,-mrelax-relocations=yes" \ |
25070364 L |
704 | { dummy.c } \ |
705 | {{readelf {-Wr} pr17689now.rd}} \ | |
706 | "pr17689now" \ | |
707 | ] \ | |
d5597ebc L |
708 | [list \ |
709 | "Build pr17689ver with PIE and GOTOFF" \ | |
710 | "tmpdir/pr17689b.o tmpdir/pr17689ver.so -pie" \ | |
6c0d3bde | 711 | "-Wa,-mrelax-relocations=yes" \ |
d5597ebc L |
712 | { dummy.c } \ |
713 | {{readelf {-Wr} pr17689ver.rd}} \ | |
714 | "pr17689ver" \ | |
715 | ] \ | |
716 | [list \ | |
717 | "Build pr17827 with PIE and GOTOFF" \ | |
718 | "tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \ | |
6c0d3bde | 719 | "-Wa,-mrelax-relocations=yes" \ |
d5597ebc L |
720 | { dummy.c } \ |
721 | {{readelf {-Wr} pr17827.rd}} \ | |
722 | "pr17827" \ | |
723 | ] \ | |
04ebc307 L |
724 | [list \ |
725 | "Build pr18900.so" \ | |
726 | "-shared" \ | |
6c0d3bde | 727 | "-fPIC -Wa,-mrelax-relocations=yes" \ |
04ebc307 L |
728 | { pr18900a.c } \ |
729 | "" \ | |
730 | "pr18900.so" \ | |
731 | ] \ | |
732 | [list \ | |
23a4bd22 L |
733 | "Build pr18900.o" \ |
734 | "-r -nostdlib" \ | |
6c0d3bde | 735 | "-Wa,-mrelax-relocations=yes" \ |
04ebc307 | 736 | { pr18900b.c pr18900c.c } \ |
23a4bd22 L |
737 | "" \ |
738 | "pr18900.o" \ | |
739 | ] \ | |
740 | [list \ | |
741 | "Build pr18900a" \ | |
742 | "tmpdir/pr18900.o tmpdir/pr18900.so" \ | |
6c0d3bde | 743 | "-Wa,-mrelax-relocations=yes" \ |
23a4bd22 | 744 | { dummy.s } \ |
04ebc307 L |
745 | {{readelf {-Wrd} pr18900a.rd}} \ |
746 | "pr18900a" \ | |
747 | ] \ | |
748 | [list \ | |
749 | "Build pr18900b" \ | |
23a4bd22 | 750 | "-Wl,--as-needed tmpdir/pr18900.o tmpdir/pr18900.so" \ |
6c0d3bde | 751 | "-Wa,-mrelax-relocations=yes" \ |
23a4bd22 | 752 | { dummy.s } \ |
04ebc307 L |
753 | {{readelf {-Wrd} pr18900b.rd}} \ |
754 | "pr18900b" \ | |
755 | ] \ | |
4b627c18 L |
756 | [list \ |
757 | "Build pr19031.so" \ | |
758 | "-shared" \ | |
6c0d3bde | 759 | "-fPIC -Wa,-mrelax-relocations=yes" \ |
4b627c18 L |
760 | { pr19031a.c } \ |
761 | "" \ | |
762 | "pr19031.so" \ | |
763 | ] \ | |
02a86693 L |
764 | [list \ |
765 | "Build got1d.so" \ | |
766 | "-shared" \ | |
6c0d3bde | 767 | "-Wa,-mrelax-relocations=yes" \ |
02a86693 L |
768 | { got1d.S } \ |
769 | "" \ | |
770 | "got1d.so" \ | |
771 | ] \ | |
23a4bd22 L |
772 | [list \ |
773 | "Build gotpc1.o" \ | |
774 | "-r -nostdlib" \ | |
b1058ce9 | 775 | "-Wa,-mrelax-relocations=yes" \ |
23a4bd22 L |
776 | { got1a.S got1b.c got1c.c } \ |
777 | "" \ | |
778 | "gotpc1.o" \ | |
779 | ] \ | |
02a86693 L |
780 | [list \ |
781 | "Build gotpc1" \ | |
9d1c54ed | 782 | "$NOPIE_LDFLAGS -Wl,--as-needed tmpdir/gotpc1.o tmpdir/got1d.so" \ |
6c0d3bde | 783 | "-Wa,-mx86-used-note=no" \ |
23a4bd22 | 784 | { dummy.s } \ |
02a86693 L |
785 | {{objdump {-dw} got1.dd}} \ |
786 | "got1" \ | |
787 | ] \ | |
ead3d542 L |
788 | [list \ |
789 | "Build pr19319.so" \ | |
790 | "-shared" \ | |
6c0d3bde | 791 | "-Wa,-mx86-used-note=no" \ |
ead3d542 L |
792 | { pr19319a.S } \ |
793 | "" \ | |
794 | "pr19319.so" \ | |
795 | ] \ | |
796 | [list \ | |
797 | "Build pr19319" \ | |
798 | "-pie -nostdlib -nostartfiles tmpdir/pr19319.so" \ | |
b1058ce9 | 799 | "-Wa,-mrelax-relocations=yes" \ |
ead3d542 L |
800 | { pr19319b.S } \ |
801 | {{objdump {-dw} pr19319.dd}} \ | |
802 | "pr19319" \ | |
803 | ] \ | |
46bed679 L |
804 | [list \ |
805 | "Build property 1" \ | |
806 | "" \ | |
6c0d3bde | 807 | "-Wa,-mx86-used-note=no" \ |
46bed679 L |
808 | {pass.c property-no-copy.S} \ |
809 | {{readelf {-n} property-1.r}} \ | |
810 | "property-1" \ | |
811 | ] \ | |
812 | [list \ | |
813 | "Build property 1 (.o)" \ | |
814 | "-r -nostdlib" \ | |
6c0d3bde | 815 | "-Wa,-mx86-used-note=yes" \ |
46bed679 | 816 | {pass.c property-no-copy.S} \ |
6c0d3bde | 817 | {{readelf {-n} property-1a.r}} \ |
46bed679 L |
818 | "property-1.o" \ |
819 | ] \ | |
820 | [list \ | |
821 | "Build property 1 (.so)" \ | |
822 | "-shared" \ | |
6c0d3bde | 823 | "-fPIC -Wa,-mx86-used-note=no" \ |
46bed679 L |
824 | {pass.c property-no-copy.S} \ |
825 | {{readelf {-n} property-1.r}} \ | |
826 | "property-1.so" \ | |
827 | ] \ | |
828 | [list \ | |
829 | "Build property 2" \ | |
830 | "" \ | |
6c0d3bde | 831 | "-Wa,-mx86-used-note=no" \ |
46bed679 L |
832 | {pass.c property-stack.S} \ |
833 | {{readelf {-n} property-2.r}} \ | |
834 | "property-2" \ | |
835 | ] \ | |
836 | [list \ | |
837 | "Build property 2 (.o)" \ | |
838 | "-r -nostdlib" \ | |
6c0d3bde | 839 | "-Wa,-mx86-used-note=yes" \ |
46bed679 | 840 | {pass.c property-stack.S} \ |
6c0d3bde | 841 | {{readelf {-n} property-2a.r}} \ |
46bed679 L |
842 | "property-2.o" \ |
843 | ] \ | |
844 | [list \ | |
845 | "Build property 2 (.so)" \ | |
846 | "-shared" \ | |
6c0d3bde | 847 | "-fPIC -Wa,-mx86-used-note=no" \ |
46bed679 L |
848 | {pass.c property-stack.S} \ |
849 | {{readelf {-n} property-2.r}} \ | |
850 | "property-2.so" \ | |
851 | ] \ | |
852 | [list \ | |
853 | "Build property 3" \ | |
854 | "" \ | |
6c0d3bde | 855 | "-Wa,-mx86-used-note=no" \ |
46bed679 L |
856 | {pass.c property-stack.S property-x86-1.S} \ |
857 | {{readelf {-n} property-3.r}} \ | |
858 | "property-3" \ | |
859 | ] \ | |
860 | [list \ | |
861 | "Build property 3 (.o)" \ | |
862 | "-r -nostdlib" \ | |
6c0d3bde | 863 | "-Wa,-mx86-used-note=yes" \ |
46bed679 | 864 | {pass.c property-x86-1.S property-stack.S} \ |
6c0d3bde | 865 | {{readelf {-n} property-3a.r}} \ |
46bed679 L |
866 | "property-3.o" \ |
867 | ] \ | |
868 | [list \ | |
869 | "Build property 3 (.so)" \ | |
870 | "-shared" \ | |
6c0d3bde | 871 | "-fPIC -Wa,-mx86-used-note=no" \ |
46bed679 L |
872 | {property-x86-1.S pass.c property-stack.S} \ |
873 | {{readelf {-n} property-3.r}} \ | |
874 | "property-3.so" \ | |
875 | ] \ | |
876 | [list \ | |
877 | "Build property 4" \ | |
878 | "" \ | |
6c0d3bde | 879 | "-Wa,-mx86-used-note=no" \ |
46bed679 L |
880 | {pass.c property-stack.S property-x86-1.S property-x86-2.S} \ |
881 | {{readelf {-n} property-4.r}} \ | |
882 | "property-4" \ | |
883 | ] \ | |
884 | [list \ | |
885 | "Build property 4 (.o)" \ | |
886 | "-r -nostdlib" \ | |
6c0d3bde | 887 | "-Wa,-mx86-used-note=yes" \ |
46bed679 | 888 | {pass.c property-x86-2.S property-x86-1.S property-stack.S} \ |
6c0d3bde | 889 | {{readelf {-n} property-4a.r}} \ |
46bed679 L |
890 | "property-4.o" \ |
891 | ] \ | |
892 | [list \ | |
893 | "Build property 4 (.so)" \ | |
894 | "-shared" \ | |
6c0d3bde | 895 | "-fPIC -Wa,-mx86-used-note=no" \ |
46bed679 L |
896 | {property-x86-2.S property-x86-1.S pass.c property-stack.S} \ |
897 | {{readelf {-n} property-4.r}} \ | |
898 | "property-4.so" \ | |
899 | ] \ | |
900 | [list \ | |
901 | "Build property 4 (-Wl,-z,stack-size=0)" \ | |
902 | "-Wl,-z,stack-size=0" \ | |
6c0d3bde | 903 | "-Wa,-mx86-used-note=no" \ |
46bed679 L |
904 | {pass.c property-stack.S property-x86-1.S property-x86-2.S} \ |
905 | {{readelf {-n} property-4.r}} \ | |
906 | "property-4" \ | |
907 | ] \ | |
908 | [list \ | |
909 | "Build property 5" \ | |
910 | "-Wl,-z,stack-size=0x900000" \ | |
6c0d3bde | 911 | "-Wa,-mx86-used-note=no" \ |
46bed679 L |
912 | {pass.c property-stack.S property-x86-1.S property-x86-2.S} \ |
913 | {{readelf {-n} property-5.r}} \ | |
914 | "property-5" \ | |
915 | ] \ | |
916 | [list \ | |
917 | "Build property 5 (.o)" \ | |
918 | "-r -nostdlib -Wl,-z,stack-size=0x900000" \ | |
6c0d3bde | 919 | "-Wa,-mx86-used-note=yes" \ |
46bed679 | 920 | {pass.c property-x86-2.S property-x86-1.S property-stack.S} \ |
6c0d3bde | 921 | {{readelf {-n} property-5a.r}} \ |
46bed679 L |
922 | "property-5.o" \ |
923 | ] \ | |
924 | [list \ | |
925 | "Build property 5 (.so)" \ | |
926 | "-shared -Wl,-z,stack-size=0x900000" \ | |
6c0d3bde | 927 | "-fPIC -Wa,-mx86-used-note=no" \ |
46bed679 L |
928 | {property-x86-2.S property-x86-1.S pass.c property-stack.S} \ |
929 | {{readelf {-n} property-5.r}} \ | |
930 | "property-5.so" \ | |
931 | ] \ | |
932 | [list \ | |
933 | "Build property-6.so" \ | |
934 | "-shared" \ | |
6c0d3bde | 935 | "-fPIC -Wa,-mx86-used-note=no" \ |
46bed679 L |
936 | {property-6a.c property-6c.S} \ |
937 | {{readelf {-n} property-6.r}} \ | |
938 | "property-6.so" \ | |
939 | ] \ | |
940 | [list \ | |
941 | "Build property-6.o" \ | |
942 | "-r -nostdlib" \ | |
6c0d3bde | 943 | "-Wa,-mx86-used-note=yes" \ |
46bed679 | 944 | {property-6b.c property-stack.S} \ |
6c0d3bde | 945 | {{readelf {-n} property-2a.r}} \ |
46bed679 L |
946 | "property-6.o" \ |
947 | ] \ | |
948 | [list \ | |
949 | "Build property-6" \ | |
950 | "-Wl,--as-needed tmpdir/property-6.o tmpdir/property-6.so" \ | |
6c0d3bde | 951 | "-Wa,-mx86-used-note=no" \ |
46bed679 | 952 | { dummy.s } \ |
46bed679 L |
953 | {{readelf {-n} property-2.r}} \ |
954 | "property-6" \ | |
955 | ] \ | |
956 | [list \ | |
957 | "Build property 7a (.o)" \ | |
958 | "-r -nostdlib" \ | |
6c0d3bde | 959 | "-Wa,-mx86-used-note=yes" \ |
46bed679 | 960 | {property-unsorted-1.S} \ |
6c0d3bde | 961 | {{readelf {-n} property-7a.r}} \ |
46bed679 L |
962 | "property-7a.o" \ |
963 | ] \ | |
964 | [list \ | |
965 | "Build property 7b (.o)" \ | |
966 | "-r -nostdlib" \ | |
6c0d3bde | 967 | "-Wa,-mx86-used-note=yes" \ |
46bed679 | 968 | {property-unsorted-2.S} \ |
6c0d3bde | 969 | {{readelf {-n} property-7a.r}} \ |
46bed679 L |
970 | "property-7b.o" \ |
971 | ] \ | |
4a7a7923 L |
972 | ] |
973 | ||
982c6f26 | 974 | run_ld_link_exec_tests [list \ |
4a7a7923 L |
975 | [list \ |
976 | "Run plt-main" \ | |
977 | "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ | |
978 | tmpdir/plt-main4.o tmpdir/libplt-lib.so" \ | |
6c0d3bde | 979 | "-Wa,-mx86-used-note=yes" \ |
4a7a7923 L |
980 | { plt-main5.c } \ |
981 | "plt-main" \ | |
982 | "plt-main.out" \ | |
983 | ] \ | |
984 | [list \ | |
985 | "Run plt-main with PIE" \ | |
986 | "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ | |
987 | tmpdir/plt-main4.o tmpdir/libplt-lib.so -pie" \ | |
6c0d3bde | 988 | "-Wa,-mx86-used-note=yes" \ |
4a7a7923 L |
989 | { plt-main5.c } \ |
990 | "plt-main-pie" \ | |
991 | "plt-main.out" \ | |
992 | "-fPIC" \ | |
993 | ] \ | |
d5597ebc L |
994 | [list \ |
995 | "Run copyreloc-main with PIE and GOTOFF" \ | |
e9237227 | 996 | "-Wl,--as-needed tmpdir/copyreloc-main.o tmpdir/copyreloc-lib.so -pie" \ |
6c0d3bde | 997 | "-Wa,-mx86-used-note=yes" \ |
46175b4e | 998 | { dummy.s } \ |
d5597ebc L |
999 | "copyreloc-main" \ |
1000 | "copyreloc-main.out" \ | |
1001 | ] \ | |
1002 | [list \ | |
1003 | "Run pr17689 with PIE and GOTOFF" \ | |
1004 | "tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \ | |
6c0d3bde | 1005 | "-Wa,-mx86-used-note=yes" \ |
d5597ebc L |
1006 | { dummy.c } \ |
1007 | "pr17689" \ | |
1008 | "pr17689.out" \ | |
1009 | ] \ | |
25070364 L |
1010 | [list \ |
1011 | "Run pr17689 with PIE, -z now and GOTOFF" \ | |
1012 | "tmpdir/pr17689b.o tmpdir/pr17689.so -pie -z now" \ | |
6c0d3bde | 1013 | "-Wa,-mx86-used-note=yes" \ |
25070364 L |
1014 | { dummy.c } \ |
1015 | "pr17689now" \ | |
1016 | "pr17689.out" \ | |
1017 | ] \ | |
d5597ebc L |
1018 | [list \ |
1019 | "Run pr17689ver with PIE and GOTOFF" \ | |
1020 | "tmpdir/pr17689b.o tmpdir/pr17689ver.so -pie" \ | |
6c0d3bde | 1021 | "-Wa,-mx86-used-note=yes" \ |
d5597ebc L |
1022 | { dummy.c } \ |
1023 | "pr17689ver" \ | |
1024 | "pr17689.out" \ | |
1025 | ] \ | |
04ebc307 L |
1026 | [list \ |
1027 | "Run pr18900" \ | |
23a4bd22 | 1028 | "tmpdir/pr18900.o tmpdir/pr18900.so" \ |
6c0d3bde | 1029 | "-Wa,-mx86-used-note=yes" \ |
23a4bd22 | 1030 | { dummy.s } \ |
04ebc307 L |
1031 | "pr18900" \ |
1032 | "pr18900.out" \ | |
1033 | ] \ | |
4b627c18 L |
1034 | [list \ |
1035 | "Run pr19031" \ | |
329b5ba1 | 1036 | "$NOPIE_LDFLAGS tmpdir/pr19031.so" \ |
6c0d3bde | 1037 | "-Wa,-mx86-used-note=yes" \ |
4b627c18 L |
1038 | { pr19031b.S pr19031c.c } \ |
1039 | "pr19031" \ | |
1040 | "pr19031.out" \ | |
329b5ba1 | 1041 | "$NOPIE_CFLAGS" \ |
4b627c18 | 1042 | ] \ |
02a86693 L |
1043 | [list \ |
1044 | "Run got1" \ | |
9d1c54ed | 1045 | "$NOPIE_LDFLAGS tmpdir/got1d.so" \ |
6c0d3bde | 1046 | "-Wa,-mx86-used-note=yes" \ |
02a86693 L |
1047 | { got1a.S got1b.c got1c.c } \ |
1048 | "got1" \ | |
1049 | "got1.out" \ | |
1050 | ] \ | |
46bed679 L |
1051 | [list \ |
1052 | "Run property 1" \ | |
1053 | "" \ | |
6c0d3bde | 1054 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1055 | {pass.c property-no-copy.S} \ |
1056 | "property-1" "pass.out" \ | |
1057 | ] \ | |
1058 | [list \ | |
1059 | "Run property 1 (PIE)" \ | |
1060 | "-pie" \ | |
6c0d3bde | 1061 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1062 | {pass.c property-no-copy.S} \ |
1063 | "property-1-pie" "pass.out" "-fPIE" \ | |
1064 | ] \ | |
1065 | [list \ | |
1066 | "Run property 1 (static)" \ | |
1067 | "-static" \ | |
6c0d3bde | 1068 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1069 | {pass.c property-no-copy.S} \ |
1070 | "property-1-static" "pass.out" \ | |
1071 | ] \ | |
1072 | [list \ | |
1073 | "Run property 2" \ | |
1074 | "" \ | |
6c0d3bde | 1075 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1076 | {pass.c property-stack.S} \ |
1077 | "property-2" "pass.out" \ | |
1078 | ] \ | |
1079 | [list \ | |
1080 | "Run property 2 (PIE)" \ | |
1081 | "-pie" \ | |
6c0d3bde | 1082 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1083 | {pass.c property-stack.S} \ |
1084 | "property-2-pie" "pass.out" "-fPIE" \ | |
1085 | ] \ | |
1086 | [list \ | |
1087 | "Run property 2 (static)" \ | |
1088 | "-static" \ | |
6c0d3bde | 1089 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1090 | {pass.c property-stack.S} \ |
1091 | "property-3-static" "pass.out" \ | |
1092 | ] \ | |
1093 | [list \ | |
1094 | "Run property 3" \ | |
1095 | "" \ | |
6c0d3bde | 1096 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1097 | {pass.c property-stack.S property-x86-1.S} \ |
1098 | "property-3" "pass.out" \ | |
1099 | ] \ | |
1100 | [list \ | |
1101 | "Run property 3 (PIE)" \ | |
1102 | "-pie" \ | |
6c0d3bde | 1103 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1104 | {pass.c property-x86-1.S property-stack.S} \ |
1105 | "property-3-pie" "pass.out" "-fPIE" \ | |
1106 | ] \ | |
1107 | [list \ | |
1108 | "Run property 3 (static)" \ | |
1109 | "-static" \ | |
6c0d3bde | 1110 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1111 | {property-x86-1.S pass.c property-stack.S} \ |
1112 | "property-3-static" "pass.out" \ | |
1113 | ] \ | |
1114 | [list \ | |
1115 | "Run property 4" \ | |
1116 | "" \ | |
6c0d3bde | 1117 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1118 | {pass.c property-stack.S property-x86-1.S property-x86-2.S} \ |
1119 | "property-4" "pass.out" \ | |
1120 | ] \ | |
1121 | [list \ | |
1122 | "Run property 4 (PIE)" \ | |
1123 | "-pie" \ | |
6c0d3bde | 1124 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1125 | {pass.c property-x86-2.S property-x86-1.S property-stack.S} \ |
1126 | "property-4-pie" "pass.out" "-fPIE" \ | |
1127 | ] \ | |
1128 | [list \ | |
1129 | "Run property 4 (static)" \ | |
1130 | "-static" \ | |
6c0d3bde | 1131 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1132 | {property-x86-2.S property-x86-1.S pass.c property-stack.S} \ |
1133 | "property-4-static" "pass.out" \ | |
1134 | ] \ | |
1135 | [list \ | |
1136 | "Run property 5" \ | |
1137 | "-Wl,-z,stack-size=0x900000" \ | |
6c0d3bde | 1138 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1139 | {pass.c property-stack.S property-x86-1.S property-x86-2.S} \ |
1140 | "property-5" "pass.out" \ | |
1141 | ] \ | |
1142 | [list \ | |
1143 | "Run property 5 (PIE)" \ | |
1144 | "-pie -Wl,-z,stack-size=0x900000" \ | |
6c0d3bde | 1145 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1146 | {pass.c property-x86-2.S property-x86-1.S property-stack.S} \ |
1147 | "property-5-pie" "pass.out" "-fPIE" \ | |
1148 | ] \ | |
1149 | [list \ | |
1150 | "Run property 5 (static)" \ | |
1151 | "-static -Wl,-z,stack-size=0x900000" \ | |
6c0d3bde | 1152 | "-Wa,-mx86-used-note=yes" \ |
46bed679 L |
1153 | {property-x86-2.S property-x86-1.S pass.c property-stack.S} \ |
1154 | "property-5-static" "pass.out" \ | |
1155 | ] \ | |
4a7a7923 | 1156 | ] |
aec6b87e | 1157 | |
9d1c54ed L |
1158 | undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" |
1159 | undefined_weak "-fPIE" "$NOPIE_LDFLAGS" | |
aec6b87e | 1160 | undefined_weak "-fPIE" "-pie" |
9d1c54ed | 1161 | undefined_weak "-fPIE" "-z nodynamic-undefined-weak $NOPIE_LDFLAGS" |
aec6b87e | 1162 | undefined_weak "-fPIE" "-pie -z nodynamic-undefined-weak" |
4a7a7923 | 1163 | } |
a3747075 | 1164 | |
9d1c54ed | 1165 | global NOPIE_CFLAGS NOPIE_LDFLAGS |
ee2fdd6f | 1166 | |
ca8c86ef L |
1167 | # Must be native with the C compiler and working IFUNC support, |
1168 | if { [isnative] | |
1169 | && [check_ifunc_available] | |
1170 | && [istarget "i?86-*-*"] | |
1171 | && [which $CC] != 0 } { | |
1172 | run_cc_link_tests [list \ | |
1173 | [list \ | |
1174 | "Build ifunc-1a.o ifunc-1b.o ifunc-1c.o ifunc-1d.o" \ | |
1175 | "" \ | |
6c0d3bde | 1176 | "-fPIC -O2 -g -Wa,-mx86-used-note=yes" \ |
ca8c86ef L |
1177 | { ifunc-1a.c ifunc-1b.S ifunc-1c.S ifunc-1d.S } \ |
1178 | ] \ | |
2a568401 L |
1179 | [list \ |
1180 | "Build pr21168a.o" \ | |
1181 | "" \ | |
6c0d3bde | 1182 | "-Wa,-mx86-used-note=yes" \ |
2a568401 L |
1183 | { pr21168a.c } \ |
1184 | ] \ | |
1185 | [list \ | |
1186 | "Build pr21168.so" \ | |
1187 | "-shared" \ | |
6c0d3bde | 1188 | "-Wa,-mx86-used-note=yes" \ |
2a568401 L |
1189 | { pr21168b.S } \ |
1190 | "" \ | |
1191 | "pr21168.so" \ | |
1192 | ] \ | |
ca8c86ef L |
1193 | ] |
1194 | ||
982c6f26 | 1195 | run_ld_link_exec_tests [list \ |
ca8c86ef L |
1196 | [list \ |
1197 | "Run ifunc-1a" \ | |
1198 | "tmpdir/ifunc-1a.o tmpdir/ifunc-1b.o \ | |
1199 | tmpdir/ifunc-1c.o tmpdir/ifunc-1d.o" \ | |
6c0d3bde | 1200 | "-Wa,-mx86-used-note=yes" \ |
ca8c86ef L |
1201 | { dummy.c } \ |
1202 | "ifunc-1a" \ | |
1203 | "pass.out" \ | |
1204 | ] \ | |
1205 | [list \ | |
1206 | "Run ifunc-1b" \ | |
1207 | "--static tmpdir/ifunc-1a.o tmpdir/ifunc-1b.o \ | |
1208 | tmpdir/ifunc-1c.o tmpdir/ifunc-1d.o" \ | |
6c0d3bde | 1209 | "-Wa,-mx86-used-note=yes" \ |
ca8c86ef L |
1210 | { dummy.c } \ |
1211 | "ifunc-1b" \ | |
1212 | "pass.out" \ | |
1213 | ] \ | |
2a568401 L |
1214 | [list \ |
1215 | "Run pr21168" \ | |
1216 | "tmpdir/pr21168a.o tmpdir/pr21168.so" \ | |
6c0d3bde | 1217 | "-Wa,-mx86-used-note=yes" \ |
2a568401 L |
1218 | { dummy.c } \ |
1219 | "pr21168" \ | |
1220 | "pass.out" \ | |
1221 | ] \ | |
ca8c86ef | 1222 | ] |
ee2fdd6f L |
1223 | |
1224 | if { [istarget "i?86-*-linux*"] } { | |
1225 | run_cc_link_tests [list \ | |
1226 | [list \ | |
1227 | "Build pr21168.so with -z ibtplt" \ | |
1228 | "-shared -Wl,-z,ibtplt" \ | |
6c0d3bde | 1229 | "-Wa,-mx86-used-note=yes" \ |
ee2fdd6f L |
1230 | { pr21168b.S } \ |
1231 | "" \ | |
1232 | "pr21168-ibt.so" \ | |
1233 | ] \ | |
1234 | [list \ | |
1235 | "Build ifunc-1a with -z ibtplt" \ | |
1236 | "-Wl,-z,ibtplt $NOPIE_LDFLAGS tmpdir/ifunc-1a.o \ | |
1237 | tmpdir/ifunc-1b.o tmpdir/ifunc-1c.o tmpdir/ifunc-1d.o" \ | |
6c0d3bde | 1238 | "-Wa,-mx86-used-note=yes" \ |
ee2fdd6f L |
1239 | { dummy.c } \ |
1240 | {{objdump {-dw} plt-main-ibt.dd}} \ | |
1241 | "ifunc-1a-ibt" \ | |
1242 | ] \ | |
1243 | [list \ | |
1244 | "Build ifunc-1a with PIE -z ibtplt" \ | |
1245 | "-Wl,-z,ibtplt -pie tmpdir/ifunc-1a.o \ | |
1246 | tmpdir/ifunc-1b.o tmpdir/ifunc-1c.o tmpdir/ifunc-1d.o" \ | |
6c0d3bde | 1247 | "-Wa,-mx86-used-note=yes" \ |
ee2fdd6f L |
1248 | { dummy.c } \ |
1249 | {{objdump {-dw} plt-pie-ibt.dd}} \ | |
1250 | "ifunc-1a-pie-ibt" \ | |
1251 | ] \ | |
1252 | ] | |
1253 | ||
1254 | run_ld_link_exec_tests [list \ | |
1255 | [list \ | |
1256 | "Run ifunc-1a with -z ibtplt" \ | |
1257 | "-Wl,-z,ibtplt $NOPIE_LDFLAGS tmpdir/ifunc-1a.o \ | |
1258 | tmpdir/ifunc-1b.o tmpdir/ifunc-1c.o tmpdir/ifunc-1d.o" \ | |
6c0d3bde | 1259 | "-Wa,-mx86-used-note=yes" \ |
ee2fdd6f L |
1260 | { dummy.c } \ |
1261 | "ifunc-1a-ibt" \ | |
1262 | "pass.out" \ | |
1263 | ] \ | |
1264 | [list \ | |
1265 | "Run ifunc-1a with PIE -z ibtplt" \ | |
1266 | "-Wl,-z,ibtplt -pie tmpdir/ifunc-1a.o \ | |
1267 | tmpdir/ifunc-1b.o tmpdir/ifunc-1c.o tmpdir/ifunc-1d.o" \ | |
6c0d3bde | 1268 | "-Wa,-mx86-used-note=yes" \ |
ee2fdd6f L |
1269 | { dummy.c } \ |
1270 | "ifunc-1a-pie-ibt" \ | |
1271 | "pass.out" \ | |
1272 | ] \ | |
1273 | [list \ | |
1274 | "Run pr21168 with -z ibtplt" \ | |
1275 | "tmpdir/pr21168a.o tmpdir/pr21168-ibt.so" \ | |
6c0d3bde | 1276 | "-Wa,-mx86-used-note=yes" \ |
ee2fdd6f L |
1277 | { dummy.c } \ |
1278 | "pr21168-ibt" \ | |
1279 | "pass.out" \ | |
1280 | ] \ | |
1281 | ] | |
1282 | } | |
ca8c86ef L |
1283 | } |
1284 | ||
00564418 L |
1285 | # Must be native with the C compiler. |
1286 | if { [isnative] | |
1287 | && [istarget "i?86-*-*"] | |
1288 | && [which $CC] != 0 } { | |
7073b5b9 L |
1289 | run_cc_link_tests [list \ |
1290 | [list \ | |
1291 | "Build pr22001-1.so" \ | |
1292 | "-shared" \ | |
6c0d3bde | 1293 | "-Wa,-mx86-used-note=yes" \ |
7073b5b9 L |
1294 | { pr22001-1a.c } \ |
1295 | {} \ | |
1296 | "pr22001-1.so" \ | |
1297 | ] \ | |
a5b4ee94 L |
1298 | [list \ |
1299 | "Build pr21997-1.so" \ | |
1300 | "-shared" \ | |
6c0d3bde | 1301 | "-Wa,-mx86-used-note=yes" \ |
a5b4ee94 L |
1302 | { property-stack.S property-no-copy.S pr21997-1a.S } \ |
1303 | {} \ | |
1304 | "pr21997-1.so" \ | |
1305 | ] \ | |
451875b4 L |
1306 | [list \ |
1307 | "Build pr22842.so" \ | |
1308 | "-shared" \ | |
6c0d3bde | 1309 | "-fPIC -Wa,-mx86-used-note=yes" \ |
451875b4 L |
1310 | { pr22842a.c } \ |
1311 | {} \ | |
1312 | "pr22842.so" \ | |
1313 | ] \ | |
7073b5b9 L |
1314 | ] |
1315 | ||
00564418 L |
1316 | run_ld_link_exec_tests [list \ |
1317 | [list \ | |
1318 | "Run weakundef1 without PIE" \ | |
1319 | "$NOPIE_LDFLAGS" \ | |
6c0d3bde | 1320 | "-Wa,-mx86-used-note=yes" \ |
00564418 L |
1321 | { weakundef1.c } \ |
1322 | "weakundef1pie" \ | |
1323 | "pass.out" \ | |
1324 | "$NOPIE_CFLAGS" \ | |
1325 | ] \ | |
7073b5b9 L |
1326 | [list \ |
1327 | "Run pr22001-1" \ | |
1328 | "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ | |
6c0d3bde | 1329 | "-Wa,-mx86-used-note=yes" \ |
7073b5b9 L |
1330 | { pr22001-1b.c } \ |
1331 | "pr22001-1" \ | |
1332 | "pass.out" \ | |
1333 | "$NOPIE_CFLAGS" \ | |
1334 | ] \ | |
1335 | [list \ | |
1336 | "Run pr22001-1 (PIE 1)" \ | |
1337 | "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ | |
6c0d3bde | 1338 | "-Wa,-mx86-used-note=yes" \ |
7073b5b9 L |
1339 | { pr22001-1c.S } \ |
1340 | "pr22001-1-pie-1" \ | |
1341 | "pass.out" \ | |
1342 | ] \ | |
1343 | [list \ | |
1344 | "Run pr22001-1 (PIE 2)" \ | |
1345 | "-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ | |
6c0d3bde | 1346 | "-Wa,-mx86-used-note=yes" \ |
7073b5b9 L |
1347 | { pr22001-1c.S } \ |
1348 | "pr22001-1-pie-2" \ | |
1349 | "pass.out" \ | |
1350 | ] \ | |
1351 | [list \ | |
1352 | "Run pr22001-1 (PIC 1)" \ | |
1353 | "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ | |
6c0d3bde | 1354 | "-Wa,-mx86-used-note=yes" \ |
7073b5b9 L |
1355 | { pr22001-1b.c } \ |
1356 | "pr22001-1-pic-1" \ | |
1357 | "pass.out" \ | |
1358 | "-fPIC" \ | |
1359 | ] \ | |
1360 | [list \ | |
1361 | "Run pr22001-1 (PIC 2)" \ | |
1362 | "-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ | |
6c0d3bde | 1363 | "-Wa,-mx86-used-note=yes" \ |
7073b5b9 L |
1364 | { pr22001-1b.c } \ |
1365 | "pr22001-1-pic-2" \ | |
1366 | "pass.out" \ | |
1367 | "-fPIC" \ | |
1368 | ] \ | |
a5b4ee94 L |
1369 | [list \ |
1370 | "Run pr21997-1" \ | |
1371 | "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ | |
6c0d3bde | 1372 | "-Wa,-mx86-used-note=yes" \ |
a5b4ee94 L |
1373 | { pr21997-1b.c } \ |
1374 | "pr21997-1" \ | |
1375 | "pass.out" \ | |
1376 | "$NOPIE_CFLAGS" \ | |
1377 | ] \ | |
1378 | [list \ | |
1379 | "Run pr21997-1 (PIC 1)" \ | |
1380 | "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ | |
6c0d3bde | 1381 | "-Wa,-mx86-used-note=yes" \ |
a5b4ee94 L |
1382 | { pr21997-1b.c } \ |
1383 | "pr21997-1-pic-1" \ | |
1384 | "pass.out" \ | |
1385 | "-fPIC" \ | |
1386 | ] \ | |
1387 | [list \ | |
1388 | "Run pr21997-1 (PIC 2)" \ | |
1389 | "-pie -Wl,--no-as-needed tmpdir/pr21997-1.so" \ | |
6c0d3bde | 1390 | "-Wa,-mx86-used-note=yes" \ |
a5b4ee94 L |
1391 | { pr21997-1b.c } \ |
1392 | "pr21997-1-pic-2" \ | |
1393 | "pass.out" \ | |
1394 | "-fPIC" \ | |
1395 | ] \ | |
1396 | [list \ | |
1397 | "Run pr21997-1 (PIE 1)" \ | |
1398 | "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ | |
6c0d3bde | 1399 | "-Wa,-mx86-used-note=yes" \ |
a5b4ee94 L |
1400 | { pr21997-1c.S } \ |
1401 | "pr21997-1-pie-1" \ | |
1402 | "pass.out" \ | |
1403 | ] \ | |
1404 | [list \ | |
1405 | "Run pr21997-1 (PIE 2)" \ | |
1406 | "-pie -Wl,--no-as-needed tmpdir/pr21997-1.so" \ | |
6c0d3bde | 1407 | "-Wa,-mx86-used-note=yes" \ |
a5b4ee94 L |
1408 | { pr21997-1c.S } \ |
1409 | "pr21997-1-pie-2" \ | |
1410 | "pass.out" \ | |
1411 | ] \ | |
451875b4 L |
1412 | [list \ |
1413 | "Build pr22842" \ | |
1414 | "-pie -Wl,--no-as-needed tmpdir/pr22842.so" \ | |
6c0d3bde | 1415 | "-Wa,-mx86-used-note=yes" \ |
451875b4 L |
1416 | { pr22842b.S } \ |
1417 | "pr22842" \ | |
1418 | "pass.out" \ | |
1419 | ] \ | |
00564418 | 1420 | ] |
7073b5b9 | 1421 | |
25d28c91 L |
1422 | if { [at_least_gcc_version 5 0] } { |
1423 | run_ld_link_exec_tests [list \ | |
1424 | [list \ | |
1425 | "Run weakundef1 with PIE" \ | |
1426 | "-pie" \ | |
6c0d3bde | 1427 | "-Wa,-mx86-used-note=yes" \ |
25d28c91 L |
1428 | { weakundef1.c } \ |
1429 | "weakundef1pie" \ | |
1430 | "pass.out" \ | |
1431 | "-fPIE" \ | |
1432 | ] \ | |
1433 | ] | |
1434 | } | |
00564418 L |
1435 | } |
1436 | ||
a3747075 L |
1437 | if { !([istarget "i?86-*-linux*"] |
1438 | || [istarget "x86_64-*-linux*"]) } { | |
6c0d3bde | 1439 | set ASFLAGS "$saved_ASFLAGS" |
a3747075 L |
1440 | return |
1441 | } | |
1442 | ||
f604c2a2 L |
1443 | run_ld_link_tests [list \ |
1444 | [list \ | |
1445 | "basic PLT generation (non-PIC, -z now)" \ | |
760b2893 L |
1446 | "-z now -melf_i386 --hash-style=sysv \ |
1447 | -z noseparate-code tmpdir/libpltlib.so" \ | |
f604c2a2 L |
1448 | "" \ |
1449 | "--32" \ | |
1450 | {plt2.s} \ | |
1451 | {{readelf -SW plt2.rd} {objdump -dwr plt2.dd}} \ | |
1452 | "plt2" \ | |
1453 | ] \ | |
1454 | [list \ | |
1455 | "basic PLT generation (PIC, -z now)" \ | |
1456 | "-z now -shared -melf_i386 tmpdir/libpltlib.so" \ | |
1457 | "" \ | |
6c0d3bde | 1458 | "--32 -mx86-used-note=yes" \ |
f604c2a2 L |
1459 | {plt-pic.s} \ |
1460 | {{objdump -dwr plt-pic2.dd}} \ | |
1461 | "plt-pic2.so" \ | |
1462 | ] \ | |
abfa390d L |
1463 | [list \ |
1464 | "Build pr21626.so" \ | |
1465 | "-shared -melf_i386" \ | |
1466 | "" \ | |
6c0d3bde | 1467 | "--32 -mx86-used-note=yes" \ |
abfa390d L |
1468 | {property-x86-3.s} \ |
1469 | "" \ | |
1470 | "pr21626.so" \ | |
1471 | ] \ | |
1472 | [list \ | |
1473 | "Build pr21626" \ | |
1474 | "-melf_i386 tmpdir/pr21626.so" \ | |
1475 | "" \ | |
6c0d3bde | 1476 | "--32 -mx86-used-note=yes" \ |
abfa390d L |
1477 | {start.s foo.s} \ |
1478 | "" \ | |
1479 | "pr21626" \ | |
1480 | ] \ | |
f604c2a2 L |
1481 | ] |
1482 | ||
a3747075 L |
1483 | # Linux only tests |
1484 | run_dump_test "pltgot-1" | |
7c1e8d3e | 1485 | run_dump_test "pltgot-2" |
fff53dae | 1486 | run_dump_test "pr20830" |
ee2fdd6f L |
1487 | run_dump_test "ibt-plt-1" |
1488 | run_dump_test "ibt-plt-2a" | |
1489 | run_dump_test "ibt-plt-2b" | |
1490 | run_dump_test "ibt-plt-2c" | |
1491 | run_dump_test "ibt-plt-2d" | |
1492 | run_dump_test "ibt-plt-3a" | |
1493 | run_dump_test "ibt-plt-3b" | |
1494 | run_dump_test "ibt-plt-3c" | |
1495 | run_dump_test "ibt-plt-3d" | |
6c0d3bde L |
1496 | |
1497 | set ASFLAGS "$saved_ASFLAGS" |