+
+ 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.
+ 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"}
+ } "bfin-*-*"
+
+ # xfail on tic6x due to non-PIC/non-PID warnings
+ # Fails on MIPS because ABI trickery means that a NULL reloc is emitted.
+ # Fails on bfin because relocations are not created.
+ run_ld_link_tests {
+ {"-Bsymbolic-functions"
+ "-shared -Bsymbolic-functions" "" ""
+ {symbolic-func.s} {{readelf {-r --wide} symbolic-func.r}}
+ "symbolic-func.so"}
+ } "tic6x-*-*" "mips*-*-*" "bfin-*-*"
+
+ # xfail on tic6x due to non-PIC/non-PID warnings
+ run_ld_link_tests {
+ {"Build pr20995.so"
+ "-shared" "" ""
+ {pr20995b.s} {} "pr20995.so"}
+ } "tic6x-*-*"
+
+ # xfail on arm*-*-eabi*. The list can be enlarged to those targets that
+ # don't support GNU_RELRO. For more details, please see discussions at:
+ # https://sourceware.org/ml/binutils/2017-01/msg00441.html
+ run_ld_link_tests {
+ {"Build pr20995-2.so"
+ "-shared -z relro" "" ""
+ {pr20995c.s} {{readelf {-l --wide} pr20995-2so.r}} "pr20995-2.so"}
+ } "tic6x-*-*" "arm*-*-eabi*" "hppa*64*-*-hpux*"
+
+ # These targets don't copy dynamic variables into .bss.
+ setup_xfail "alpha-*-*" "bfin-*-*" "ia64-*-*" "xtensa-*-*"
+ # or don't have .data.rel.ro
+ setup_xfail "hppa*64*-*-hpux*"
+ run_ld_link_tests [list \
+ [list \
+ "pr20995" \
+ "" "tmpdir/pr20995.so" "$AFLAGS_NONPIC" \
+ {pr20995a.s} {{readelf {-S --wide} pr20995.r}} "pr20995"]]
+
+ # xfail on arm*-*-eabi* is particularly because of no support of GNU_RELRO.
+ # Please see the link above for details.
+ setup_xfail "alpha-*-*" "bfin-*-*" "ia64-*-*" "xtensa-*-*" "arm*-*-eabi*"
+ setup_xfail "hppa*64*-*-hpux*"
+ run_ld_link_tests [list \
+ [list \
+ "pr20995-2" \
+ "" "tmpdir/pr20995-2.so" "$AFLAGS_NONPIC" \
+ {pr20995a.s} {{readelf {-S --wide} pr20995.r}} "pr20995-2"]]
+
+ setup_xfail "tic6x-*-*"
+ run_ld_link_tests {
+ {"Build pr22374 shared library"
+ "-shared" "" "" "pr22374b.s" {} "pr22374.so" }
+ {"pr22374 function pointer initialization"
+ "" "tmpdir/pr22374.so" "" "pr22374a.s"
+ { {readelf {--wide -r --dyn-syms} "pr22374-1.r"}
+ {readelf {--wide -r} "pr22374-2.r"} }
+ "pr22374" }
+ }
+}
+
+if [is_underscore_target] {
+ set ASFLAGS "$ASFLAGS --defsym UNDERSCORE=1"