-# Only run these tests on targets that support creating shared libraries.
-if { [check_shared_lib_support] } then {
- # Run a test to check linking a shared library with a broken linker
- # script that accidentally marks dynamic sections as notes. The
- # resulting executable is not expected to work, but the linker
- # should not seg-fault whilst creating the binary.
- setup_xfail "tic6x-*-*"
- run_ld_link_tests {
- {"Build shared library for next test"
- "-shared" "" "" "note-3.s" {} "note-3.so" }
- {"Link using broken linker script"
- "--script note-3.t tmpdir/note-3.so" "" "" ""
- { { ld "note-3.l" } }
- "a.out" }
- }
- setup_xfail "tic6x-*-*"
- run_ld_link_tests {
- {"Build pr17068.so"
- "-shared" "" ""
- {pr17068d.s} {} "pr17068.so"}
- {"Build pr17068a.a"
- "" "" ""
- {pr17068a.s pr17068c.s pr17068ez.s} {} "pr17068a.a"}
- {"Build pr17068b.a"
- "" "" ""
- {pr17068b.s pr17068e.s} {} "pr17068b.a"}
- }
- # bfin does not currently support copy relocs.
- setup_xfail "bfin-*-*"
- run_ld_link_tests {
- {"pr17068 link --as-needed lib in group"
- "--as-needed --no-dynamic-linker" "--start-group tmpdir/pr17068a.a tmpdir/pr17068.so tmpdir/pr17068b.a --end-group" ""
- {start.s pr17068.s} {} "pr17068"}
- }
- # xfail on tic6x due to non-PIC/non-PID warnings
- setup_xfail "tic6x-*-*"
- # Fails on MIPS because ABI trickery means that a NULL reloc is also emitted.
- setup_xfail "mips*-*-*"
- # Fails on bfin because relocations are not created.
- setup_xfail "bfin-*-*"
- run_ld_link_tests {
- {"-Bsymbolic-functions"
- "-shared -Bsymbolic-functions" "" ""
- {symbolic-func.s} {{readelf {-r --wide} symbolic-func.r}}
- "symbolic-func.so"}
- }
- # xfail on tic6x due to non-PIC/non-PID warnings
- setup_xfail "tic6x-*-*"
- run_ld_link_tests {
- {"Build pr20995.so"
- "-shared" "" ""
- {pr20995b.s} {} "pr20995.so"}
- }
- # These targets don't copy dynamic variables into .bss.
- setup_xfail "alpha-*-*" "bfin-*-*" "ia64-*-*" "xtensa-*-*"
- run_ld_link_tests {
- {"pr20995"
- "" "tmpdir/pr20995.so" ""
- {pr20995a.s} {{readelf {-S --wide} pr20995.r}} "pr20995"}
- }
+
+
+# Targets that use _bfd_generic_link_add_symbols won't pass pr21703 tests
+run_ld_link_tests {
+ {"PR ld/21703"
+ "--allow-multiple-definition tmpdir/pr21703-1.o tmpdir/pr21703-2.o" "" "" \
+ {pr21703-1.s pr21703-2.s} {{readelf {-s} pr21703.sd}} "pr21703" }
+ {"PR ld/21703 -r"
+ "-r --allow-multiple-definition tmpdir/pr21703-3.o tmpdir/pr21703-4.o" "" "" \
+ {pr21703-3.s pr21703-4.s} {{readelf {-s} pr21703-r.sd}} "pr21703.o" }
+} \[is_generic\]
+
+if [is_underscore_target] {
+ set ASFLAGS "$ASFLAGS --defsym UNDERSCORE=1"
+}
+
+global ASFLAGS
+set saved_ASFLAGS "$ASFLAGS"
+if { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
+ set ASFLAGS "$ASFLAGS -mx86-used-note=no"