testsuite: support mold linker
Checks
Commit Message
Mold linker demotes symbols like main to be local and the patch
adjusts expected output from nm.
Ready to be installed?
Thanks,
Martin
---
binutils/testsuite/binutils-all/addr2line.exp | 4 ++--
binutils/testsuite/binutils-all/objcopy.exp | 8 ++++----
libbacktrace/Makefile.am | 2 +-
libbacktrace/Makefile.in | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
Comments
On 05.12.2022 13:10, Martin Liška wrote:
> --- a/binutils/testsuite/binutils-all/objcopy.exp
> +++ b/binutils/testsuite/binutils-all/objcopy.exp
> @@ -652,8 +652,8 @@ 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]+)?[ ]+[tTD] main} $exec_output] \
Further below, for libbacktrace, you also include 'd' in the check (and 't'
was already there). Could you clarify why 't' alone isn't sufficient there,
but is sufficient here?
> + && ![regexp {^([0-9a-fA-F]+)?[ ]+[tT] _main} $exec_output]} {
While orthogonal to the purpose of the patch I still wonder whether you
wouldn't better take the opportunity and fold the two regexp-s (also
elsewhere):
if {![regexp {^[0-9a-fA-F]*[ ]+[tTD] _?main} $exec_output]} {
(with a simplification to the earlier part also included). Looking at
strip_executable_with_saving_a_symbol, which you also adjust, the [TtD]
vs [tT] difference looks to be accidental rather than deliberate.
Jan
On 12/5/22 13:22, Jan Beulich wrote:
> On 05.12.2022 13:10, Martin Liška wrote:
>> --- a/binutils/testsuite/binutils-all/objcopy.exp
>> +++ b/binutils/testsuite/binutils-all/objcopy.exp
>> @@ -652,8 +652,8 @@ 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]+)?[ ]+[tTD] main} $exec_output] \
>
> Further below, for libbacktrace, you also include 'd' in the check (and 't'
> was already there). Could you clarify why 't' alone isn't sufficient there,
> but is sufficient here?
Yeah, it is sufficient.
>
>> + && ![regexp {^([0-9a-fA-F]+)?[ ]+[tT] _main} $exec_output]} {
>
> While orthogonal to the purpose of the patch I still wonder whether you
> wouldn't better take the opportunity and fold the two regexp-s (also
> elsewhere):
>
> if {![regexp {^[0-9a-fA-F]*[ ]+[tTD] _?main} $exec_output]} {
Yep, works for me.
>
> (with a simplification to the earlier part also included). Looking at
> strip_executable_with_saving_a_symbol, which you also adjust, the [TtD]
> vs [tT] difference looks to be accidental rather than deliberate.
Correct, D is really accidental value here.
Lemme send V2.
Martin
>
> Jan
@@ -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]
@@ -652,8 +652,8 @@ 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]+)?[ ]+[tTD] main} $exec_output] \
+ && ![regexp {^([0-9a-fA-F]+)?[ ]+[tT] _main} $exec_output]} {
fail $test
return
}
@@ -902,8 +902,8 @@ 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]+)?[ ]+[TtD] main} $exec_output] \
+ && ![regexp {^([0-9a-fA-F]+)?[ ]+[TtD] _main} $exec_output]} {
fail $test1
return
}
@@ -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
@@ -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