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