lib/ld-lib.exp (check_sysroot_available): New proc.
[deliverable/binutils-gdb.git] / ld / testsuite / lib / ld-lib.exp
index e4084e13eaaf8a736197a9d31fe4f038698b9ad6..ffdf8051f3191e00433b632810c25f68b3b6494c 100644 (file)
@@ -410,9 +410,9 @@ proc ld_simple_link_defsyms {} {
         append flags " --defsym __gccmain=0"
     }
 
-    # Windows targets need __main, prefixed with underscore.
+    # Windows targets need __main, some prefixed with underscore.
     if {[istarget *-*-cygwin* ] || [istarget *-*-mingw*]} {
-        append flags " --defsym ___main=0"
+        append flags " --defsym __main=0 --defsym ___main=0"
     }
 
     # PowerPC EABI code calls __eabi.
@@ -1669,6 +1669,24 @@ proc check_plugin_api_available { } {
     return $plugin_api_available_saved
 }
 
+# Returns true if the target ld supports sysroot.
+proc check_sysroot_available { } {
+    global ld_sysroot_available_saved
+    global ld
+    if {![info exists ld_sysroot_available_saved]} {
+       # Check if ld supports --sysroot *other* than empty
+       # (non-sysroot linkers don't emit errors for --sysroot="").
+       # The help-text by itself is no indication as it always lists --sysroot.
+       set status [remote_exec host $ld "--sysroot=ldxyzzy --help >/dev/null"]
+       if { [lindex $status 0] != 0 } {
+           set ld_sysroot_available_saved 0
+       } else {
+           set ld_sysroot_available_saved 1
+       }
+    }
+    return $ld_sysroot_available_saved
+}
+
 # Returns true if the target compiler supports LTO
 proc check_lto_available { } {
     global lto_available_saved
This page took 0.025341 seconds and 4 git commands to generate.