]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/testsuite/ld-elf/comm-data.exp
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-elf / comm-data.exp
index b6150740ef4a6b2163a12c8eeb2be4dba625c102..b5f2e2021487673cb8b77cd630485aedc86e7bc4 100644 (file)
@@ -1,6 +1,6 @@
 # Expect script for common symbol override.
 #
-# Copyright (C) 2011-2018 Free Software Foundation, Inc.
+# Copyright (C) 2011-2021 Free Software Foundation, Inc.
 #
 # This file is part of the GNU Binutils.
 #
@@ -41,6 +41,22 @@ set LFLAGS ""
 if [istarget "tic6x-*-*"] {
     append LFLAGS " -melf32_tic6x_le"
 }
+# These targets do not default to linking with shared libraries.
+if { [istarget "mips*vr4100*-*-elf*"] \
+     || [istarget "mips*vr4300*-*-elf*"] \
+     || [istarget "mips*vr5000*-*-elf*"] } {
+    append LFLAGS " -call_shared"
+}
+
+# Set the pointer size according to the ELF flavor.
+set AFLAGS ""
+if [is_elf64 "tmpdir/libcomm-data.so"] {
+    append AFLAGS " --defsym ELF64=1"
+}
+# HPUX targets use a different .comm syntax.
+if [istarget "*-*-hpux*"] {
+    append AFLAGS " --defsym HPUX=1"
+}
 
 set testname "Common symbol override test"
 
@@ -56,28 +72,19 @@ run_ld_link_tests [list \
        } \
        "libcomm-data.so" \
     ] \
+    [list \
+       "libpr26580-1.so" \
+       "$LFLAGS -shared" "" \
+       "$AFLAGS_PIC $AFLAGS" \
+       { pr26580-b.s } \
+       { } \
+       "libpr26580-1.so" \
+    ] \
 ]
 
-# Set the pointer size according to the ELF flavor.
-set AFLAGS ""
-if [is_elf64 "tmpdir/libcomm-data.so"] {
-    append AFLAGS " --defsym ELF64=1"
-}
-# HPUX targets use a different .comm syntax.
-if [istarget "*-*-hpux*"] {
-    append AFLAGS " --defsym HPUX=1"
-}
-
-# bfin does not currently support copy relocs.
+# bfin-elf does not currently support copy relocs.
 setup_xfail "bfin-*-*"
-
-setup_xfail "arm*-*-*" "ld/13802"
-
-# List targets here that keep copy relocs rather than eliminating
-# them where possible in favour to dynamic relocs in the relevant
-# loadable sections; see also the "-z nocopyreloc" command-line
-# option and the ELIMINATE_COPY_RELOCS macro some backends use.
-set copy_reloc [expr [istarget mn10300-*-*] || [istarget vax-*-*]]
+clear_xfail "bfin-*-linux-uclibc*"
 
 # Verify that a common symbol has been converted to an undefined
 # reference to the global symbol of the same name defined above
@@ -89,12 +96,9 @@ run_ld_link_tests [list \
        "$AFLAGS" \
        { comm-data2.s } \
        [list \
-           [list readelf -s \
-               [expr { $copy_reloc ? "comm-data2r.sd" : "comm-data2.sd"}]] \
-           [list readelf -r \
-               [expr { $copy_reloc ? "comm-data2r.rd" : "comm-data2.rd"}]] \
-           [list readelf "-x .debug_foo" \
-               [expr { $copy_reloc ? "comm-data2r.xd" : "comm-data2.xd"}]]] \
+           [list readelf -s comm-data2.sd] \
+           [list readelf -r comm-data2.rd] \
+           [list readelf "-x .debug_foo" comm-data2.xd]] \
        "comm-data" \
     ] \
     [list \
@@ -117,4 +121,20 @@ run_ld_link_tests [list \
        } \
        "comm-data3b" \
     ] \
+    [list \
+       "pr26580-1" \
+       "$LFLAGS --as-needed -Ltmpdir -lpr26580-1" "" \
+       "$AFLAGS" \
+       { pr26580-a.s } \
+       { {readelf -s pr26580-1.sd} } \
+       "pr26580-1" \
+    ] \
+    [list \
+       "pr26580-2" \
+       "$LFLAGS --no-as-needed -Ltmpdir -lpr26580-1" "" \
+       "$AFLAGS" \
+       { pr26580-a.s } \
+       { {readelf -s pr26580-2.sd} } \
+       "pr26580-2" \
+    ] \
 ]