[PATCH v2 2/4] Add test for nm on mixed LTO/non-LTO object

H.J. Lu hjl.tools@gmail.com
Thu Sep 5 11:14:50 GMT 2024


	* testsuite/ld-plugin/lto.exp: Add test for nm on
	mixed LTO/non-LTO object.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 ld/testsuite/ld-plugin/lto.exp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 229be34fac4..745595679fe 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -1145,6 +1145,18 @@ run_dump_test "lto-5r"
 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" "-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 { [ regexp "T main" $exec_output ] } {
+	pass $testname
+    } {
+	fail $testname
+    }
+} {
+    fail $testname
+ }
 
 run_cc_link_tests $lto_link_symbol_tests
 
-- 
2.46.0



More information about the Binutils mailing list