ld: Pass -fno-sanitize=all to tests with linker
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elf / shared.exp
... / ...
CommitLineData
1# Expect script for various ELF tests.
2# Copyright (C) 2006-2020 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# Exclude non-ELF targets.
23
24if ![is_elf_format] {
25 return
26}
27
28# Skip targets where -shared is not supported
29
30if ![check_shared_lib_support] {
31 return
32}
33
34# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
35global NOPIE_CFLAGS NOPIE_LDFLAGS
36global NOSANTIZE_CFLAGS
37
38set old_ASFLAGS $ASFLAGS
39
40# This target requires extra GAS options when building code for shared
41# libraries.
42set AFLAGS_PIC ""
43if [istarget "nds32*-*"] {
44 append AFLAGS_PIC " -mpic"
45}
46if [istarget "tic6x-*-*"] {
47 append AFLAGS_PIC " -mpic -mpid=near"
48}
49if [istarget "sparc*-*-*"] {
50 append AFLAGS_PIC " -K PIC -Av9"
51}
52
53# GAS options to disable program property note.
54set AFLAGS_NOTE ""
55if { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
56 append AFLAGS_NOTE "-mx86-used-note=no"
57}
58
59# This target requires a non-default emulation for successful shared
60# library/executable builds.
61set LFLAGS ""
62if [istarget "tic6x-*-*"] {
63 append LFLAGS " -melf32_tic6x_le"
64}
65# HPUX targets use a different .comm syntax.
66set hpux ""
67if [istarget "*-*-hpux*"] {
68 set hpux "--defsym HPUX=1"
69}
70# These targets do not default to linking with shared libraries.
71if { [istarget "mips*vr4100*-*-elf*"] \
72 || [istarget "mips*vr4300*-*-elf*"] \
73 || [istarget "mips*vr5000*-*-elf*"] } {
74 append LFLAGS " -call_shared"
75}
76
77if [is_underscore_target] {
78 set ASFLAGS "$ASFLAGS --defsym UNDERSCORE=1"
79}
80
81run_ld_link_tests [list \
82 [list \
83 "Build pr22471a.so" \
84 "$LFLAGS -shared" \
85 "" \
86 "$AFLAGS_PIC" \
87 {pr22471a.s} \
88 {} \
89 "pr22471a.so" \
90 ] \
91 [list \
92 "Build pr22471b.so" \
93 "$LFLAGS -shared --version-script pr22471.t" \
94 "tmpdir/pr22471a.so" \
95 "$AFLAGS_PIC" \
96 {pr22471a.s} \
97 {} \
98 "pr22471b.so" \
99 ] \
100 [list \
101 "Build pr22471" \
102 "$LFLAGS -rpath-link ." \
103 "tmpdir/pr22471b.so" \
104 "" \
105 {pr22471b.s} \
106 {} \
107 "pr22471" \
108 ] \
109 [list \
110 "Build pr22649-1.so" \
111 "$LFLAGS -shared" \
112 "" \
113 "$AFLAGS_PIC" \
114 {pr22649-1.s} \
115 {} \
116 "pr22649-1.so" \
117 ] \
118]
119
120if { [check_gc_sections_available] } {
121 if [istarget mips*-*-*] {
122 set actions {{ld pr22649-2ab-mips.msg}}
123 } else {
124 set actions {{ld pr22649.msg}}
125 }
126 run_ld_link_tests [list \
127 [list \
128 "Build pr22649-2a.so" \
129 "$LFLAGS -shared -gc-sections -print-gc-sections" \
130 "" \
131 "$AFLAGS_PIC" \
132 {pr22649-2a.s} \
133 $actions \
134 "pr22649-2a.so" \
135 ] \
136 [list \
137 "Build pr22649-2b.so" \
138 "$LFLAGS -shared -gc-sections -print-gc-sections" \
139 "tmpdir/pr22649-1.so" \
140 "$AFLAGS_PIC" \
141 {pr22649-2a.s} \
142 $actions \
143 "pr22649-2b.so" \
144 ] \
145 ]
146 if { [istarget mips*-*-*] && ![istarget *-*-elf*] } {
147 set actions {{ld pr22649-2cd-mips.msg}}
148 } else {
149 set actions {}
150 }
151 run_ld_link_tests [list \
152 [list \
153 "Build pr22649-2c.so" \
154 "$LFLAGS -shared -gc-sections -print-gc-sections" \
155 "" \
156 "$AFLAGS_PIC" \
157 {pr22649-2b.s} \
158 $actions \
159 "pr22649-2b.so" \
160 ] \
161 [list \
162 "Build pr22649-2d.so" \
163 "$LFLAGS -shared -gc-sections -print-gc-sections" \
164 "tmpdir/pr22649-1.so" \
165 "$AFLAGS_PIC" \
166 {pr22649-2b.s} \
167 $actions \
168 "pr22649-2b.so" \
169 ] \
170 ]
171}
172
173run_ld_link_tests [list \
174 [list \
175 "DT_TEXTREL in shared lib" \
176 "$LFLAGS -shared --warn-shared-textrel" \
177 "" \
178 "$AFLAGS_PIC" \
179 {textrel.s} \
180 {{ld textrel.warn} \
181 {readelf {-d --wide} textrel.rd}} \
182 "textrel.so" \
183 ] \
184] "xtensa-*-*"
185
186# The MIPS backend sets SHF_WRITE, in `mips_elf_create_dynamic_relocation',
187# for any section that has a dynamic relocation attached and consequently
188# this test is irrelevant for MIPS targets. We don't have a clean way to
189# request UNSUPPORTED result, which would be the most appropriate here,
190# so we just XFAIL the test instead.
191run_ld_link_tests [list \
192 [list \
193 "DT_TEXTREL map file warning" \
194 "$LFLAGS -shared -M" \
195 "" \
196 "$AFLAGS_PIC" \
197 {textrel.s} \
198 {{ld textrel.map}} \
199 "textrel.so" \
200 ] \
201] "cris*-*-*" "mips*-*-*"
202
203# PR ld/20828 check for correct dynamic symbol table entries where:
204# - symbols have been defined with a linker script,
205# - the same symbols have been seen in shared library used in the link,
206# - the shared library symbols have been swept in section garbage collection.
207# Verify that the symbols are global rather than local and that a version
208# script adjusts them accordingly.
209# Also verify that a version definition supplied by an object rather than
210# a version script and forcibly exported is unaffected by section GC.
211if { [check_gc_sections_available] } {
212 run_ld_link_tests [list \
213 [list \
214 "PR ld/20828 dynamic symbols with section GC\
215 (auxiliary shared library)" \
216 "$LFLAGS -shared --gc-sections -T pr20828.ld" "" "$AFLAGS_PIC" \
217 {pr20828.s} \
218 {{readelf --dyn-syms pr20828-a.sd} \
219 {readelf --dyn-syms pr20828-b.sd}} \
220 "libpr20828.so"] \
221 [list \
222 "PR ld/20828 dynamic symbols with section GC (plain)" \
223 "$LFLAGS -shared --gc-sections -T pr20828.ld" \
224 "tmpdir/libpr20828.so" "$AFLAGS_PIC" \
225 {pr20828.s} \
226 {{readelf --dyn-syms pr20828-a.sd} \
227 {readelf --dyn-syms pr20828-b.sd}} \
228 "pr20828-1.so"] \
229 [list \
230 "PR ld/20828 dynamic symbols with section GC (version script)" \
231 "$LFLAGS -shared --gc-sections -T pr20828.ld\
232 --version-script=pr20828.ver" \
233 "tmpdir/libpr20828.so" \
234 "$AFLAGS_PIC" \
235 {pr20828.s} \
236 {{readelf --dyn-syms pr20828-b.sd} \
237 {readelf --dyn-syms pr20828-c.sd}} \
238 "pr20828-2.so"] \
239 [list \
240 "PR ld/20828 dynamic symbols with section GC\
241 (versioned shared library)" \
242 "$LFLAGS -shared --gc-sections -T pr20828.ld\
243 --version-script=pr20828-v.ver" \
244 "" "$AFLAGS_PIC" \
245 {pr20828.s} \
246 {{readelf --dyn-syms pr20828-c.sd} \
247 {readelf --dyn-syms pr20828-d.sd} \
248 {readelf --dyn-syms pr20828-e.sd}} \
249 "libpr20828-v.so"] \
250 [list \
251 "PR ld/20828 dynamic symbols with section GC (versioned)" \
252 "$LFLAGS -shared --gc-sections -T pr20828.ld\
253 --version-script=pr20828-v.ver" \
254 "tmpdir/libpr20828-v.so" \
255 "$AFLAGS_PIC" \
256 {pr20828.s} \
257 {{readelf --dyn-syms pr20828-c.sd} \
258 {readelf --dyn-syms pr20828-d.sd} \
259 {readelf --dyn-syms pr20828-e.sd}} \
260 "pr20828-v.so"] \
261 [list \
262 "PR ld/20828 forcibly exported symbol version without section GC" \
263 "$LFLAGS --no-dynamic-linker -e foo -E -T pr20828-v.ld" "" "" \
264 {pr20828-v.s} \
265 {{objdump -p pr20828-v.od}} \
266 "pr20828-v-1"] \
267 [list \
268 "PR ld/20828 forcibly exported symbol version with section GC" \
269 "$LFLAGS --no-dynamic-linker -e foo --gc-sections -E -T pr20828-v.ld" "" "" \
270 {pr20828-v.s} \
271 {{objdump -p pr20828-v.od}} \
272 "pr20828-v-2"]]
273}
274# PR ld/21233 check for correct dynamic symbol table entries where:
275# - a symbol has been defined in a shared library used in the link,
276# - the symbol has been referenced from a section swept in garbage collection,
277# - the symbol has also been forced to be entered in the output file as an
278# undefined symbol, either with a command-line option or a linker script
279# command.
280# Verify that the undefined symbol is global rather than local.
281if { [check_gc_sections_available] } {
282 run_ld_link_tests [list \
283 [list \
284 "PR ld/21233 dynamic symbols with section GC\
285 (auxiliary shared library)" \
286 "$LFLAGS -shared -T pr21233.ld" "" "$AFLAGS_PIC" \
287 {pr21233-l.s} \
288 {{readelf --dyn-syms pr21233-l.sd}} \
289 "libpr21233.so"]]
290
291 run_ld_link_tests [list \
292 [list \
293 "PR ld/21233 dynamic symbols with section GC (--undefined)" \
294 "$LFLAGS --gc-sections -e foo --undefined=bar -T pr21233.ld" \
295 "tmpdir/libpr21233.so" "" \
296 {pr21233.s} \
297 {{readelf --dyn-syms pr21233.sd}} \
298 "pr21233-1"]]
299
300 run_ld_link_tests [list \
301 [list \
302 "PR ld/21233 dynamic symbols with section GC (--require-defined)" \
303 "$LFLAGS --gc-sections -e foo --require-defined=bar\
304 -T pr21233.ld" \
305 "tmpdir/libpr21233.so" "" \
306 {pr21233.s} \
307 {{readelf --dyn-syms pr21233.sd}} \
308 "pr21233-2"]]
309
310 run_ld_link_tests [list \
311 [list \
312 "PR ld/21233 dynamic symbols with section GC (EXTERN)" \
313 "$LFLAGS --gc-sections -e foo -T pr21233-e.ld" \
314 "tmpdir/libpr21233.so" "" \
315 {pr21233.s} \
316 {{readelf --dyn-syms pr21233.sd}} \
317 "pr21233-3"]]
318}
319
320if { [check_gc_sections_available] } {
321 run_ld_link_tests [list \
322 [list \
323 "Build pr22150.so" \
324 "$LFLAGS -shared --version-script pr22150.ver" \
325 "" \
326 "$AFLAGS_PIC" \
327 {pr22150a.s} \
328 {} \
329 "pr22150.so" \
330 ] \
331 [list \
332 "Build pr22150" \
333 "$LFLAGS -e _start --gc-sections" \
334 "tmpdir/pr22150.so" \
335 "" \
336 {pr22150b.s} \
337 {{readelf -V pr22150.vd}} \
338 "pr22150" \
339 ] \
340 ]
341
342 switch -glob $target_triplet {
343 # exclude targets that don't support copy relocs
344 bfin-*-* { }
345 frv-*-* { }
346 lm32-*-* { }
347 mips*-*-* { }
348 tic6x-*-* { }
349 xtensa-*-* { }
350 default {
351 run_ld_link_tests [list \
352 [list \
353 "Build pr25458.so" \
354 "$LFLAGS -shared --version-script=pr25458.map" \
355 "" \
356 "$AFLAGS_PIC" \
357 {pr25458b.s} \
358 {} \
359 "pr25458.so" \
360 ] \
361 [list \
362 "Build pr25458" \
363 "$LFLAGS -e _start --gc-sections" \
364 "tmpdir/pr25458.so" \
365 "$AFLAGS_PIC" \
366 {pr25458a.s} \
367 {{readelf {--dyn-sym --wide} pr25458.rd}} \
368 "pr25458" \
369 ] \
370 ]
371 }
372 }
373}
374
375set ASFLAGS $old_ASFLAGS
376
377run_ld_link_tests {
378 {"Build pr14170a.o" "" "" "" {pr14170a.s} {} "pr14170.a" }
379}
380run_ld_link_tests [list \
381 [list "Build shared library for pr14170" \
382 "-shared" "" "$AFLAGS_PIC" "pr14170b.s" {} "pr14170.so" ] \
383]
384
385# bfin does not currently support copy relocs.
386run_ld_link_tests [list \
387 [list "PR ld/14170" \
388 "$LFLAGS --no-dynamic-linker tmpdir/pr14170a.o tmpdir/pr14170.so" "" \
389 $hpux \
390 {pr14170c.s} { } "pr14170" ] \
391] "bfin-*-*"
392
393# Targets that use _bfd_generic_link_add_symbols won't pass pr21703 tests
394# Nor will hppa64 with dot-symbols.
395run_ld_link_tests [list \
396 [list "PR ld/21703 shared" \
397 "-shared --allow-multiple-definition --version-script pr21703.ver\
398 tmpdir/pr21703-3.o tmpdir/pr21703-4.o" "" "$AFLAGS_PIC" \
399 {pr21703-3.s pr21703-4.s} {{readelf {--dyn-syms} pr21703-shared.sd}} \
400 "pr21703.so" ] \
401] \[is_generic\] hppa64-*-*
402
403# This target requires extra GAS options when building non-PIC code
404# for linking with shared libraries.
405set AFLAGS_NONPIC ""
406if [istarget "mips*-*-*"] {
407 append AFLAGS_NONPIC " -call_nonpic"
408}
409
410# Run a test to check linking a shared library with a broken linker
411# script that accidentally marks dynamic sections as notes. The
412# resulting executable is not expected to work, but the linker
413# should not seg-fault whilst creating the binary.
414run_ld_link_tests [list \
415 [list "Build shared library for broken linker script test" \
416 "-shared --hash-style=sysv" "" "$AFLAGS_PIC" "note-3.s" \
417 {} \
418 "note-3.so" ] \
419 [list "Link using broken linker script" \
420 "$LFLAGS --script note-3.t tmpdir/note-3.so" "" "" "" \
421 { { ld "note-3.l" } } \
422 "a.out" ] \
423]
424
425run_ld_link_tests [list \
426 [list "Build pr17068.so" \
427 "-shared" "" "$AFLAGS_PIC" \
428 {pr17068d.s} {} "pr17068.so"] \
429 [list "Build pr17068a.a" \
430 "" "" "" \
431 {pr17068a.s pr17068c.s pr17068ez.s} {} "pr17068a.a"] \
432 [list "Build pr17068b.a" \
433 "" "" "" \
434 {pr17068b.s pr17068e.s} {} "pr17068b.a"] \
435]
436
437# bfin does not currently support copy relocs.
438run_ld_link_tests {
439 {"pr17068 link --as-needed lib in group"
440 "$LFLAGS --as-needed --no-dynamic-linker"
441 "--start-group tmpdir/pr17068a.a tmpdir/pr17068.so tmpdir/pr17068b.a\
442 --end-group" ""
443 {start.s pr17068.s} {} "pr17068"}
444} "bfin-*-*"
445
446# Fails on MIPS because ABI trickery means that a NULL reloc is emitted.
447# Fails on bfin because relocations are not created.
448run_ld_link_tests [list \
449 [list "-Bsymbolic-functions" \
450 "-shared -Bsymbolic-functions" "" "$AFLAGS_PIC" \
451 {symbolic-func.s} {{readelf {-r --wide} symbolic-func.r}} \
452 "symbolic-func.so"] \
453] "mips*-*-*" "bfin-*-*"
454
455run_ld_link_tests [list \
456 [list "Build pr20995.so" \
457 "-shared" "" "$AFLAGS_PIC" \
458 {pr20995b.s} {} "pr20995.so"] \
459]
460
461# xfail on arm*-*-eabi*. The list can be enlarged to those targets that
462# don't support GNU_RELRO. For more details, please see discussions at:
463# https://sourceware.org/ml/binutils/2017-01/msg00441.html
464run_ld_link_tests [list \
465 [list "Build pr20995-2.so" \
466 "-shared -z relro" "" "$AFLAGS_PIC" \
467 {pr20995c.s} {{readelf {-l --wide} pr20995-2so.r}} "pr20995-2.so"] \
468] "tic6x-*-*" "arm*-*-eabi*" "hppa*64*-*-hpux*" "aarch64*-*-elf*" \
469 "*-*-lynxos*" "arm*-*-nto*" "i?86-*-nto*" "sh*-*-nto*"
470
471# These targets don't copy dynamic variables into .bss.
472setup_xfail "alpha-*-*" "bfin-*-*" "ia64-*-*" "xtensa-*-*"
473# or don't have .data.rel.ro
474setup_xfail "hppa*64*-*-hpux*"
475run_ld_link_tests [list \
476 [list \
477 "pr20995" \
478 "$LFLAGS" "tmpdir/pr20995.so" "$AFLAGS_NONPIC" \
479 {pr20995a.s} {{readelf {-S --wide} pr20995.r}} "pr20995"]]
480
481# xfail on arm*-*-eabi* is particularly because of no support of GNU_RELRO.
482# Please see the link above for details.
483setup_xfail "alpha-*-*" "bfin-*-*" "ia64-*-*" "xtensa-*-*" "arm*-*-eabi*"
484setup_xfail "hppa*64*-*-hpux*" "aarch64*-*-elf*"
485run_ld_link_tests [list \
486 [list \
487 "pr20995-2" \
488 "$LFLAGS" "tmpdir/pr20995-2.so" "$AFLAGS_NONPIC" \
489 {pr20995a.s} {{readelf {-S --wide} pr20995.r}} "pr20995-2"]
490] "*-*-lynxos*" "arm*-*-nto*" "i?86-*-nto*" "sh*-*-nto*"
491
492run_ld_link_tests [list \
493 [list "Build pr22374 shared library" \
494 "-shared" "" "$AFLAGS_PIC" "pr22374b.s" {} "pr22374.so" ] \
495]
496if { ![istarget "alpha-*-*"]
497 && ![istarget "csky-*-*"]
498 && ![istarget "frv-*-*"]
499 && ![istarget "hppa*-*-*"]
500 && ![istarget "i?86-*-*"]
501 && ![istarget "ia64-*-*"]
502 && ![istarget "microblaze-*-*"]
503 && ![istarget "powerpc*-*-*"]
504 && ![istarget "x86_64-*-*"]
505 && ![istarget "xtensa-*-*"] } {
506 # The next test checks that copy relocs are not used unnecessarily,
507 # but that is just an optimization so don't complain loudly.
508 setup_xfail "*-*-*"
509}
510run_ld_link_tests {
511 {"pr22374 function pointer initialization"
512 "" "tmpdir/pr22374.so" "" "pr22374a.s"
513 { {readelf {--wide -r --dyn-syms} "pr22374-1.r"}
514 {readelf {--wide -r} "pr22374-2.r"} }
515 "pr22374" }
516}
517
518if { [istarget *-*-linux*]
519 || [istarget *-*-nacl*]
520 || [istarget *-*-gnu*] } {
521 run_ld_link_tests {
522 {"Weak symbols in dynamic objects 1 (support)"
523 "-shared" "" "" {weak-dyn-1a.s}
524 {}
525 "libweakdyn1a.so"}
526 {"Weak symbols in dynamic objects 1 (main test)"
527 "-shared tmpdir/libweakdyn1a.so -Tweak-dyn-1.ld" "" "" {weak-dyn-1b.s}
528 {{readelf {--relocs --wide} weak-dyn-1.rd}}
529 "libweakdyn1b.so"}
530 }
531}
532
533# Check to see if the C compiler works
534if { ![check_compiler_available] } {
535 return
536}
537
538# Add -ldl to extralibs if needed
539set extralibs ""
540if { ![istarget *-*-freebsd*]} {
541 set extralibs "-ldl"
542}
543
544set build_tests {
545 {"Build libfoo.so"
546 "-shared" "-fPIC"
547 {foo.c} {} "libfoo.so"}
548 {"Build versioned libfoo.so"
549 "-shared -Wl,--version-script=foo.map" "-fPIC"
550 {foo.c} {} "libfoov.so"}
551 {"Build libbar.so"
552 "-shared" "-fPIC"
553 {begin.c end.c} {} "libbar.so"}
554 {"Build warn libbar.so"
555 "-shared" "-fPIC"
556 {beginwarn.c end.c}
557 {{readelf {-S --wide} libbarw.rd}
558 {warning "^.*beginwarn.c:7: warning: function foo is deprecated\n?$"}}
559 "libbarw.so" "c"}
560 {"Build hidden libbar.so"
561 "-shared" "-fPIC"
562 {begin.c endhidden.c} {} "libbarh.so"}
563 {"Build protected libbar.so"
564 "-shared" "-fPIC"
565 {begin.c endprotected.c} {} "libbarp.so"}
566 {"Build libbar.so with libfoo.so"
567 "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
568 {end.c} {} "libbarfoo.so"}
569 {"Build libar.so with versioned libfoo.so"
570 "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
571 {end.c} {} "libbarfoov.so"}
572 {"Build hidden libbar.so with libfoo.so"
573 "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
574 {endhidden.c} {} "libbarhfoo.so"}
575 {"Build hidden libar.so with versioned libfoo.so"
576 "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
577 {endhidden.c} {} "libbarhfoov.so"}
578 {"Build protected libbar.so with libfoo.so"
579 "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC"
580 {endprotected.c} {} "libbarpfoo.so"}
581 {"Build protected libbar.so with versioned libfoo.so"
582 "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC"
583 {endprotected.c} {} "libbarpfoov.so"}
584 {"Build libdl1.so"
585 "-shared" "-fPIC"
586 {dl1.c} {} "libdl1.so"}
587 {"Build libdl2a.so with --dynamic-list=dl2.list"
588 "-shared -Wl,--dynamic-list=dl2.list" "-fPIC"
589 {dl2.c dl2xxx.c} {} "libdl2a.so"}
590 {"Build libdl2a.so with --dynamic-list=dl2a.list"
591 "-shared -Wl,--dynamic-list=dl2a.list" "-fPIC"
592 {dl2.c dl2xxx.c} {} "libdl2a.so"}
593 {"Build libdl2a.so with --dynamic-list-data"
594 "-shared -Wl,--dynamic-list-data" "-fPIC"
595 {dl2.c dl2xxx.c} {} "libdl2a.so"}
596 {"Build libdl2b.so with --dynamic-list=dl2.list and dl2xxx.list"
597 "-shared -Wl,--dynamic-list=dl2.list,--dynamic-list=dl2xxx.list" "-fPIC"
598 {dl2.c dl2xxx.c} {} "libdl2b.so"}
599 {"Build libdl2c.so with --dynamic-list-data and dl2xxx.list"
600 "-shared -Wl,--dynamic-list-data,--dynamic-list=dl2xxx.list" "-fPIC"
601 {dl2.c dl2xxx.c} {} "libdl2c.so"}
602 {"Build libdl2d.so with --dynamic-list-data -Bsymbolic"
603 "-shared -Wl,-Bsymbolic,--dynamic-list-data" "-fPIC"
604 {dl2.c dl2xxx.c} {} "libdl2d.so"}
605 {"Build libdl2e.so with --export-dynamic-symbol=foo"
606 "-shared -Wl,--export-dynamic-symbol=foo" "-fPIC"
607 {dl2.c dl2xxx.c} {} "libdl2e.so"}
608 {"Build libdl2f.so with --dynamic-list=dlempty.list and --export-dynamic-symbol=foo"
609 "-shared -Wl,--dynamic-list=dlempty.list,--export-dynamic-symbol=foo" "-fPIC"
610 {dl2.c dl2xxx.c} {} "libdl2f.so"}
611 {"Build libdl2g.so with --export-dynamic-symbol-list=dl2.list"
612 "-shared -Wl,--export-dynamic-symbol-list=dl2.list" "-fPIC"
613 {dl2.c dl2xxx.c} {} "libdl2g.so"}
614 {"Build libdl2h.so with --dynamic-list=dlempty.list and --export-dynamic-symbol-list=dl2.list"
615 "-shared -Wl,--dynamic-list=dlempty.list,--export-dynamic-symbol-list=dl2.list" "-fPIC"
616 {dl2.c dl2xxx.c} {} "libdl2h.so"}
617 {"Build libdl2i.so with -Bsymbolic and --export-dynamic-symbol=foo"
618 "-shared -Wl,-Bsymbolic,--export-dynamic-symbol=foo" "-fPIC"
619 {dl2.c dl2xxx.c} {} "libdl2i.so"}
620 {"Build libdl2j.so with -Bsymbolic and --export-dynamic-symbol-list=dl2.list"
621 "-shared -Wl,-Bsymbolic,--export-dynamic-symbol-list=dl2.list" "-fPIC"
622 {dl2.c dl2xxx.c} {} "libdl2j.so"}
623 {"Build libdl2k.so with --export-dynamic-symbol-list=dl2.list and -Bsymbolic"
624 "-shared -Wl,--export-dynamic-symbol-list=dl2.list,-Bsymbolic" "-fPIC"
625 {dl2.c dl2xxx.c} {} "libdl2k.so"}
626 {"Build libdl4a.so with --dynamic-list=dl4.list"
627 "-shared -Wl,--dynamic-list=dl4.list" "-fPIC"
628 {dl4.c dl4xxx.c} {} "libdl4a.so"}
629 {"Build libdl4b.so with --dynamic-list-data"
630 "-shared -Wl,--dynamic-list-data" "-fPIC"
631 {dl4.c dl4xxx.c} {} "libdl4b.so"}
632 {"Build libdl4c.so with --dynamic-list=dl4.list and dl4xxx.list"
633 "-shared -Wl,--dynamic-list=dl4.list,--dynamic-list=dl4xxx.list" "-fPIC"
634 {dl4.c dl4xxx.c} {} "libdl4c.so"}
635 {"Build libdl4d.so with --dynamic-list-data and dl4xxx.list"
636 "-shared -Wl,--dynamic-list-data,--dynamic-list=dl4xxx.list" "-fPIC"
637 {dl4.c dl4xxx.c} {} "libdl4d.so"}
638 {"Build libdl4e.so with -Bsymbolic-functions --dynamic-list-cpp-new"
639 "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
640 {dl4.c dl4xxx.c} {} "libdl4e.so"}
641 {"Build libdl4f.so with --dynamic-list-cpp-new -Bsymbolic-functions"
642 "-shared -Wl,--dynamic-list-cpp-new,-Bsymbolic-functions" "-fPIC"
643 {dl4.c dl4xxx.c} {} "libdl4f.so"}
644 {"Build libdl6a.so"
645 "-shared" "-fPIC"
646 {dl6.c} {} "libdl6a.so"}
647 {"Build libdl6b.so with -Bsymbolic --dynamic-list-data"
648 "-shared -Wl,-Bsymbolic,--dynamic-list-data" "-fPIC"
649 {dl6.c} {} "libdl6b.so"}
650 {"Build libdl6c.so with -Bsymbolic"
651 "-shared -Wl,-Bsymbolic" "-fPIC"
652 {dl6.c} {} "libdl6c.so"}
653 {"Build libdl6d.so with --dynamic-list-data -Bsymbolic"
654 "-shared -Wl,--dynamic-list-data,-Bsymbolic" "-fPIC"
655 {dl6.c} {} "libdl6d.so"}
656 {"Build libdata1.so"
657 "-shared" "-fPIC"
658 {data1.c} {} "libdata1.so"}
659 {"Build libdata2.so"
660 "-shared" "-fPIC"
661 {data2.c} {} "libdata2.so"}
662 {"Build libcomm1.o"
663 "-r -nostdlib" "-fcommon"
664 {comm1.c} {} "libcomm1.o"}
665 {"Build libfunc1.so"
666 "-shared" "-fPIC"
667 {func1.c} {} "libfunc1.so"}
668 {"Build libpr9676-1.a"
669 "" "-fPIC"
670 {pr9676-1.c} {} "libpr9676-1.a"}
671 {"Build libpr9676-2.a"
672 "" "-fPIC"
673 {pr9676-2.c} {} "libpr9676-2.a"}
674 {"Build libpr9676-3.so"
675 "-shared" "-fPIC"
676 {pr9676-3.c} {} "libpr9676-3.so"}
677 {"Build libpr9676-4.so"
678 "-shared" "-fPIC"
679 {pr9676-4.c} {} "libpr9676-4.so"}
680 {"Build libpr9676-4a.so"
681 "-shared tmpdir/pr9676-4.o -Ltmpdir -lpr9676-3 -Wl,--start-group -lpr9676-1 -lpr9676-2 -Wl,--end-group"
682 "-fPIC"
683 {dummy.c} {{readelf {-s} pr9676.rd}} "libpr9676-4a.so"}
684 {"Build libpr9679.so"
685 "-shared" "-fPIC -O0"
686 {pr9679-1.c pr9679-2.c} {{readelf {-s} pr9679.rd}} "libpr9679.so"}
687 {"Build libpr11138-1.so"
688 "-shared -Wl,--version-script=pr11138-1.map" "-fPIC"
689 {pr11138-1.c} {} "libpr11138-1.so"}
690 {"Build libpr11138-2.o"
691 "-r -nostdlib" ""
692 {pr11138-2.c} {} "libpr11138-2.o"}
693 {"Build pr13250-1.so"
694 "-shared" "-fPIC -fcommon"
695 {pr13250-1.c} {} "libpr13250-1.so"}
696 {"Build pr13250-2.so with libpr13250-1.so"
697 "-shared -Wl,--no-as-needed tmpdir/libpr13250-1.so" "-fPIC -fcommon"
698 {pr13250-2.c} {} "libpr13250-2.so"}
699 {"Build libpr13250-3.o"
700 "-r -nostdlib" "-fcommon"
701 {pr13250-3.c} {} "libpr13250-3.o"}
702 {"Build libpr14323-2.so"
703 "-shared" "-fPIC -fcommon"
704 {pr14323-2.c} {} "libpr14323-2.so"}
705 {"Build pr14862-1.o"
706 "-r -nostdlib" ""
707 {pr14862-1.c} {} "libpr14862-1.o"}
708 {"Build libpr14862.so"
709 "-shared -Wl,--version-script=pr11138-1.map" "-fPIC"
710 {pr14862-2.c} {} "libpr14862.so"}
711 {"Build libneeded1b.so"
712 "-shared" "-fPIC"
713 {needed1b.c} {} "libneeded1b.so"}
714 {"Build libneeded1a.so"
715 "-shared -Wl,--add-needed,--no-as-needed -Ltmpdir -lneeded1b" "-fPIC"
716 {needed1a.c} {} "libneeded1a.so"}
717 {"Build libneeded1c.o"
718 "-r -nostdlib" ""
719 {needed1c.c} {} "libneeded1c.o"}
720 {"Build libneeded1pic.o"
721 "-r -nostdlib" "-fPIC"
722 {needed1c.c} {} "libneeded1pic.o"}
723 {"Build needed1a.so with --add-needed"
724 "-shared tmpdir/libneeded1pic.o -Wl,--no-as-needed,--add-needed,-rpath=tmpdir,-rpath-link=tmpdir,-z,defs -Ltmpdir -lneeded1a" ""
725 {dummy.c} {} "needed1a.so"}
726 {"Build needed1b.so with --copy-dt-needed-entries"
727 "-shared tmpdir/libneeded1pic.o -Wl,--no-as-needed,--copy-dt-needed-entries,-rpath=tmpdir,-rpath-link=tmpdir,-z,defs -Ltmpdir -lneeded1a" ""
728 {dummy.c} {} "needed1b.so"}
729 {"Build needed1a.so with --no-add-needed"
730 "-shared tmpdir/libneeded1pic.o -Wl,--no-as-needed,--no-add-needed -Ltmpdir -lneeded1a" ""
731 {dummy.c} {} "needed1c.so"}
732 {"Build needed1b.so with --no-copy-dt-needed-entries"
733 "-shared tmpdir/libneeded1pic.o -Wl,--no-as-needed,--no-copy-dt-needed-entries -Ltmpdir -lneeded1a" ""
734 {dummy.c} {} "needed1d.so"}
735 {"Build librel.so"
736 "-shared" "-fPIC"
737 {rel.c} {} "librel.so"}
738 {"Build libneeded2a.so"
739 "-shared" "-fPIC"
740 {needed2a.c} {} "libneeded2a.so"}
741 {"Build libneeded2b.so"
742 "-shared -Wl,--version-script,needed2.ver" "-fPIC"
743 {needed2b.c} {} "libneeded2b.so"}
744 {"Build libneeded2c.o"
745 "-r -nostdlib" ""
746 {needed2c.c} {} "libneeded2c.o"}
747 {"Build needed2"
748 "tmpdir/libneeded2c.o -Wl,--as-needed tmpdir/libneeded2a.so tmpdir/libneeded2b.so" ""
749 {dummy.c} {} "needed2"}
750 {"Build libneeded3a.so"
751 "-shared -Wl,--no-add-needed" "-fPIC"
752 {needed1a.c} {} "libneeded3a.so"}
753 {"Build libneeded3b.so"
754 "-shared -Wl,--no-as-needed,--add-needed -Ltmpdir -lneeded1b" "-fPIC"
755 {dummy.c} {} "libneeded3b.so"}
756 {"Build needed3.o"
757 "-r -nostdlib" ""
758 {needed3.c} {} "libneeded3.so"}
759 {"Build needed3"
760 "tmpdir/needed3.o -Wl,--as-needed -Ltmpdir -lneeded3a -lneeded3b -lneeded1b" ""
761 {dummy.c} {} "needed3"}
762 {"Build libpr2404a.so"
763 "-shared" "-fPIC"
764 {pr2404a.c} {} "libpr2404a.so"}
765 {"Build libpr2404n.so"
766 "-shared -Wl,-z,now" "-fPIC"
767 {pr2404a.c} {} "libpr2404n.so"}
768 {"Build libpr2404b.a"
769 "" ""
770 {pr2404b.c} {} "libpr2404b.a"}
771 {"Build rdynamic-1"
772 "-Wl,--no-dynamic-linker,-export-dynamic,--gc-sections" "-ffunction-sections"
773 {rdynamic-1.c} {{readelf {-s} rdynamic-1.rd}} "rdynamic-1"}
774 {"Build dynamic-1"
775 "-Wl,--no-dynamic-linker,--dynamic-list,dynamic-1.syms -Wl,--gc-sections" "-ffunction-sections"
776 {dynamic-1.c} {{readelf {-s} dynamic-1.rd}} "dynamic-1"}
777 {"Build libpr16496a.so"
778 "-shared -Wl,--version-script=pr16496a.map" "-fPIC"
779 {pr16496a.c} {} "libpr16496a.so"}
780 {"Build libpr16496b.a"
781 "" "-fPIC"
782 {pr16496b.c} {} "libpr16496b.a"}
783 {"Build libpr16496b.so"
784 "-shared -Wl,--no-as-needed tmpdir/pr16496b.o tmpdir/libpr16496a.so" ""
785 {dummy.c} {{objdump {-R} pr16496b.od}} "libpr16496b.so"}
786 {"Build libpr16452a.so"
787 "-shared -Wl,-soname,libpr16452a.so,--version-script=pr16452.map" "-fPIC"
788 {pr16452a.c} {} "libpr16452a.so"}
789 {"Build libpr16452b.so"
790 "-shared -Wl,-soname,libpr16452b.so,--no-as-needed tmpdir/libpr16452a.so" "-fPIC"
791 {dummy.c} {} "libpr16452b.so"}
792 {"Build pr16452"
793 "-Wl,--no-as-needed,-rpath=tmpdir,-rpath-link=tmpdir tmpdir/libpr16452b.so" ""
794 {pr16452b.c} {{objdump {-p} pr16452.od}} "pr16452"}
795 {"Build pr16457"
796 "-Wl,--no-as-needed,-rpath=tmpdir,-rpath-link=tmpdir tmpdir/libpr16452b.so" ""
797 {pr16452b.c} {{objdump {-p} pr16457.od}} "pr16457"}
798 {"Build libpr18458a.so"
799 "-shared -Wl,-z,now" "-fPIC"
800 {pr18458a.c} {} "libpr18458a.so"}
801 {"Build libpr18458b.so"
802 "-shared -Wl,-z,now tmpdir/libpr18458a.so" "-fPIC"
803 {pr18458b.c} {} "libpr18458b.so"}
804}
805# pr19073.s uses .set, which has a different meaning on alpha.
806if { ![istarget alpha-*-*] } {
807 append build_tests {
808 {"Build pr19073a.o"
809 "-r -nostdlib" ""
810 {pr19073.s} {} "pr19073a.o"}
811 {"Build libpr19073.so"
812 "-shared -Wl,--version-script=pr19073.map tmpdir/pr19073a.o" "-fPIC"
813 {dummy.c} {{readelf {--dyn-syms --wide} pr19073.rd}} "libpr19073.so"}
814 }
815}
816append build_tests {
817 {"Build pr21964-1a.so"
818 "-shared" "-fPIC"
819 {pr21964-1a.c} {} "pr21964-1a.so"}
820 {"Build pr21964-1b.so"
821 "-shared" "-fPIC"
822 {pr21964-1b.c} {} "pr21964-1b.so"}
823 {"Build pr21964-2a.so"
824 "-shared" "-fPIC"
825 {pr21964-2a.c} {} "pr21964-2a.so"}
826 {"Build pr21964-2b.so"
827 "-shared" "-fPIC"
828 {pr21964-2b.c} {} "pr21964-2b.so"}
829 {"Build pr21964-3a.so"
830 "-shared" "-fPIC"
831 {pr21964-3a.c} {} "pr21964-3a.so"}
832 {"Dump pr21978.so"
833 "-shared" "-fPIC -g -O2"
834 {pr21978a.c pr21978b.c} {{objdump {-Sl} pr21978.od}} "pr21978.so"}
835}
836
837run_cc_link_tests $build_tests
838
839run_ld_link_tests [list \
840 [list \
841 "pr22269-1 (static pie undefined weak)" \
842 "-pie -e _start --no-dynamic-linker -z text -z nocombreloc " \
843 "" \
844 "$AFLAGS_PIC" \
845 { pr22269-1.c } \
846 {{readelf -rW pr22269-1.rd}} \
847 "pr22269-1" \
848 "-fPIE -O2" \
849 ] \
850]
851
852set run_tests [list \
853 [list "Run normal with libfoo.so" \
854 "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" "" \
855 {main.c} "normal" "normal.out" ] \
856 [list "Run protected with libfoo.so" \
857 "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoo.so tmpdir/endprotected.o" "" \
858 {main.c} "protected" "normal.out" ] \
859 [list "Run hidden with libfoo.so" \
860 "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoo.so tmpdir/endhidden.o" "" \
861 {main.c} "hidden" "hidden.out" ] \
862 [list "Run normal with versioned libfoo.so" \
863 "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoov.so tmpdir/end.o" "" \
864 {main.c} "normalv" "normal.out" ] \
865 [list "Run warn with versioned libfoo.so" \
866 "-Wl,--no-as-needed tmpdir/beginwarn.o tmpdir/libfoov.so" "" \
867 {main.c} "warn" "warn.out" \
868 "" "c" {^.*beginwarn.c:7: warning: function foo is deprecated\n?$} ] \
869 [list "Run protected with versioned libfoo.so" \
870 "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" "" \
871 {main.c} "protected" "normal.out" ] \
872 [list "Run hidden with versioned libfoo.so" \
873 "-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoov.so tmpdir/endhidden.o" "" \
874 {main.c} "hiddenv" "hidden.out" ] \
875 [list "Run normal libbar.so with libfoo.so" \
876 "-Wl,--no-as-needed tmpdir/libbarfoo.so tmpdir/libfoo.so" "" \
877 {main.c} "normal" "normal.out" ] \
878 [list "Run protected libbar.so with libfoo.so" \
879 "-Wl,--no-as-needed tmpdir/libbarpfoo.so tmpdir/libfoo.so" "" \
880 {main.c} "protected" "normal.out" ] \
881 [list "Run hidden libbar.so with libfoo.so" \
882 "-Wl,--no-as-needed tmpdir/libbarhfoo.so tmpdir/libfoo.so" "" \
883 {main.c} "hidden" "hidden.out" ] \
884 [list "Run normal libbar.so with versioned libfoo.so" \
885 "-Wl,--no-as-needed tmpdir/libbarfoov.so tmpdir/libfoov.so" "" \
886 {main.c} "normal" "normal.out" ] \
887 [list "Run protected libbar.so with versioned libfoo.so" \
888 "-Wl,--no-as-needed tmpdir/libbarpfoov.so tmpdir/libfoov.so" "" \
889 {main.c} "protected" "normal.out" ] \
890 [list "Run hidden libbar.so with versioned libfoo.so" \
891 "-Wl,--no-as-needed tmpdir/libbarhfoov.so tmpdir/libfoov.so" "" \
892 {main.c} "hidden" "hidden.out" ] \
893 [list "Run with libdl2a.so" \
894 "-Wl,--no-as-needed tmpdir/libdl2a.so" "" \
895 {dl2main.c} "dl2a" "dl2a.out" ] \
896 [list "Run with libdl2b.so" \
897 "-Wl,--no-as-needed tmpdir/libdl2b.so" "" \
898 {dl2main.c} "dl2b" "dl2b.out" ] \
899 [list "Run with libdl2c.so" \
900 "-Wl,--no-as-needed tmpdir/libdl2c.so" "" \
901 {dl2main.c} "dl2c" "dl2b.out" ] \
902 [list "Run with libdl2d.so" \
903 "-Wl,--no-as-needed tmpdir/libdl2d.so" "" \
904 {dl2main.c} "dl2d" "dl2a.out" ] \
905 [list "Run with libdl2e.so" \
906 "-Wl,--no-as-needed tmpdir/libdl2e.so" "" \
907 {dl2main.c} "dl2e" "dl2b.out" ] \
908 [list "Run with libdl2f.so" \
909 "-Wl,--no-as-needed tmpdir/libdl2f.so" "" \
910 {dl2main.c} "dl2f" "dl2a.out" ] \
911 [list "Run with libdl2g.so" \
912 "-Wl,--no-as-needed tmpdir/libdl2g.so" "" \
913 {dl2main.c} "dl2g" "dl2b.out" ] \
914 [list "Run with libdl2h.so" \
915 "-Wl,--no-as-needed tmpdir/libdl2h.so" "" \
916 {dl2main.c} "dl2h" "dl2a.out" ] \
917 [list "Run with libdl2i.so" \
918 "-Wl,--no-as-needed tmpdir/libdl2i.so" "" \
919 {dl2main.c} "dl2i" "dl2a.out" ] \
920 [list "Run with libdl2j.so" \
921 "-Wl,--no-as-needed tmpdir/libdl2j.so" "" \
922 {dl2main.c} "dl2j" "dl2a.out" ] \
923 [list "Run with libdl2k.so" \
924 "-Wl,--no-as-needed tmpdir/libdl2k.so" "" \
925 {dl2main.c} "dl2k" "dl2a.out" ] \
926 [list "Run with libdl4a.so" \
927 "-Wl,--no-as-needed tmpdir/libdl4a.so" "" \
928 {dl4main.c} "dl4a" "dl4a.out" ] \
929 [list "Run with libdl4b.so" \
930 "-Wl,--no-as-needed tmpdir/libdl4b.so" "" \
931 {dl4main.c} "dl4b" "dl4a.out" ] \
932 [list "Run with libdl4c.so" \
933 "-Wl,--no-as-needed tmpdir/libdl4c.so" "" \
934 {dl4main.c} "dl4c" "dl4b.out" ] \
935 [list "Run with libdl4d.so" \
936 "-Wl,--no-as-needed tmpdir/libdl4d.so" "" \
937 {dl4main.c} "dl4d" "dl4b.out" ] \
938 [list "Run with libdl4e.so" \
939 "-Wl,--no-as-needed tmpdir/libdl4e.so" "" \
940 {dl4main.c} "dl4e" "dl4e.out" ] \
941 [list "Run with libdl4f.so" \
942 "-Wl,--no-as-needed tmpdir/libdl4f.so" "" \
943 {dl4main.c} "dl4f" "dl4e.out" ] \
944 [list "Run with libdata1.so" \
945 "-Wl,--no-as-needed tmpdir/libdata1.so" "" \
946 {dynbss1.c} "dynbss1" "pass.out" ] \
947 [list "Run with libdata2.so" \
948 "-Wl,--no-as-needed tmpdir/libdata2.so" "" \
949 {weakdef1.c} "weakdef1" "pass.out" ] \
950 [list "Run with libfunc1.so comm1.o" \
951 "-Wl,--no-as-needed tmpdir/libfunc1.so tmpdir/comm1.o" "" \
952 {dummy.c} "comm1" "pass.out" ] \
953 [list "Run with comm1.o libfunc1.so" \
954 "-Wl,--no-as-needed tmpdir/comm1.o tmpdir/libfunc1.so" "" \
955 {dummy.c} "comm1" "pass.out" ] \
956 [list "Run with pr11138-2.c libpr11138-1.so" \
957 "-Wl,--no-as-needed,--version-script=pr11138-2.map tmpdir/pr11138-2.o tmpdir/libpr11138-1.so" "" \
958 {dummy.c} "pr11138a" "pr11138.out" ] \
959 [list "Run with libpr11138-1.so pr11138-2.c" \
960 "-Wl,--no-as-needed,--version-script=pr11138-2.map tmpdir/libpr11138-1.so tmpdir/pr11138-2.o" "" \
961 {dummy.c} "pr11138b" "pr11138.out" ] \
962 [list "Run with pr13250-3.c, libpr13250-1.so and libpr13250-2.so" \
963 "-Wl,--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" "-fcommon" \
964 {dummy.c} "pr13250" "pass.out" ] \
965 [list "Run with pr14323-1.c pr14323-2.so" \
966 "-Wl,--no-as-needed tmpdir/libpr14323-2.so" "" \
967 {pr14323-1.c} "pr14323" "pass.out" ] \
968 [list "Run with pr14862-1.c libpr14862.so" \
969 "-Wl,--as-needed tmpdir/libpr14862-1.o tmpdir/libpr14862.so" "" \
970 {dummy.c} "pr14862" "pr14862.out" ] \
971 [list "Link with --add-needed" \
972 "tmpdir/libneeded1c.o -Wl,--no-as-needed,--add-needed,-rpath=tmpdir,-rpath-link=tmpdir -Ltmpdir -lneeded1a" "" \
973 {dummy.c} "needed1a" "needed1.out" ] \
974 [list "Link with --copy-dt-needed-entries" \
975 "tmpdir/libneeded1c.o -Wl,--no-as-needed,--copy-dt-needed-entries,-rpath=tmpdir,-rpath-link=tmpdir -Ltmpdir -lneeded1a" "" \
976 {dummy.c} "needed1b" "needed1.out" ] \
977 [list "Run relmain" \
978 "-Wl,--no-as-needed,-rpath=tmpdir -Ltmpdir -lrel" "" \
979 {relmain.c} "relmain" "relmain.out" ] \
980 [list "Run pr2404" \
981 "-Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" "" \
982 {dummy.c} "pr2404" "pr2404.out" ] \
983 [list "Run pr2404n" \
984 "-Wl,-z,now -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" "" \
985 {dummy.c} "pr2404n" "pr2404.out" ] \
986 [list "Run pr18458" \
987 "-Wl,--no-as-needed,-z,now tmpdir/libpr18458a.so tmpdir/libpr18458b.so" "" \
988 {pr18458c.c} "pr18458" "pass.out" ] \
989 [list "Run pr21964-1" \
990 "-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-1a.so tmpdir/pr21964-1b.so" "" \
991 {pr21964-1c.c} "pr21964-1" "pass.out" ] \
992 [list "Run pr21964-3" \
993 "-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-1a.so tmpdir/pr21964-1b.so tmpdir/pr21964-3a.so" "" \
994 {pr21964-3c.c} "pr21964-3" "pass.out" ] \
995]
996
997# NetBSD ELF systems do not currently support the .*_array sections.
998run_ld_link_exec_tests $run_tests "*-*-netbsdelf*"
999
1000# These tests require dlopen support.
1001set dlopen_run_tests [list \
1002 [list "Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so" \
1003 "-Wl,--no-as-needed,--dynamic-list=dl1.list $extralibs" "" \
1004 {dl1main.c} "dl1a" "dl1.out" ] \
1005 [list "Run dl1b with --dynamic-list-data and dlopen on libdl1.so" \
1006 "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
1007 {dl1main.c} "dl1b" "dl1.out" ] \
1008 [list "Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so" \
1009 "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
1010 {dl6amain.c} "dl6a1" "dl6a.out" ] \
1011 [list "Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so" \
1012 "$NOPIE_LDFLAGS -Wl,--no-as-needed,-Bsymbolic-functions $extralibs" "" \
1013 {dl6amain.c} "dl6a2" "dl6b.out" "$NOPIE_CFLAGS" ] \
1014 [list "Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so" \
1015 "-Wl,--no-as-needed,-Bsymbolic $extralibs" "" \
1016 {dl6amain.c} "dl6a3" "dl6b.out" ] \
1017 [list "Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so" \
1018 "-Wl,--no-as-needed,-Bsymbolic,--dynamic-list-data $extralibs" "" \
1019 {dl6amain.c} "dl6a4" "dl6a.out" ] \
1020 [list "Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so" \
1021 "$NOPIE_LDFLAGS -Wl,--no-as-needed,-Bsymbolic-functions,--dynamic-list-cpp-new $extralibs" "" \
1022 {dl6amain.c} "dl6a5" "dl6b.out" "$NOPIE_CFLAGS" ] \
1023 [list "Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so" \
1024 "$NOPIE_LDFLAGS -Wl,--no-as-needed,--dynamic-list-cpp-new,-Bsymbolic-functions $extralibs" "" \
1025 {dl6amain.c} "dl6a6" "dl6b.out" "$NOPIE_CFLAGS" ] \
1026 [list "Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so" \
1027 "$NOPIE_LDFLAGS -Wl,--no-as-needed,--dynamic-list-data,-Bsymbolic $extralibs" "" \
1028 {dl6amain.c} "dl6a7" "dl6a.out" "$NOPIE_CFLAGS" ] \
1029 [list "Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so" \
1030 "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
1031 {dl6bmain.c} "dl6b1" "dl6a.out" ] \
1032 [list "Run dl6b2 with dlopen on libdl6b.so" \
1033 "-Wl,--no-as-needed $extralibs" "" \
1034 {dl6bmain.c} "dl6b2" "dl6b.out" ] \
1035 [list "Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so" \
1036 "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
1037 {dl6cmain.c} "dl6c1" "dl6b.out" ] \
1038 [list "Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so" \
1039 "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
1040 {dl6dmain.c} "dl6d1" "dl6a.out" ] \
1041 [list "Run pr21964-2" \
1042 "-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-2a.so $extralibs" "" \
1043 {pr21964-2c.c} "pr21964-2" "pass.out" ] \
1044 [list "Run pr21964-5" \
1045 "-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-1a.so $extralibs" "" \
1046 {pr21964-5.c} "pr21964-5" "pass.out" ] \
1047]
1048
1049# Only run them when libdl is available.
1050if [check_libdl_available] {
1051 # XFAIL on NetBSD ELF systems as they do not currently support the .*_array
1052 # sections.
1053 run_ld_link_exec_tests $dlopen_run_tests "*-*-netbsdelf*"
1054}
1055
1056# Check --no-add-needed and --no-copy-dt-needed-entries
1057set testname "--no-add-needed"
1058set exec_output [run_host_cmd "$CC" "tmpdir/libneeded1c.o -Wl,--no-add-needed,-rpath-link=tmpdir -Ltmpdir -lneeded1a"]
1059if { [ regexp "tmpdir/libneeded1b.so: .*: DSO missing" $exec_output ] } {
1060 pass $testname
1061} {
1062 fail $testname
1063}
1064set testname "--no-copy-dt-needed-entries"
1065set exec_output [run_host_cmd "$CC" "tmpdir/libneeded1c.o -Wl,--no-copy-dt-needed-entries,-rpath-link=tmpdir -Ltmpdir -lneeded1a"]
1066if { [ regexp "tmpdir/libneeded1b.so: .*: DSO missing" $exec_output ] } {
1067 pass $testname
1068} {
1069 fail $testname
1070}
1071set testname "--no-add-needed -shared"
1072set exec_output [run_host_cmd "$CC" "-shared tmpdir/libneeded1pic.o -Wl,--no-add-needed,-z,defs -Ltmpdir -lneeded1a"]
1073if { [ regexp "undefined reference to `\.?bar'" $exec_output ] } {
1074 pass $testname
1075} {
1076 fail $testname
1077}
1078set testname "--no-copy-dt-needed-entries -shared"
1079set exec_output [run_host_cmd "$CC" "-shared tmpdir/libneeded1pic.o -Wl,--no-copy-dt-needed-entries,-z,defs -Ltmpdir -lneeded1a"]
1080if { [ regexp "undefined reference to `\.?bar'" $exec_output ] } {
1081 pass $testname
1082} {
1083 fail $testname
1084}
1085
1086# Check to see if the C++ compiler works
1087if { [which $CXX] == 0 } {
1088 return
1089}
1090
1091set build_cxx_tests {
1092 {"Build libdl3a.so with --dynamic-list=dl3.list"
1093 "-shared -Wl,--dynamic-list=dl3.list" "-fPIC"
1094 {dl3.cc} {} "libdl3a.so" "c++"}
1095 {"Build libdl3b.so with -Bsymbolic"
1096 "-shared -Wl,-Bsymbolic" "-fPIC"
1097 {dl3.cc} {} "libdl3b.so" "c++"}
1098 {"Build libdl3a.so with --dynamic-list-cpp-typeinfo"
1099 "-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC"
1100 {dl3.cc} {} "libdl3c.so" "c++"}
1101 {"Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new"
1102 "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC -ansi"
1103 {del.cc new.cc} {} "libnew1a.so" "c++"}
1104 {"Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new"
1105 "-shared -Wl,--dynamic-list-data,--dynamic-list-cpp-new" "-fPIC -ansi"
1106 {del.cc new.cc} {} "libnew1b.so" "c++"}
1107}
1108
1109# "-shared -Bsymbolic" only works with gcc 4.5.0 and newer.
1110# {"Run with libdl3b.so"
1111# "tmpdir/libdl3b.so" ""
1112# {dl3main.cc} "dl3b" "dl3b.out" "" "c++"}
1113set run_cxx_tests {
1114 {"Run with libdl3a.so"
1115 "-Wl,--no-as-needed tmpdir/libdl3a.so" ""
1116 {dl3main.cc} "dl3a" "dl3a.out" "" "c++"}
1117 {"Run with libdl3c.so"
1118 "-Wl,--no-as-needed tmpdir/libdl3c.so" ""
1119 {dl3main.cc} "dl3c" "dl3a.out" "" "c++"}
1120 {"Run with libnew1a.so"
1121 "-Wl,--no-as-needed tmpdir/libnew1a.so" ""
1122 {dl5.cc} "dl5a" "dl5.out" "-ansi" "c++"}
1123 {"Run with libnew1b.so"
1124 "-Wl,--no-as-needed tmpdir/libnew1b.so" ""
1125 {dl5.cc} "dl5b" "dl5.out" "-ansi" "c++"}
1126}
1127
1128run_cc_link_tests $build_cxx_tests
1129run_ld_link_exec_tests $run_cxx_tests
1130
1131if { [istarget *-*-linux*]
1132 || [istarget *-*-nacl*]
1133 || [istarget *-*-gnu*] } {
1134 run_cc_link_tests [list \
1135 [list \
1136 "Build libpr2404b.a with PIE" \
1137 "" \
1138 "-fPIE" \
1139 { pr2404b.c } \
1140 {} \
1141 "libpr2404b.a" \
1142 ] \
1143 [list \
1144 "Build pr19579a.o" \
1145 "" "-fPIE -fcommon" \
1146 {pr19579a.c} \
1147 {} \
1148 "libpr19579a.a" \
1149 ] \
1150 [list \
1151 "Build libpr19579.so" \
1152 "-shared" \
1153 "-fPIC -fcommon" \
1154 {pr19579b.c} \
1155 {} \
1156 "libpr19579.so" \
1157 ] \
1158 [list \
1159 "Build libpr19579now.so" \
1160 "-shared -Wl,-z,now" \
1161 "-fPIC -fcommon" \
1162 {pr19579b.c} \
1163 {} \
1164 "libpr19579.so" \
1165 ] \
1166 [list \
1167 "Build pr22393-2a.so" \
1168 "-shared -Wl,-z,separate-code" \
1169 "-fPIC" \
1170 {pr22393-2a.c} \
1171 {{readelf -lW pr22393-2a.rd} \
1172 {readelf -lW pr22393-2b.rd}} \
1173 "pr22393-2a.so" \
1174 ] \
1175 [list \
1176 "Build pr22393-2a-now.so" \
1177 "-shared -Wl,-z,separate-code,-z,now" \
1178 "-fPIC" \
1179 {pr22393-2a.c} \
1180 {{readelf -lW pr22393-2a.rd} \
1181 {readelf -lW pr22393-2b.rd}} \
1182 "pr22393-2a-now.so" \
1183 ] \
1184 [list \
1185 "Build pr22393-2" \
1186 "$NOPIE_LDFLAGS -Wl,-z,separate-code,--no-as-needed tmpdir/pr22393-2a.so" \
1187 "$NOPIE_CFLAGS" \
1188 {pr22393-2b.c} \
1189 {{readelf -lW pr22393-2a.rd} \
1190 {readelf -lW pr22393-2b.rd}} \
1191 "pr22393-2" \
1192 ] \
1193 [list \
1194 "Build pr22393-2 (PIE)" \
1195 "-pie -Wl,-z,separate-code,--no-as-needed tmpdir/pr22393-2a-now.so" \
1196 "-fPIE" \
1197 {pr22393-2b.c} \
1198 {{readelf -lW pr22393-2a.rd} \
1199 {readelf -lW pr22393-2b.rd}} \
1200 "pr22393-2-pie" \
1201 ] \
1202 [list \
1203 "Build pr22393-2 (static)" \
1204 "-static -Wl,-z,separate-code" \
1205 "" \
1206 {pr22393-2a.c pr22393-2b.c} \
1207 {{readelf -lW pr22393-2a.rd} \
1208 {readelf -lW pr22393-2b.rd}} \
1209 "pr22393-2-static" \
1210 ] \
1211 ]
1212 run_ld_link_exec_tests [list \
1213 [list \
1214 "Run pr18458 with PIE" \
1215 "-pie -Wl,--no-as-needed,-z,now tmpdir/libpr18458a.so tmpdir/libpr18458b.so" \
1216 "" \
1217 {pr18458c.c} \
1218 "pr18458p" \
1219 "pass.out" \
1220 "-fPIE" \
1221 ] \
1222 [list \
1223 "Run pr2404 with PIE" \
1224 "-pie -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" \
1225 "" \
1226 { dummy.c } \
1227 "pr2404pie" \
1228 "pr2404.out" \
1229 "-fPIE" \
1230 ] \
1231 [list \
1232 "Run pr2404 with PIE (-z now)" \
1233 "-pie -Wl,-z,now -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" \
1234 "" \
1235 { dummy.c } \
1236 "pr2404pien" \
1237 "pr2404.out" \
1238 "-fPIE" \
1239 ] \
1240 [list \
1241 "Run pr18718" \
1242 "" \
1243 "" \
1244 { pr18718.c check-ptr-eq.c } \
1245 "pr18718" \
1246 "pass.out" \
1247 "-O2 -I../bfd" \
1248 ] \
1249 [list \
1250 "Run pr18718 (-z now)" \
1251 "-Wl,-z,now" \
1252 "" \
1253 { pr18718.c check-ptr-eq.c } \
1254 "pr18718" \
1255 "pass.out" \
1256 "-O2 -I../bfd" \
1257 ] \
1258 [list \
1259 "Run pr18718 with PIE (1)" \
1260 "-pie" \
1261 "" \
1262 { pr18718.c check-ptr-eq.c } \
1263 "pr18718pie1" \
1264 "pass.out" \
1265 "-O2 -fPIE -I../bfd" \
1266 ] \
1267 [list \
1268 "Run pr18718 with PIE (2)" \
1269 "" \
1270 "" \
1271 { pr18718.c check-ptr-eq.c } \
1272 "pr18718pie2" \
1273 "pass.out" \
1274 "-O2 -fPIE -I../bfd" \
1275 ] \
1276 [list \
1277 "Run pr18718 with PIE (3)" \
1278 "-pie -Wl,-z,now" \
1279 "" \
1280 { pr18718.c check-ptr-eq.c } \
1281 "pr18718pie3" \
1282 "pass.out" \
1283 "-O2 -fPIE -I../bfd" \
1284 ] \
1285 [list \
1286 "Run pr18718 with PIE (4)" \
1287 "-Wl,-z,now" \
1288 "" \
1289 { pr18718.c check-ptr-eq.c } \
1290 "pr18718pie4" \
1291 "pass.out" \
1292 "-O2 -fPIE -I../bfd" \
1293 ] \
1294 [list \
1295 "Run pr18718 with PIC (1)" \
1296 "" \
1297 "" \
1298 { pr18718.c check-ptr-eq.c } \
1299 "pr18718pic1" \
1300 "pass.out" \
1301 "-O2 -fPIC -I../bfd" \
1302 ] \
1303 [list \
1304 "Run pr18718 with PIC (2)" \
1305 "-pie" \
1306 "" \
1307 { pr18718.c check-ptr-eq.c } \
1308 "pr18718pic2" \
1309 "pass.out" \
1310 "-O2 -fPIC -I../bfd" \
1311 ] \
1312 [list \
1313 "Run pr18718 with PIC (3)" \
1314 "-Wl,-z,now" \
1315 "" \
1316 { pr18718.c check-ptr-eq.c } \
1317 "pr18718pic3" \
1318 "pass.out" \
1319 "-O2 -fPIC -I../bfd" \
1320 ] \
1321 [list \
1322 "Run pr18718 with PIC (4)" \
1323 "-pie -Wl,-z,now" \
1324 "" \
1325 { pr18718.c check-ptr-eq.c } \
1326 "pr18718pic4" \
1327 "pass.out" \
1328 "-O2 -fPIC -I../bfd" \
1329 ] \
1330 [list \
1331 "Run pr19579" \
1332 "-pie -Wl,--no-as-needed,-z,text tmpdir/pr19579a.o tmpdir/libpr19579.so" \
1333 "" \
1334 {dummy.c} \
1335 "pr19579" \
1336 "pass.out" \
1337 "-fPIE" \
1338 ] \
1339 [list \
1340 "Run pr19579 (-z now)" \
1341 "-pie -Wl,-z,now -Wl,--no-as-needed,-z,text tmpdir/pr19579a.o tmpdir/libpr19579.so" \
1342 "" \
1343 {dummy.c} \
1344 "pr19579n" \
1345 "pass.out" \
1346 "-fPIE" \
1347 ] \
1348 [list \
1349 "Run pr22393-2" \
1350 "$NOPIE_LDFLAGS -Wl,-z,separate-code,--no-as-needed tmpdir/pr22393-2a.so" \
1351 "" \
1352 {pr22393-2b.c} \
1353 "pr22393-2" \
1354 "pass.out" \
1355 "$NOPIE_CFLAGS" \
1356 ] \
1357 [list \
1358 "Run pr22393-2 (PIE)" \
1359 "-pie -Wl,-z,separate-code,--no-as-needed tmpdir/pr22393-2a-now.so" \
1360 "" \
1361 {pr22393-2b.c} \
1362 "pr22393-2-pie" \
1363 "pass.out" \
1364 "-fPIE" \
1365 ] \
1366 [list \
1367 "Run pr22393-2 (static)" \
1368 "-static -Wl,-z,separate-code" \
1369 "" \
1370 {pr22393-2a.c pr22393-2b.c} \
1371 "pr22393-2-static" \
1372 "pass.out" \
1373 ] \
1374 [list \
1375 "Run pr21964-4" \
1376 "" \
1377 "" \
1378 {pr21964-4.c} \
1379 "pr21964-4" \
1380 "pass.out" \
1381 "" \
1382 "" \
1383 "" \
1384 "-ldl" \
1385 ] \
1386 ]
1387}
1388
1389proc mix_pic_and_non_pic {xfails cflags ldflags exe} {
1390 run_cc_link_tests [list \
1391 [list \
1392 "Build libpr19719a.so" \
1393 "-shared -Wl,-soname,libpr19719.so" \
1394 "-fPIC" \
1395 { pr19719d.c } \
1396 {} \
1397 "libpr19719a.so" \
1398 ] \
1399 [list \
1400 "Build libpr19719b.so" \
1401 "-shared -Wl,-soname,libpr19719.so" \
1402 "-fPIC" \
1403 { dummy.c } \
1404 {} \
1405 "libpr19719b.so" \
1406 ] \
1407 [list \
1408 "Build libpr19719b.o" \
1409 "-r -nostdlib" \
1410 "-fPIC" \
1411 { pr19719b.c } \
1412 {} \
1413 "libpr19719b.o" \
1414 ] \
1415 ]
1416
1417 send_log "cp tmpdir/libpr19719b.so tmpdir/libpr19719.so\n"
1418 exec cp tmpdir/libpr19719b.so tmpdir/libpr19719.so
1419
1420 run_ld_link_exec_tests [list \
1421 [list \
1422 "Run $exe fun defined" \
1423 "-Wl,--no-as-needed,-rpath,tmpdir $ldflags tmpdir/libpr19719b.o tmpdir/libpr19719.so" \
1424 "" \
1425 { pr19719a.c pr19719c.c } \
1426 $exe \
1427 "pass.out" \
1428 "$cflags" \
1429 ] \
1430 ]
1431
1432 send_log "cp tmpdir/libpr19719a.so tmpdir/libpr19719.so\n"
1433 exec cp tmpdir/libpr19719a.so tmpdir/libpr19719.so
1434
1435 foreach targ $xfails {
1436 setup_xfail $targ
1437 }
1438
1439 if ![isnative] {
1440 unsupported "Run $exe fun undefined"
1441 return
1442 }
1443
1444 set exec_output [run_host_cmd "tmpdir/$exe" ""]
1445 if {![string match "PASS" $exec_output]} {
1446 fail "Run $exe fun undefined"
1447 } else {
1448 pass "Run $exe fun undefined"
1449 }
1450}
1451
1452mix_pic_and_non_pic [list "arm*-*-*" "aarch64*-*-*"] "" "" "pr19719"
1453mix_pic_and_non_pic [] "-fPIE" "-pie" "pr19719pie"
1454
1455set AFLAGS_PIE ""
1456if { [istarget "i?86-*-*"]
1457 || [istarget "x86_64-*-*"] } {
1458 set AFLAGS_PIE "-mrelax-relocations=yes"
1459}
1460
1461if { ([istarget "*-*-linux*"]
1462 || [istarget "*-*-nacl*"]
1463 || [istarget "*-*-gnu*"])
1464 && ![istarget "mips*-*-*"] } {
1465 run_ld_link_tests [list \
1466 [list \
1467 "Build libpr23162a.so" \
1468 "-shared" \
1469 "" \
1470 "$AFLAGS_PIC" \
1471 { pr23162a.c } \
1472 "" \
1473 "libpr23162a.so" \
1474 "-fPIC -O2" \
1475 ] \
1476 [list \
1477 "Build pr23162a" \
1478 "-pie --no-as-needed tmpdir/libpr23162a.so" \
1479 "" \
1480 $AFLAGS_PIE \
1481 { pr23162b.c } \
1482 {{readelf {-rW} pr23162.rd}} \
1483 "pr23162a" \
1484 "-fPIC -O0" \
1485 ] \
1486 [list \
1487 "Build libpr23162b.so" \
1488 "-shared --version-script=pr23162.map" \
1489 "" \
1490 "$AFLAGS_PIC" \
1491 { pr23162a.c } \
1492 "" \
1493 "libpr23162b.so" \
1494 "-fPIC -O2" \
1495 ] \
1496 [list \
1497 "Build pr23162b" \
1498 "-pie --no-as-needed tmpdir/libpr23162b.so" \
1499 "" \
1500 $AFLAGS_PIE \
1501 { pr23162b.c } \
1502 {{readelf {-rW} pr23162.rd}} \
1503 "pr23162b" \
1504 "-fPIC -O0" \
1505 ] \
1506 [list \
1507 "Build libpr23161a.so" \
1508 "-shared" \
1509 "" \
1510 "$AFLAGS_PIC" \
1511 { pr23161a.c } \
1512 {{readelf {--dyn-syms -rW} pr23161a.rd}} \
1513 "libpr23161a.so" \
1514 "-fPIC -O2 $NOSANTIZE_CFLAGS" \
1515 ] \
1516 [list \
1517 "Build pr23161a" \
1518 "-pie --no-as-needed tmpdir/libpr23161a.so" \
1519 "" \
1520 $AFLAGS_PIE \
1521 { pr23161b.c } \
1522 {{readelf {--dyn-syms -rW} pr23161b.rd}} \
1523 "pr23161a" \
1524 "-fPIC -O0 $NOSANTIZE_CFLAGS" \
1525 ] \
1526 [list \
1527 "Build libpr23161b.so" \
1528 "-shared --version-script=pr23161.map" \
1529 "" \
1530 "$AFLAGS_PIC" \
1531 { pr23161a.c } \
1532 {{readelf {--dyn-syms -rW} pr23161a.rd}} \
1533 "libpr23161b.so" \
1534 "-fPIC -O2 $NOSANTIZE_CFLAGS" \
1535 ] \
1536 [list \
1537 "Build pr23161b" \
1538 "-pie --no-as-needed tmpdir/libpr23161b.so" \
1539 "" \
1540 $AFLAGS_PIE \
1541 { pr23161b.c } \
1542 {{readelf {--dyn-syms -rW} pr23161b.rd}} \
1543 "pr23161b" \
1544 "-fPIC -O0 $NOSANTIZE_CFLAGS" \
1545 ] \
1546 ]
1547}
1548
1549if { [istarget "i?86-*-*"]
1550 || [istarget "x86_64-*-*"] } {
1551 run_ld_link_tests [list \
1552 [list \
1553 "Build libpr23161c.so" \
1554 "-shared" \
1555 "" \
1556 "$AFLAGS_PIC" \
1557 { pr23161c.c } \
1558 {{readelf {--dyn-syms -rW} pr23161c.rd}} \
1559 "libpr23161c.so" \
1560 "-fPIC -O2 $NOSANTIZE_CFLAGS" \
1561 ] \
1562 [list \
1563 "Build pr23161c" \
1564 "-pie --no-as-needed tmpdir/libpr23161c.so" \
1565 "" \
1566 $AFLAGS_PIE \
1567 { pr23161b.c } \
1568 {{readelf {--dyn-syms -rW} pr23161d.rd}} \
1569 "pr23161c" \
1570 "-fPIC -O0 $NOSANTIZE_CFLAGS" \
1571 ] \
1572 ]
1573}
1574
1575run_ld_link_tests [list \
1576 [list "Build pr23658.so" \
1577 "-shared" "" "$AFLAGS_PIC" \
1578 {pr23658-1a.s} {} "pr23658.so"] \
1579 [list \
1580 "Build pr23658-2" \
1581 "--dynamic-linker tmpdir/pr23658.so --no-as-needed tmpdir/pr23658.so" \
1582 "" \
1583 $AFLAGS_NOTE \
1584 { pr23658-1a.s pr23658-1b.s pr23658-1c.s pr23658-1d.s start.s } \
1585 {{readelf {-lW} pr23658-2.rd}} \
1586 "pr23658-2" \
1587 ] \
1588]
This page took 0.028378 seconds and 4 git commands to generate.