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