# 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.
#
# bootstrap test.
# Check to see if the C compiler works
-if { [which $CC] == 0 } {
+if { ![check_compiler_available] } {
return
}
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,
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
} 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*-*-*"
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"
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*-*-*"
}
}
+set CFLAGS "$old_CFLAGS"
+
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
# Remove the temporary directory.
catch "exec rm -rf $tmpdir" exec_status