public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 3/6] Add ld-testsuite helper proc check_sysroot_available.
@ 2014-10-09  3:03 Hans-Peter Nilsson
  0 siblings, 0 replies; only message in thread
From: Hans-Peter Nilsson @ 2014-10-09  3:03 UTC (permalink / raw)
  To: binutils

A minor separable test-suite patch.  Follows the convention of
other check_X_available procs nearby.

ld/testsuite:
	* lib/ld-lib.exp (check_sysroot_available): New proc.

diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 292a873..ffdf805 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -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
-- 

brgds, H-P

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-09  3:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-09  3:03 [PATCH 3/6] Add ld-testsuite helper proc check_sysroot_available Hans-Peter Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).