[binutils-gdb] LD/testsuite: Implement target execution availability check

Maciej W. Rozycki macro@sourceware.org
Tue Feb 17 10:43:54 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e47e870d46f38189f0e052acc7447923e7cf6c00

commit e47e870d46f38189f0e052acc7447923e7cf6c00
Author: Maciej W. Rozycki <macro@redhat.com>
Date:   Tue Feb 17 10:42:47 2026 +0000

    LD/testsuite: Implement target execution availability check
    
    Complementing `check_compiler_available' procedure for a compilation
    check implement `check_execution_available' that checks whether an
    executable built the same way can actually successfully run on the
    target.

Diff:
---
 ld/testsuite/lib/ld-lib.exp | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 819610bf33a..67bd3d8b184 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1314,6 +1314,33 @@ proc check_compiler_available { } {
     return $compiler_available_saved
 }
 
+# Return true if we can run a program built with the compiler.
+proc check_execution_available { } {
+    global execution_available_saved
+
+    if { ![info exists execution_available_saved] } {
+	set execution_available_saved 0
+
+	if { ![check_compiler_available] } {
+	    return 0
+	}
+
+	set binfile [make_dummy_target_executable]
+	if { $binfile == "" } {
+	    return 0
+	}
+
+	set status [lindex [remote_load target $binfile] 0]
+	remote_file host delete $binfile
+	if { $status != "pass" } {
+	    return 0
+	}
+
+	set execution_available_saved 1
+    }
+    return $execution_available_saved
+}
+
 # Returns 1 if plugin is enabled in gcc.  Returns 0 otherwise.
 proc check_gcc_plugin_enabled { } {
     global CC_FOR_TARGET


More information about the Binutils-cvs mailing list