[PATCH 3/5] Add test for nm on mixed LTO/non-LTO object

H.J. Lu hjl.tools@gmail.com
Wed Oct 21 11:35:09 GMT 2020


	* testsuite/ld-plugin/lto.exp: Add test for nm on
	mixed LTO/non-LTO object.
---
 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 fdd9d032d44..62cdc7c0ea9 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -789,6 +789,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 [run_host_cmd "$CC" "-print-prog-name=liblto_plugin.so tmpdir/lto-10.o"]
+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.26.2



More information about the Binutils mailing list