]>
Commit | Line | Data |
---|---|---|
782c0ebf | 1 | # Expect script for various ELF tests. |
d87bef3a | 2 | # Copyright (C) 2002-2023 Free Software Foundation, Inc. |
b7b0b729 | 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 | |
b7b0b729 | 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 |
b7b0b729 HPN |
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. | |
b7b0b729 | 20 | # |
b7b0b729 HPN |
21 | |
22 | # Exclude non-ELF targets. | |
23 | ||
43f9d75b | 24 | if ![is_elf_format] { |
b7b0b729 HPN |
25 | return |
26 | } | |
27 | ||
85e963f1 NC |
28 | # Return true if target is riscv little endian. |
29 | # xfail the riscv little endain targets for the compressed1d1 test; | |
30 | # The riscv big endian targets and others should pass. | |
31 | proc riscv_little_endian { } { | |
32 | if { [istarget "riscv32-*-*"] | |
33 | || [istarget "riscv64-*-*"] | |
34 | || [istarget "riscv32le-*-*"] | |
35 | || [istarget "riscv64le-*-*"] } { | |
36 | return 1 | |
37 | } | |
38 | return 0 | |
39 | } | |
40 | ||
e4970690 | 41 | set old_ldflags $LDFLAGS |
9f264ea9 AM |
42 | if { [istarget spu*-*-*] } { |
43 | set LDFLAGS "$LDFLAGS --local-store 0:0" | |
44 | } | |
dd803a24 AM |
45 | |
46 | # hpux .comm differs from everyone else | |
47 | set hpux "" | |
48 | set old_asflags $ASFLAGS | |
49 | if [istarget "*-*-hpux*"] { | |
50 | set hpux "--defsym HPUX=1" | |
51 | set ASFLAGS "$ASFLAGS --defsym HPUX=1" | |
52 | } | |
53 | ||
991cda6c RH |
54 | if { [istarget alpha*-*-* ] } { |
55 | # The compress1 test is written expecting 32-bit addresses; force the | |
56 | # executable down into the low address space to match. | |
57 | # ??? How can we adjust just the one testcase? | |
58 | set LDFLAGS "$LDFLAGS -Ttext-segment 0x1000000" | |
54975ae9 | 59 | set ASFLAGS "$ASFLAGS --defsym NO_SET=1" |
991cda6c | 60 | } |
9f264ea9 | 61 | |
56af5a30 AM |
62 | if [istarget "tic6x-*-*"] { |
63 | append ASFLAGS " -mpic -mpid=near" | |
64 | } | |
65 | ||
5cc51864 L |
66 | if { [istarget "*-*-solaris*"] } { |
67 | # Same for Solaris | |
68 | set options_regsub(ld) {-melf_x86_64 -melf_x86_64_sol2} | |
69 | } | |
70 | ||
7f6a71ff JM |
71 | if { [is_remote host] } then { |
72 | remote_download host merge.ld | |
73 | } | |
74 | ||
b77db948 NC |
75 | # Note - the output file from the second test (symbol3w.a) is |
76 | # used in the proc is_elf64 test below... | |
dd803a24 AM |
77 | run_ld_link_tests [list \ |
78 | [list "Build symbol3.a" \ | |
79 | "" "" $hpux \ | |
80 | {symbol3.s} {} "symbol3.a" ] \ | |
81 | [list "Build symbol3w.a" \ | |
82 | "" "" "" \ | |
83 | {symbol3w.s} {} "symbol3w.a" ] \ | |
84 | ] | |
85 | ||
b77db948 | 86 | |
b77db948 NC |
87 | if [is_elf64 tmpdir/symbol3w.a] { |
88 | set ASFLAGS "$ASFLAGS --defsym ALIGN=3" | |
0a59decb | 89 | set pr23900_1_exp "pr23900-1-64.rd" |
b7d07216 L |
90 | set pr25490_2_exp "pr25490-2-64.rd" |
91 | set pr25490_3_exp "pr25490-3-64.rd" | |
92 | set pr25490_4_exp "pr25490-4-64.rd" | |
93 | set pr25490_5_exp "pr25490-5-64.rd" | |
94 | set pr25490_6_exp "pr25490-6-64.rd" | |
b77db948 NC |
95 | } else { |
96 | set ASFLAGS "$ASFLAGS --defsym ALIGN=2" | |
0a59decb | 97 | set pr23900_1_exp "pr23900-1-32.rd" |
b7d07216 L |
98 | if { [istarget avr-*-*] |
99 | || [istarget h8300-*-*] | |
100 | || [istarget ip2k-*-*] | |
101 | || [istarget m68hc11-*] | |
b7d07216 L |
102 | || [istarget "z80-*-*"] } { |
103 | set pr25490_2_exp "pr25490-2-16.rd" | |
104 | set pr25490_3_exp "pr25490-3-16.rd" | |
105 | set pr25490_4_exp "pr25490-4-16.rd" | |
106 | set pr25490_5_exp "pr25490-5-16.rd" | |
107 | set pr25490_6_exp "pr25490-6-16.rd" | |
108 | } else { | |
109 | set pr25490_2_exp "pr25490-2-32.rd" | |
110 | set pr25490_3_exp "pr25490-3-32.rd" | |
111 | set pr25490_4_exp "pr25490-4-32.rd" | |
112 | set pr25490_5_exp "pr25490-5-32.rd" | |
113 | set pr25490_6_exp "pr25490-6-32.rd" | |
114 | } | |
b77db948 NC |
115 | } |
116 | ||
117 | ||
118 | ||
46b06a98 | 119 | # Targets that use _bfd_generic_link_add_symbols won't pass pr21703 tests |
506981af RL |
120 | run_ld_link_tests { |
121 | {"PR ld/21703" | |
93f4de39 | 122 | "--allow-multiple-definition tmpdir/pr21703-1.o tmpdir/pr21703-2.o" "" "" \ |
506981af | 123 | {pr21703-1.s pr21703-2.s} {{readelf {-s} pr21703.sd}} "pr21703" } |
506981af | 124 | {"PR ld/21703 -r" |
93f4de39 | 125 | "-r --allow-multiple-definition tmpdir/pr21703-3.o tmpdir/pr21703-4.o" "" "" \ |
506981af | 126 | {pr21703-3.s pr21703-4.s} {{readelf {-s} pr21703-r.sd}} "pr21703.o" } |
1336939d | 127 | } \[is_generic\] |
93f4de39 | 128 | |
bdd32e03 AM |
129 | if [is_underscore_target] { |
130 | set ASFLAGS "$ASFLAGS --defsym UNDERSCORE=1" | |
131 | } | |
132 | ||
e9d644e8 L |
133 | set saved_ASFLAGS "$ASFLAGS" |
134 | if { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } { | |
135 | set ASFLAGS "$ASFLAGS -mx86-used-note=no" | |
136 | } | |
137 | ||
99fabbc9 JL |
138 | # Build libraries required for SHF_GNU_RETAIN tests. |
139 | if { [check_gc_sections_available] && [supports_gnu_osabi] } { | |
140 | run_ld_link_tests [list \ | |
141 | [list "Build libretain5.a" "" "" "" \ | |
142 | {retain5lib.s} {} "libretain5.a"] \ | |
143 | [list "Build libretain6.a" "" "" "" \ | |
144 | {retain6lib.s} {} "libretain6.a"] \ | |
145 | ] | |
146 | } | |
147 | ||
782c0ebf AM |
148 | set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] |
149 | foreach t $test_list { | |
150 | # We need to strip the ".d", but can leave the dirname. | |
151 | verbose [file rootname $t] | |
152 | run_dump_test [file rootname $t] | |
153 | } | |
24edc24d | 154 | |
e9d644e8 L |
155 | set ASFLAGS "$saved_ASFLAGS" |
156 | ||
76359541 | 157 | # Check that the --out-implib option work correctly. |
075a2b89 | 158 | # Targets that don't use elf.em won't support this. |
dd803a24 AM |
159 | run_ld_link_tests [list \ |
160 | [list "Generate empty import library" \ | |
161 | "--out-implib=tmpdir/implib.lib" "" \ | |
162 | [concat "--defsym NO_GLOBAL=1" $hpux] \ | |
163 | {implib.s} \ | |
164 | {{ld empty-implib.out}} \ | |
165 | "implib" ] \ | |
166 | [list "Generate import library" \ | |
167 | "--out-implib=tmpdir/implib.lib" "" \ | |
168 | $hpux \ | |
169 | {implib.s} \ | |
170 | {{readelf {-s tmpdir/implib.lib} implib.rd}} \ | |
171 | "implib" ] \ | |
1336939d | 172 | ] \[uses_genelf\] |
76359541 | 173 | |
78336cd6 AM |
174 | #v850 gas complains about .tbss.var section attributes. |
175 | if { [check_gc_sections_available] && ![istarget "v850-*-*"] } { | |
430a16a5 NC |
176 | run_ld_link_tests { |
177 | {"--gc-sections on tls variable" | |
897aea50 | 178 | "--gc-section" "" "" {tls_gc.s} {} "tls_gc"} |
430a16a5 NC |
179 | } |
180 | } | |
181 | ||
65daf5be | 182 | proc target_defaults_to_execstack {} { |
0ab70050 NC |
183 | global base_dir |
184 | ||
185 | # If the linker has been configured with --enable-default-execstack=no then | |
186 | # this proc should always return 0. | |
187 | if { [file exists $base_dir/config.status] } { | |
188 | set status [remote_exec host grep "enable-default-execstack=no" $base_dir/config.status] | |
189 | if { [lindex $status 0] == 0 } { | |
190 | return 0 | |
191 | } else { | |
192 | verbose -log "$base_dir/config.status does not contain enable-default-execstack=no" | |
193 | } | |
194 | } else { | |
195 | verbose -log "there is no file $base_dir/config.status" | |
196 | } | |
197 | ||
65daf5be NC |
198 | if { [istarget "aarch64*-*-*"] |
199 | || [istarget "arc*-*-*"] | |
81cd0a49 | 200 | || [istarget "cris*-*-*"] |
65daf5be | 201 | || [istarget "ia64*-*-*"] |
48ca1b26 | 202 | || [istarget "loongarch*-*-*"] |
65daf5be NC |
203 | || [istarget "nios2*-*-*"] |
204 | || [istarget "powerpc64*-*-*"] | |
36f779c0 | 205 | || [istarget "pru*-*-*"] |
65daf5be NC |
206 | || [istarget "riscv*-*-*"] |
207 | || [istarget "tilegx*-*-*"] | |
333cd559 | 208 | || [istarget "tilepro*-*-*"] } { |
65daf5be NC |
209 | return 0 |
210 | } | |
211 | return 1 | |
212 | } | |
213 | ||
214 | if { [istarget *-*-*linux*] | |
215 | || [istarget *-*-nacl*] | |
216 | || [istarget *-*-gnu*] } { | |
0a59decb L |
217 | run_ld_link_tests [list \ |
218 | [list "stack exec" \ | |
219 | "-z execstack" \ | |
220 | "" \ | |
221 | "" \ | |
222 | {stack.s} \ | |
223 | {{readelf {-Wl} stack-exec.rd}} \ | |
224 | "stack-exec.exe"] \ | |
225 | [list "stack noexec" \ | |
226 | "-z noexecstack" \ | |
227 | "" \ | |
228 | "" \ | |
229 | {stack.s} \ | |
230 | {{readelf {-Wl} stack-noexec.rd}} \ | |
231 | "stack-noexec.exe"] \ | |
232 | [list "stack size" \ | |
65daf5be | 233 | "-z stack-size=0x123400 -z noexecstack" \ |
0a59decb L |
234 | "" \ |
235 | "" \ | |
236 | {stack.s} \ | |
237 | {{readelf {-Wl} stack-size.rd}} \ | |
238 | "stack-size.exe"] \ | |
239 | [list "PT_GNU_PROPERTY alignment" \ | |
240 | "" \ | |
241 | "" \ | |
242 | "" \ | |
243 | {pr23900-1.s} \ | |
244 | [list [list "readelf" {-Wl} $pr23900_1_exp]] \ | |
ba951afb NC |
245 | "pr23900-1.exe"] \ |
246 | ] | |
247 | ||
248 | # Test the linker's generation of execstack and executable segment warnings. | |
249 | # Since these are normally pruned from the linker's output we temporarily | |
250 | # disable tha action here. | |
251 | rename prune_warnings_extra old_prune_warnings_extra | |
252 | proc prune_warnings_extra { text } { | |
253 | return $text | |
254 | } | |
acd65fa6 | 255 | |
84789002 AM |
256 | set curr_ldflags $LDFLAGS |
257 | if { [istarget powerpc*-*-*] && ![istarget powerpc64*-*-*] } { | |
258 | # Don't generate an executable .plt section | |
259 | set LDFLAGS "$LDFLAGS --secure-plt" | |
260 | } | |
261 | ||
9cfd4ed4 CC |
262 | # Since the warnings can be disabled by configure, ensure consistency |
263 | # of the first test by forcing the flags. | |
ba951afb | 264 | run_ld_link_tests [list \ |
333cd559 | 265 | [list "PR ld/29072 (warn about an executable .note.GNU-stack)" \ |
9cfd4ed4 | 266 | "-e 0 --warn-execstack --warn-rwx-segments" \ |
65daf5be NC |
267 | "" \ |
268 | "" \ | |
269 | {pr29072-a.s} \ | |
270 | {{ld pr29072.a.warn}} \ | |
271 | "pr29072-a.exe"] \ | |
272 | [list "PR 29072 (warn about -z execstack)" \ | |
273 | "-z execstack --warn-execstack" \ | |
274 | "" \ | |
275 | "" \ | |
276 | {stack.s} \ | |
277 | {{ld pr29072.c.warn}} \ | |
278 | "pr29072-c.exe"] \ | |
279 | [list "PR ld/29072 (suppress warnings about executable stack)" \ | |
280 | "-e 0 --no-warn-execstack" \ | |
281 | "" \ | |
282 | "" \ | |
283 | {pr29072-a.s} \ | |
284 | {} \ | |
285 | "pr29072-d.exe"] \ | |
ba951afb NC |
286 | [list "Ensure that a warning issued when creating a segment with RWX permissions" \ |
287 | "-e 0 -Tnobits-1.t --warn-rwx-segments" \ | |
288 | "" \ | |
289 | "" \ | |
290 | {nobits-1.s} \ | |
291 | {{ld rwx-segments-1.l}} \ | |
292 | "rwx-segments-1.exe"] \ | |
293 | [list "Ensure that a warning issued when creating a TLS segment with execute permission" \ | |
294 | "-e 0 -T rwx-segments-2.t --warn-rwx-segments" \ | |
295 | "" \ | |
296 | "" \ | |
297 | {size-2.s} \ | |
298 | {{ld rwx-segments-2.l}} \ | |
299 | "rwx-segments-2.exe"] \ | |
d11c7afa | 300 | [list "Ensure that the RWX warning can be suppressed" \ |
ba951afb NC |
301 | "-e 0 -Tnobits-1.t --no-warn-rwx-segments" \ |
302 | "" \ | |
303 | "" \ | |
304 | {nobits-1.s} \ | |
305 | {} \ | |
306 | "rwx-segments-3.exe"] \ | |
307 | ] | |
308 | ||
84789002 AM |
309 | set LDFLAGS $curr_ldflags |
310 | ||
65daf5be NC |
311 | if { [target_defaults_to_execstack] } { |
312 | run_ld_link_tests [list \ | |
333cd559 | 313 | [list "PR ld/29072 (warn about absent .note.GNU-stack)" \ |
ba951afb | 314 | "-e 0 -z stack-size=0x123400 --warn-execstack" \ |
65daf5be NC |
315 | "" \ |
316 | "" \ | |
317 | {pr29072-b.s} \ | |
318 | {{ld pr29072.b.warn}} \ | |
319 | "pr29072-b.exe"] \ | |
0a59decb | 320 | ] |
65daf5be NC |
321 | } else { |
322 | run_ld_link_tests [list \ | |
333cd559 | 323 | [list "PR ld/29072 (ignore absent .note.GNU-stack)" \ |
65daf5be NC |
324 | "-e 0 -z stack-size=0x123400" \ |
325 | "" \ | |
326 | "" \ | |
327 | {pr29072-b.s} \ | |
328 | {} \ | |
329 | "pr29072-b.exe"] \ | |
330 | ] | |
331 | } | |
ba951afb NC |
332 | |
333 | # Restore the normal pruning behaviour. | |
334 | rename prune_warnings_extra "" | |
335 | rename old_prune_warnings_extra prune_warnings_extra | |
04c3a755 NS |
336 | } |
337 | ||
b7d07216 L |
338 | if [check_gc_sections_available] { |
339 | run_ld_link_tests [list \ | |
340 | [list "__patchable_function_entries section 2" \ | |
341 | "--gc-sections -e _start" \ | |
342 | "" \ | |
343 | "" \ | |
344 | {pr25490-2.s} \ | |
345 | [list [list "readelf" {-SW} $pr25490_2_exp]] \ | |
346 | "pr25490-2.exe"] \ | |
347 | [list "__patchable_function_entries section 3" \ | |
348 | "--gc-sections -e _start" \ | |
349 | "" \ | |
350 | "" \ | |
351 | {pr25490-3.s} \ | |
352 | [list [list "readelf" {-SW} $pr25490_3_exp]] \ | |
353 | "pr25490-3.exe"] \ | |
354 | [list "__patchable_function_entries section 4" \ | |
355 | "--gc-sections -e _start" \ | |
356 | "" \ | |
357 | "" \ | |
358 | {pr25490-4.s} \ | |
359 | [list [list "readelf" {-SW} $pr25490_4_exp]] \ | |
360 | "pr25490-4.exe"] \ | |
361 | [list "__patchable_function_entries section 5" \ | |
362 | "--gc-sections -e _start" \ | |
363 | "" \ | |
364 | "" \ | |
365 | {pr25490-5.s} \ | |
366 | [list [list "readelf" {-SW} $pr25490_5_exp]] \ | |
367 | "pr25490-5.exe"] \ | |
368 | [list "__patchable_function_entries section 6" \ | |
369 | "--gc-sections -e _start" \ | |
370 | "" \ | |
371 | "" \ | |
372 | {pr25490-6.s} \ | |
373 | [list [list "readelf" {-SW} $pr25490_6_exp]] \ | |
374 | "pr25490-6.exe"] \ | |
375 | ] | |
376 | } | |
377 | ||
e4970690 | 378 | set LDFLAGS $old_ldflags |
dd803a24 | 379 | set ASFLAGS $old_asflags |
e4970690 | 380 | |
4ce6ca2c | 381 | # Check to see if the C compiler works |
44ed8092 | 382 | if { ![check_compiler_available] } { |
4ce6ca2c AM |
383 | return |
384 | } | |
385 | ||
a130722b L |
386 | if [check_gc_sections_available] { |
387 | run_cc_link_tests { | |
388 | {"PR ld/13195" "-Wl,--gc-sections" "" | |
389 | {pr13195.c} {} "pr13195"} | |
390 | } | |
54e8959c L |
391 | } |
392 | ||
24edc24d | 393 | set array_tests { |
d9816402 AM |
394 | {"preinit array" "" "" |
395 | {preinit.c} "preinit" "preinit.out"} | |
396 | {"init array" "" "" | |
397 | {init.c} "init" "init.out"} | |
398 | {"fini array" "" "" | |
399 | {fini.c} "fini" "fini.out"} | |
400 | {"init array mixed" "" "" | |
401 | {init-mixed.c} "init-mixed" "init-mixed.out" "-I."} | |
310fd250 L |
402 | } |
403 | set array_tests_pie { | |
d9816402 AM |
404 | {"PIE preinit array" "-pie" "" |
405 | {preinit.c} "preinit" "preinit.out" "-fPIE"} | |
406 | {"PIE init array" "-pie" "" | |
407 | {init.c} "init" "init.out" "-fPIE"} | |
408 | {"PIE fini array" "-pie" "" | |
409 | {fini.c} "fini" "fini.out" "-fPIE"} | |
410 | {"PIE init array mixed" "-pie" "" | |
411 | {init-mixed.c} "init-mixed" "init-mixed.out" "-I. -fPIE"} | |
412 | {"PIE PR ld/14525" "-pie" "" | |
413 | {pr14525.c} "pr14525" "pr14525.out" "-fPIE"} | |
5940a93c TS |
414 | } |
415 | set array_tests_static { | |
d9816402 AM |
416 | {"static preinit array" "-static" "" |
417 | {preinit.c} "preinit" "preinit.out"} | |
418 | {"static init array" "-static" "" | |
419 | {init.c} "init" "init.out"} | |
420 | {"static fini array" "-static" "" | |
421 | {fini.c} "fini" "fini.out"} | |
422 | {"static init array mixed" "-static" "" | |
423 | {init-mixed.c} "init-mixed" "init-mixed.out" "-I."} | |
24edc24d L |
424 | } |
425 | ||
c8c140d9 | 426 | # NetBSD ELF systems do not currently support the .*_array sections. |
ab4f385b | 427 | set xfails "*-*-netbsd*" |
982c6f26 | 428 | run_ld_link_exec_tests $array_tests $xfails |
310fd250 | 429 | |
3fee20ef | 430 | if { [istarget *-*-linux*] |
5a68afcf | 431 | || [istarget *-*-nacl*] |
3fee20ef | 432 | || [istarget *-*-gnu*] } { |
982c6f26 | 433 | run_ld_link_exec_tests $array_tests_pie $xfails |
a91e1603 | 434 | |
b3d7a867 L |
435 | if { $STATIC_PIE_LDFLAGS != "" } then { |
436 | run_ld_link_exec_tests [list \ | |
437 | [list \ | |
438 | "Static PIE preinit array" \ | |
439 | "$STATIC_PIE_LDFLAGS" \ | |
440 | "" \ | |
441 | {preinit.c} \ | |
442 | "preinit-static-pie" \ | |
443 | "preinit.out" \ | |
444 | "-fPIE" \ | |
445 | ] \ | |
446 | [list \ | |
447 | "Static PIE init array" \ | |
448 | "$STATIC_PIE_LDFLAGS" \ | |
449 | "" \ | |
450 | {init.c} \ | |
451 | "init-static-pie" \ | |
452 | "init.out" \ | |
453 | "-fPIE" \ | |
454 | ] \ | |
455 | [list \ | |
456 | "Static PIE fini array" \ | |
457 | "$STATIC_PIE_LDFLAGS" \ | |
458 | "" \ | |
459 | {fini.c} \ | |
460 | "fini-static-pie" \ | |
461 | "fini.out" \ | |
462 | "-fPIE" \ | |
463 | ] \ | |
464 | [list \ | |
465 | "Static PIE init array mixed" \ | |
466 | "$STATIC_PIE_LDFLAGS" \ | |
467 | "" \ | |
468 | {init-mixed.c} \ | |
469 | "init-mixed-static-pie" \ | |
470 | "init-mixed.out" \ | |
471 | "-I. -fPIE" \ | |
472 | ] \ | |
473 | [list \ | |
474 | "Static PIE PR ld/14525" \ | |
475 | "$STATIC_PIE_LDFLAGS" \ | |
476 | "" \ | |
477 | {pr14525.c} \ | |
478 | "pr14525-static-pie" \ | |
479 | "pr14525.out" \ | |
480 | "-fPIE" \ | |
481 | ] \ | |
482 | ] | |
483 | } | |
484 | ||
a91e1603 L |
485 | run_ld_link_exec_tests [list \ |
486 | [list \ | |
487 | "Run mbind2a" \ | |
65daf5be | 488 | "$NOPIE_LDFLAGS -Wl,-z,common-page-size=0x4000 -Wl,-z,noexecstack" \ |
a91e1603 L |
489 | "" \ |
490 | { mbind2a.s mbind2b.c } \ | |
491 | "mbind2a" \ | |
492 | "pass.out" \ | |
493 | "-O2 -I../bfd" \ | |
494 | ] \ | |
495 | [list \ | |
496 | "Run mbind2b" \ | |
65daf5be | 497 | "-static -Wl,-z,common-page-size=0x4000 -Wl,-z,noexecstack" \ |
a91e1603 L |
498 | "" \ |
499 | { mbind2a.s mbind2b.c } \ | |
500 | "mbind2b" \ | |
501 | "pass.out" \ | |
502 | "-O2 -I../bfd" \ | |
503 | ] \ | |
504 | ] | |
310fd250 L |
505 | } |
506 | ||
982c6f26 | 507 | run_ld_link_exec_tests $array_tests_static $xfails |
9ab80182 | 508 | |
496afd17 L |
509 | run_cc_link_tests [list \ |
510 | [list \ | |
511 | "Build pr26391-1" \ | |
512 | "-Wl,-z,unique-symbol" \ | |
513 | "-fno-function-sections" \ | |
514 | {pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \ | |
515 | {{nm "" pr26391.nd}} \ | |
516 | "pr26391-1" \ | |
517 | ] \ | |
518 | [list \ | |
519 | "Build pr26391-2" \ | |
520 | "-Wl,-z,unique-symbol" \ | |
521 | "-ffunction-sections" \ | |
522 | {pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \ | |
523 | {{nm "" pr26391.nd}} \ | |
524 | "pr26391-2" \ | |
525 | ] \ | |
526 | [list \ | |
527 | "Build pr26391-3" \ | |
528 | "-Wl,-z,unique-symbol,--emit-relocs" \ | |
529 | "-fno-function-sections" \ | |
530 | {pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \ | |
531 | {{nm "" pr26391.nd}} \ | |
532 | "pr26391-3" \ | |
533 | ] \ | |
534 | [list \ | |
535 | "Build pr26391-4" \ | |
536 | "-Wl,-z,unique-symbol,--emit-relocs" \ | |
537 | "-ffunction-sections" \ | |
538 | {pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \ | |
539 | {{nm "" pr26391.nd}} \ | |
540 | "pr26391-4" \ | |
541 | ] \ | |
496afd17 L |
542 | [list \ |
543 | "Build pr26391-5.o" \ | |
64b59b6b L |
544 | "-Wl,-z,unique-symbol -r -nostdlib -nostartfiles" \ |
545 | "-fno-function-sections" \ | |
496afd17 | 546 | {pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \ |
bcac599f L |
547 | [list \ |
548 | [list "nm" "$dep_plug_opt" "pr26391.nd"] \ | |
549 | [list "nm" "$dep_plug_opt" "pr26391.fd"] \ | |
550 | ] \ | |
496afd17 | 551 | "pr26391-5.o" \ |
496afd17 L |
552 | ] \ |
553 | [list \ | |
554 | "Build pr26391-6.o" \ | |
64b59b6b L |
555 | "-Wl,-z,unique-symbol -r -nostdlib -nostartfiles" \ |
556 | "-ffunction-sections" \ | |
496afd17 L |
557 | {pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \ |
558 | {{nm "" pr26391.nd}} \ | |
559 | "pr26391-6.o" \ | |
496afd17 L |
560 | ] \ |
561 | ] | |
562 | ||
563 | run_ld_link_exec_tests [list \ | |
564 | [list \ | |
565 | "Run pr26391-1" \ | |
566 | "-Wl,-z,unique-symbol" \ | |
567 | "" \ | |
568 | {pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \ | |
569 | "pr26391-1" \ | |
570 | "pr26391.out" \ | |
571 | "-fno-function-sections" \ | |
572 | ] \ | |
573 | [list \ | |
574 | "Run pr26391-2" \ | |
575 | "-Wl,-z,unique-symbol" \ | |
576 | "" \ | |
577 | {pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \ | |
578 | "pr26391-2" \ | |
579 | "pr26391.out" \ | |
580 | "-ffunction-sections" \ | |
581 | ] \ | |
582 | [list \ | |
583 | "Run pr26391-3" \ | |
584 | "-Wl,-z,unique-symbol,--emit-relocs" \ | |
585 | "" \ | |
586 | {pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \ | |
587 | "pr26391-3" \ | |
588 | "pr26391.out" \ | |
589 | "-fno-function-sections" \ | |
590 | ] \ | |
591 | [list \ | |
592 | "Run pr26391-4" \ | |
593 | "-Wl,-z,unique-symbol,--emit-relocs" \ | |
594 | "" \ | |
595 | {pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \ | |
596 | "pr26391-4" \ | |
597 | "pr26391.out" \ | |
598 | "-ffunction-sections" \ | |
599 | ] \ | |
600 | [list \ | |
601 | "Run pr26391-5" \ | |
602 | "-Wl,-z,unique-symbol" \ | |
603 | "" \ | |
604 | {dummy.c} \ | |
605 | "pr26391-5" \ | |
606 | "pr26391.out" \ | |
607 | "" \ | |
608 | "c" \ | |
609 | "" \ | |
610 | "tmpdir/pr26391-5.o" \ | |
611 | ] \ | |
612 | [list \ | |
613 | "Run pr26391-6" \ | |
614 | "-Wl,-z,unique-symbol" \ | |
615 | "" \ | |
616 | {dummy.c} \ | |
617 | "pr26391-6" \ | |
618 | "pr26391.out" \ | |
619 | "" \ | |
620 | "c" \ | |
621 | "" \ | |
622 | "tmpdir/pr26391-6.o" \ | |
623 | ] \ | |
624 | ] | |
625 | ||
ec15b12d MM |
626 | set merge_exec_tests { |
627 | {"merge4" "" "" | |
628 | {merge4a.c merge4b.s} "merge4" "merge4.out"} | |
629 | } | |
630 | run_ld_link_exec_tests $merge_exec_tests | |
631 | ||
02ecc8e9 | 632 | catch "exec rm -f tmpdir/preinit tmpdir/init tmpdir/fini tmpdir/init-mixed" status |