[binutils-gdb] ld/testsuite: Use $plug_opt for --plugin option

H.J. Lu hjl@sourceware.org
Wed May 14 10:01:44 GMT 2025


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

commit 23e60b094692e5964882042deb4d58362d82626d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed May 14 16:43:22 2025 +0800

    ld/testsuite: Use $plug_opt for --plugin option
    
    Use $plug_opt for --plugin usage, instead of running:
    
    run_host_cmd "$CC_FOR_TARGET" "-print-prog-name=liblto_plugin.so"
    
            PR binutils/21479
            * testsuite/ld-plugin/lto-binutils.exp (lto_plugin): Removed.
            Replace "--plugin $lto_plugin" with $plug_opt.
            * testsuite/ld-plugin/lto.exp (lto_plugin): Removed.
            Replace "--plugin $lto_plugin" with $plug_opt.
    
    Signed-off-by: H.J. Lu <hjl.tools@gmail.com>

Diff:
---
 ld/testsuite/ld-plugin/lto-binutils.exp | 10 ++++------
 ld/testsuite/ld-plugin/lto.exp          |  5 ++---
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/ld/testsuite/ld-plugin/lto-binutils.exp b/ld/testsuite/ld-plugin/lto-binutils.exp
index db18a63a7b5..36c7380c9b3 100644
--- a/ld/testsuite/ld-plugin/lto-binutils.exp
+++ b/ld/testsuite/ld-plugin/lto-binutils.exp
@@ -47,8 +47,6 @@ if { [check_lto_fat_available] } {
   set no_lto "-fno-lto"
 }
 
-set lto_plugin [string trim [run_host_cmd "$CC_FOR_TARGET" "-print-prog-name=liblto_plugin.so"]]
-
 # List contains test-items:
 #  0:program name
 #  1:program options
@@ -64,7 +62,7 @@ proc run_lto_binutils_test { lto_tests } {
     global objdump
     global READELF
     global strip
-    global lto_plugin
+    global plug_opt
 
     foreach testitem $lto_tests {
 	set prog_name [lindex $testitem 0]
@@ -101,7 +99,7 @@ proc run_lto_binutils_test { lto_tests } {
 	    remote_file host delete $output
 	}
 
-	append prog_options " --plugin $lto_plugin"
+	append prog_options " $plug_opt"
 
 	set cmd_options "$prog_options $prog_output $input"
 	set test_name "$prog_name $cmd_options"
@@ -192,7 +190,7 @@ run_cc_link_tests [list \
     ] \
     [list \
 	"Build libstrip-1a.a" \
-	"--plugin $lto_plugin" \
+	"$plug_opt" \
 	"-O2 -flto $lto_no_fat" \
 	{ strip-1a.c } \
 	{} \
@@ -206,7 +204,7 @@ run_cc_link_tests [list \
     ] \
     [list \
 	"Build libstrip-1a-fat.a" \
-	"--plugin $lto_plugin" \
+	"$plug_opt" \
 	"-O2 -flto $lto_fat" \
 	{ strip-1a-fat.c } \
 	{} \
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 3a56fb57545..f0d0954ab09 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -1158,9 +1158,8 @@ remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o"
 run_dump_test "lto-10r"
 remote_exec host "mv" "tmpdir/dump tmpdir/lto-10.o"
 set testname "nm mixed object"
-set lto_plugin [string trim [run_host_cmd "$CC_FOR_TARGET" "-print-prog-name=liblto_plugin.so"]]
-if { [ regexp "liblto_plugin.so" $lto_plugin ] } {
-    set exec_output [run_host_cmd "$NM" "--plugin $lto_plugin tmpdir/lto-10.o"]
+if { $plug_opt != "" } {
+    set exec_output [run_host_cmd "$NM" "$plug_opt tmpdir/lto-10.o"]
     if { [ regexp "(D|T) main" $exec_output ] } {
 	pass $testname
     } else {


More information about the Binutils-cvs mailing list