]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
testsuite: support mold linker
authorMartin Liska <mliska@suse.cz>
Mon, 5 Dec 2022 12:09:12 +0000 (13:09 +0100)
committerMartin Liska <mliska@suse.cz>
Mon, 5 Dec 2022 14:52:51 +0000 (15:52 +0100)
Mold linker demotes symbols like main to be local and the patch
adjusts expected output from nm.

Moreover, simplify the regex patterns.

binutils/testsuite/binutils-all/addr2line.exp
binutils/testsuite/binutils-all/objcopy.exp
libbacktrace/Makefile.am
libbacktrace/Makefile.in

index 66a2d5d32a051d6404f73cba9f363a0db6e803ed..957ae55df336490aa253a6b5958e24c56704c0d7 100644 (file)
@@ -34,7 +34,7 @@ if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog executable debug
 #testcase for default option.
 #Run nm command and input the main symbol address to addr2line.
 set output [binutils_run $NM "$opts tmpdir/testprog$exe"]
-if ![regexp -line "^(\[0-9a-fA-F\]+)? +T ${dot}main" $output contents] then {
+if ![regexp -line "^(\[0-9a-fA-F\]+)? +\[Tt\] ${dot}main" $output contents] then {
     fail "$testname"
 } else {
     set list [regexp -inline -all -- {\S+} $contents]
@@ -49,7 +49,7 @@ if ![regexp -line "^(\[0-9a-fA-F\]+)? +T ${dot}main" $output contents] then {
 
 #testcase for -f option.
 #Run nm command and input the fn function symbol address to addr2line.
-if ![regexp -line "^(\[0-9a-fA-F\]+)? +T ${dot}fn" $output contents] then {
+if ![regexp -line "^(\[0-9a-fA-F\]+)? +\[Tt\] ${dot}fn" $output contents] then {
     fail "$testname -f option"
 } else {
     set list [regexp -inline -all -- {\S+} $contents]
index de6f3aaaef20b1f381ab25c0d74e0ade78295c6a..e3388597f560e5ef3707caef55c97132bc64a28a 100644 (file)
@@ -652,8 +652,7 @@ proc strip_test_with_saving_a_symbol { } {
 
     set exec_output [binutils_run $NM "$NMFLAGS $objfile"]
     set exec_output [prune_warnings $exec_output]
-    if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
-         && ![regexp {^([0-9a-fA-F]+)?[ ]+T _main} $exec_output]} {
+    if {![regexp {^([0-9a-fA-F]+)?[ ]+[TtDd] _?main} $exec_output]} {
        fail $test
        return
     }
@@ -902,8 +901,7 @@ proc strip_executable_with_saving_a_symbol { prog flags test1 test2 } {
        regsub "^\[0-9a-fA-F\]+\[ \]+T Main\[\n\r\]+" $exec_output "" exec_output
     }
 
-    if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
-         && ![regexp {^([0-9a-fA-F]+)?[ ]+[TD] _main} $exec_output]} {
+    if {![regexp {^([0-9a-fA-F]+)?[ ]+[TtDd] _?main} $exec_output]} {
        fail $test1
        return
     }
index 8874f41338a7d0fdeafc022c73557a9485e96f0c..bf9d30a382c92c261abd4ce390d1259e451ee84f 100644 (file)
@@ -498,7 +498,7 @@ TESTS += mtest_minidebug
 
 %_minidebug: %
        $(NM) -D $< -P --defined-only | $(AWK) '{ print $$1 }' | sort > $<.dsyms
-       $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort > $<.fsyms
+       $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D" || $$2 == "d") print $$1 }' | sort > $<.fsyms
        $(COMM) -13 $<.dsyms $<.fsyms > $<.keepsyms
        $(OBJCOPY) --only-keep-debug $< $<.dbg
        $(OBJCOPY) -S --remove-section .gdb_index --remove-section .comment --keep-symbols=$<.keepsyms $<.dbg $<.mdbg
index 2ba8dfa84289a486c1ff00a8563045c1b146ac54..5167ca80ad1c954a47b8de820bbc05ace94e28d4 100644 (file)
@@ -2459,7 +2459,7 @@ uninstall-am:
 
 @HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@%_minidebug: %
 @HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@     $(NM) -D $< -P --defined-only | $(AWK) '{ print $$1 }' | sort > $<.dsyms
-@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@     $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort > $<.fsyms
+@HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@     $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D" || $$2 == "d") print $$1 }' | sort > $<.fsyms
 @HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@     $(COMM) -13 $<.dsyms $<.fsyms > $<.keepsyms
 @HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@     $(OBJCOPY) --only-keep-debug $< $<.dbg
 @HAVE_MINIDEBUG_TRUE@@NATIVE_TRUE@     $(OBJCOPY) -S --remove-section .gdb_index --remove-section .comment --keep-symbols=$<.keepsyms $<.dbg $<.mdbg