]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/testsuite/ld-shared/shared.exp
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-shared / shared.exp
index 0e3d75e9d160d3fcd427faf5a8943a4464042fd3..ffa6d246de15f8de5bf9f9a6b421928efd4e0f24 100644 (file)
@@ -1,5 +1,5 @@
 # Expect script for ld-shared tests
-#   Copyright (C) 1994-2019 Free Software Foundation, Inc.
+#   Copyright (C) 1994-2021 Free Software Foundation, Inc.
 #
 # This file is part of the GNU Binutils.
 #
@@ -26,7 +26,7 @@
 # bootstrap test.
 
 # Check to see if the C compiler works
-if { [which $CC] == 0 } {
+if { ![check_compiler_available] } {
     return
 }
 
@@ -65,6 +65,10 @@ set tmpdir tmpdir
 set SHCFLAG ""
 set shared_needs_pic "no"
 
+# Disable all sanitizers.
+set old_CFLAGS "$CFLAGS"
+append CFLAGS " $NOSANITIZE_CFLAGS"
+
 if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
 
     # AIX shared libraries do not seem to support useful features,
@@ -133,6 +137,9 @@ proc shared_test { progname testname main sh1 sh2 dat args } {
     if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
        set shared "-bM:SRE -bE:$tmpdir/xcoff.exp"
     }
+    if { [is_elf_format] && [check_shared_lib_support] } {
+       append shared " -Wl,-z,notext"
+    }
     if {![ld_link $CC $tmpdir/$progname.so "$shared $shldflags $tmpdir/$sh1 $tmpdir/$sh2"]} {
         fail "$testname"
        return
@@ -222,8 +229,8 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
     } else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
        shared_test shnp "shared (nonPIC)" mainnp.o sh1np.o sh2np.o xcoff
     } else {
-       # SunOS non PIC shared libraries don't permit some cases of
-       # overriding.
+       # Solaris defaults to -z text.
+       setup_xfail "*-*-solaris2*"
        setup_xfail "ia64-*-linux*"
        setup_xfail "alpha*-*-linux*"
        setup_xfail "powerpc64*-*-*"
@@ -268,6 +275,8 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
            setup_xfail "arm*-*-linux*"
        }
        setup_xfail "aarch64*-*-linux*"
+       # Solaris defaults to -z text.
+       setup_xfail "*-*-solaris2*"
        shared_test shnp "shared (non PIC, load offset)" \
                mainnp.o sh1np.o sh2np.o shared \
                "-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv"
@@ -301,8 +310,8 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/m
         if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
            shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o xcoff
        } else {
-           # SunOS non PIC shared libraries don't permit some cases of
-           # overriding.
+           # Solaris defaults to -z text.
+           setup_xfail "*-*-solaris2*"
            setup_xfail "ia64-*-linux*"
            setup_xfail "alpha*-*-linux*"
            setup_xfail "powerpc64*-*-*"
@@ -338,6 +347,8 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/m
     }
 }
 
+set CFLAGS "$old_CFLAGS"
+
 if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
     # Remove the temporary directory.
     catch "exec rm -rf $tmpdir" exec_status