# Expect script for ld-visibility tests
-# Copyright (C) 2000-2018 Free Software Foundation, Inc.
+# Copyright (C) 2000-2020 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
# Make sure that ld can generate ELF shared libraries with visibility.
# Check to see if the C compiler works
-if { [which $CC] == 0 } {
+if { ![check_compiler_available] } {
return
}
return
}
-if { [istarget *-*-linux*aout*] \
- || [istarget *-*-linux*oldld*] } {
- return
-}
-
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach t $test_list {
# We need to strip the ".d", but can leave the dirname.
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"]} {
if { [ string match $visibility "hidden_undef" ]
&& [regexp "undefined reference to \`\.?visibility\'" $link_output]
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
- } else {
- setup_xfail "*-*-sunos4*"
}
# Non-pic code uses name binding rules for applications to
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
- } else {
- setup_xfail "*-*-sunos4*"
- setup_xfail "*-*-linux*libc1"
}
if { [ string match $visibility "hidden_normal" ]
|| [ string match $visibility "hidden_weak" ]
setup_xfail $target_triplet
}
}
- # SunOS can not compare function pointers correctly
- if [istarget "*-*-sunos4*"] {
- visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o sun4
- } else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
+ if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o xcoff
} else {
visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o elfvsb $COMPRESS_LDFLAG
- } }
+ }
}
}}
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
- } else {
- setup_xfail "*-*-sunos4*"
}
if { ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "protected_undef" ] } {
|| [string match "*option ignored*" $exec_output] \
|| [string match "*unrecognized option*" $exec_output] \
|| [string match "*passed to ld*" $exec_output] } {
- if [istarget *-*-sunos4*] {
- set picflag "-pic"
- } else {
- set picflag "-KPIC"
- }
+ set picflag "-KPIC"
}
}
verbose "Using $picflag to compile PIC code"