# Make sure that ld can generate ELF shared libraries with visibility.
+# Check to see if the C compiler works
+if { [which $CC] == 0 } {
+ return
+}
+
# This test can only be run on a couple of ELF platforms.
# Square bracket expressions seem to confuse istarget.
if { ![istarget hppa*64*-*-hpux*] \
run_dump_test [file rootname $t]
}
-# The remaining tests can only be run if ld generates native executables.
-if ![isnative] then {return}
-
set tmpdir tmpdir
set SHCFLAG ""
set shared_needs_pic "no"
|| [istarget *-*-nacl*]
|| [istarget *-*-gnu*] } {
if [ld_compile "$CC -g $CFLAGS -DPROTECTED_CHECK" $srcdir/$subdir/main.c $tmpdir/main.o] {
- if [ld_simple_link $CC $tmpdir/main "$tmpdir/main.o"] {
+ if [ld_link $CC $tmpdir/main "$tmpdir/main.o"] {
catch "exec $tmpdir/main" support_protected
}
}
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
set shared "-bM:SRE -bE:$tmpdir/xcoff.exp"
}
- if {![ld_simple_link $CC $tmpdir/$progname.so "$shared $shldflags $tmpdir/$sh1 $tmpdir/$sh2"]} {
+ 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]
&& [regexp "undefined reference to \`visibility_var\'" $link_output] } {
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
set rpath /lib:$tmpdir
}
- if ![ld_simple_link $CC $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so"] {
+ if ![ld_link $CC $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so"] {
if { [ string match $visibility "hidden" ]
&& [regexp "undefined reference to \`\.?visibility\'" $link_output]
&& [regexp "undefined reference to \`visibility_var\'" $link_output] } {
fail "$testname"
}
+ if ![isnative] {
+ unsupported "$testname"
+ return
+ }
+
# Run the resulting program
send_log "$tmpdir/$progname >$tmpdir/$progname.out\n"
verbose "$tmpdir/$progname >$tmpdir/$progname.out"
if { ![ld_compile "$CC -g $CFLAGS" $srcdir/$subdir/common.c tmpdir/common.o] } {
unresolved "common hidden symbol"
} else {
- if ![ld_simple_link $ld tmpdir/common "tmpdir/common.o"] {
+ if ![ld_link $ld tmpdir/common "tmpdir/common.o"] {
fail "common hidden symbol"
} else {
pass "common hidden symbol"
if { ![ld_compile "$CC -g $CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh3.c tmpdir/sh3.o] } {
unresolved "weak hidden symbol"
} else {
- if ![ld_simple_link $ld tmpdir/sh3.so "-shared tmpdir/sh3.o"] {
+ if ![ld_link $ld tmpdir/sh3.so "-shared tmpdir/sh3.o"] {
fail "weak hidden symbol"
} else {
- if ![ld_simple_link $ld tmpdir/weak "tmpdir/test.o tmpdir/sh3.o"] {
+ if ![ld_link $ld tmpdir/weak "tmpdir/test.o tmpdir/sh3.o"] {
fail "weak hidden symbol DSO last"
} else {
pass "weak hidden symbol DSO last"
}
- if ![ld_simple_link $ld tmpdir/weak "tmpdir/sh3.so tmpdir/test.o"] {
+ if ![ld_link $ld tmpdir/weak "tmpdir/sh3.so tmpdir/test.o"] {
fail "weak hidden symbol DSO first"
} else {
pass "weak hidden symbol DSO first"