]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/testsuite/ld-elfvsb/elfvsb.exp
Run more ld tests when not native
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-elfvsb / elfvsb.exp
index 5331ad554c4b6f1dd99f9171ceebf7fd0abfaa12..9d590c74fb90f340555275bdcdc9fe0d77cffd3d 100644 (file)
 
 # 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*] \
@@ -56,9 +61,6 @@ foreach t $test_list {
     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"
@@ -121,7 +123,7 @@ if { [istarget *-*-linux*]
      || [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
       }
     }
@@ -145,7 +147,7 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } {
     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] } {
@@ -168,7 +170,7 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } {
     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] } {
@@ -191,6 +193,11 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } {
        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"
@@ -502,7 +509,7 @@ visibility_run normal
 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"
@@ -515,15 +522,15 @@ if { ![ld_compile "$CC -g $CFLAGS" $srcdir/$subdir/test.c tmpdir/test.o] } {
    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"