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