Run more ld tests when not native
[deliverable/binutils-gdb.git] / ld / testsuite / ld-bootstrap / bootstrap.exp
index 726b3fe4dead56b3156d5e7e946afa7823b4726e..9a68ebe34f5ac844b5e1a6b30d16e5461d9540f2 100644 (file)
@@ -48,13 +48,25 @@ if [check_plugin_api_available] {
 # order to test -r.  Then link the result into an executable, ld1, to
 # really test -r.  Use ld1 to link a fresh ld, ld2.  Use ld2 to link a
 # new ld, ld3.  ld2 and ld3 should be identical.
-set test_flags {"" "strip" "--static" "--traditional-format"
-               "--no-keep-memory" "--relax"}
+set test_flags {"" "strip" "--static" "-Wl,--traditional-format"
+               "-Wl,--no-keep-memory" "-Wl,--relax"}
 if { [istarget "powerpc-*-*"] } {
-    lappend test_flags "--ppc476-workaround"
+    lappend test_flags "-Wl,--ppc476-workaround"
+}
+
+set gcc_B_opt_save $gcc_B_opt
+
+foreach ldexe {ld1 ld2 ld3} {
+    if {![file isdirectory tmpdir/gcc$ldexe]} then {
+       catch "exec mkdir tmpdir/gcc$ldexe" status
+       catch "exec ln -s ../$ldexe tmpdir/gcc$ldexe/ld" status
+       catch "exec ln -s ld tmpdir/gcc$ldexe/collect-ld" status
+       catch "exec ln -s ../../../gas/as-new tmpdir/gcc$ldexe/as" status
+    }
 }
 
 foreach flags $test_flags {
+    set gcc_B_opt $gcc_B_opt_save
     set do_strip "no"
     if {"$flags" == "strip"} { 
        set testname "bootstrap with $flags"
@@ -67,8 +79,8 @@ foreach flags $test_flags {
     }}
 
     # --static is meaningless and --relax is incompatible with -r.
-    set partial_flags "$flags"
-    if { "$flags" == "--static" || "$flags" == "--relax" } {
+    regsub -- "-Wl," $flags "" partial_flags
+    if { "$partial_flags" == "--static" || "$partial_flags" == "--relax" } {
        set partial_flags ""
     }
 
@@ -140,7 +152,7 @@ foreach flags $test_flags {
        setup_xfail "mips*-*-irix5*"
     }
 
-    if ![ld_link $ld tmpdir/ld1 "$flags tmpdir/ld-partial.o $BFDLIB $LIBIBERTY $extralibs"] {
+    if ![ld_link $CC tmpdir/ld1 "$flags tmpdir/ld-partial.o $BFDLIB $LIBIBERTY $extralibs"] {
        fail $testname
        continue
     }
@@ -155,36 +167,27 @@ foreach flags $test_flags {
        }
     }
 
-    if ![ld_link tmpdir/ld1 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY $extralibs"] {
+    regsub /tmpdir/ld/ $gcc_B_opt_save /tmpdir/gccld1/ gcc_B_opt
+    if ![ld_link $CC tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY $extralibs"] {
        fail $testname
        continue
     }
 
-    if ![ld_link tmpdir/ld2 tmpdir/ld3 "$flags $OFILES $BFDLIB $LIBIBERTY $extralibs"] {
+    regsub /tmpdir/ld/ $gcc_B_opt_save /tmpdir/gccld2/ gcc_B_opt
+    if ![ld_link $CC tmpdir/ld3 "$flags $OFILES $BFDLIB $LIBIBERTY $extralibs"] {
        fail $testname
        continue
     }
 
-    if {"$flags" == "--static"} {
-       if { [istarget ia64-*-elf*]
-            || [istarget ia64-*-linux*] } {
-           # On ia64, tmpdir/ld2 != tmpdir/ld3 is normal since they are
-           # generated by different linkers, tmpdir/ld1 and tmpdir/ld2.
-           # So we rebuild tmpdir/ld2 with tmpdir/ld3.
-           if ![ld_link tmpdir/ld3 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY $extralibs"] {
-               fail $testname
-               continue
-           }
-       }
-    } else {
-       if { [istarget mips*-*-linux*] } {
-           # On Linux/mips, tmpdir/ld2 != tmpdir/ld3 is normal since
-           # they are generated by different linkers, tmpdir/ld1 and
-           # tmpdir/ld2. So we rebuild tmpdir/ld2 with tmpdir/ld3.
-           if ![ld_link tmpdir/ld3 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY $extralibs"] {
-               fail $testname
-               continue
-           }
+    if { "$flags" == "--static" && { [istarget ia64-*-elf*] || [istarget ia64-*-linux*] }
+        || [istarget mips*-*-linux*] } {
+       # On ia64 and mips, tmpdir/ld2 != tmpdir/ld3 is normal since they are
+       # generated by different linkers, tmpdir/ld1 and tmpdir/ld2.
+       # So we rebuild tmpdir/ld2 with tmpdir/ld3.
+       regsub /tmpdir/ld/ $gcc_B_opt_save /tmpdir/gccld3/ gcc_B_opt
+       if ![ld_link $CC tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY $extralibs"] {
+           fail $testname
+           continue
        }
     }
 
@@ -222,5 +225,6 @@ foreach flags $test_flags {
     }
 }
 
+set gcc_B_opt $gcc_B_opt_save
 catch "exec rm -f tmpdir/ld-partial.o tmpdir/ld1 tmpdir/ld2 tmpdir/ld3" status
 catch "exec rm -f tmpdir/ld2tail tmpdir/ld3tail" status
This page took 0.038868 seconds and 4 git commands to generate.