public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][testsuite] Handle readelf following links by default
@ 2021-02-28  7:36 Tom de Vries
  2021-02-28 15:21 ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2021-02-28  7:36 UTC (permalink / raw)
  To: dwz, jakub, mark

Hi,

Since binutils commit c46b706620e "Change the readelf and objdump programs so
that they will automatically follow links to separate debug info files." there
are a few FAILs in the dwz testsuite.

In the case of gnu-debugaltlink-name.sh, I think this is caused by a binutils
bug, filed as PR27478.

In the case of odr-struct-multifile.sh, this is just due to flipping the
default.

Fix/workaround this by testing whether the new -Wn readelf flag is supported,
and if so, adding it to the readelf call.

Any comments?

Thanks,
- Tom

[testsuite] Handle readelf following links by default

2021-02-28  Tom de Vries  <tdevries@suse.de>

	PR dwz/27479
	* testsuite/dwz.tests/odr-struct-multifile.sh: Call readelf with -wN
	if supported.
	* testsuite/scripts/gnu-debugaltlink-name.sh: Same.

---
 testsuite/dwz.tests/odr-struct-multifile.sh | 19 ++++++++++++-------
 testsuite/scripts/gnu-debugaltlink-name.sh  |  8 +++++++-
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/testsuite/dwz.tests/odr-struct-multifile.sh b/testsuite/dwz.tests/odr-struct-multifile.sh
index cc462c9..7e9e535 100644
--- a/testsuite/dwz.tests/odr-struct-multifile.sh
+++ b/testsuite/dwz.tests/odr-struct-multifile.sh
@@ -2,16 +2,21 @@ if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
     exit 77
 fi
 
+flags=""
+if readelf -h 2>&1 | grep -q "\-wN,"; then
+    flags=-wN
+fi
+
 cp $execs/odr-struct 1
 cp 1 2
 
 for name in aaa bbb ccc; do
-    cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+    cnt=$(readelf $flags -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
     [ $cnt -eq 2 ]
 done
 
 for name in member_one member_two member_three member_four; do
-    cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+    cnt=$(readelf $flags -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
     case $name in
 	member_one|member_two)
 	    [ $cnt -eq 2 ]
@@ -22,7 +27,7 @@ for name in member_one member_two member_three member_four; do
 	esac
 done
 
-decl_cnt=$(readelf -wi 1 | grep -c "DW_AT_declaration" || true)
+decl_cnt=$(readelf $flags -wi 1 | grep -c "DW_AT_declaration" || true)
 
 $execs/dwz-for-test --odr 1 2 -m 3
 
@@ -30,23 +35,23 @@ verify-dwarf.sh 1
 verify-dwarf.sh 3
 
 for name in aaa bbb ccc; do
-    cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*:.*$name" || true)
+    cnt=$(readelf $flags -wi 3 | grep -c "DW_AT_name.*:.*$name" || true)
     [ $cnt -eq 1 ]
 done
 
 for name in member_one member_two member_three member_four; do
-    cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*:.*$name" || true)
+    cnt=$(readelf $flags -wi 3 | grep -c "DW_AT_name.*:.*$name" || true)
     [ $cnt -eq 1 ]
 done
 
 
 for name in aaa bbb ccc; do
-    cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+    cnt=$(readelf $flags -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
     [ $cnt -eq 0 ]
 done
 
 for name in member_one member_two member_three member_four; do
-    cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
+    cnt=$(readelf $flags -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
     [ $cnt -eq 0 ]
 done
 
diff --git a/testsuite/scripts/gnu-debugaltlink-name.sh b/testsuite/scripts/gnu-debugaltlink-name.sh
index 667c5fd..c594c9a 100755
--- a/testsuite/scripts/gnu-debugaltlink-name.sh
+++ b/testsuite/scripts/gnu-debugaltlink-name.sh
@@ -1,11 +1,17 @@
 #!/bin/sh
 
-if ! readelf -S $1 | grep -q '\.gnu_debugaltlink'; then
+flags=""
+if readelf -h 2>&1 | grep -q "\-wN,"; then
+    flags=-wN
+fi
+
+if ! readelf $flags -S $1 | grep -q '\.gnu_debugaltlink'; then
     exit
 fi
 
 readelf \
     --string-dump=.gnu_debugaltlink \
+    $flags \
     $1 \
     | grep -a '\[[ 	]*0\]' \
     | sed 's/.*0\]  //'

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][testsuite] Handle readelf following links by default
  2021-02-28  7:36 [PATCH][testsuite] Handle readelf following links by default Tom de Vries
@ 2021-02-28 15:21 ` Mark Wielaard
  2021-03-01 12:50   ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2021-02-28 15:21 UTC (permalink / raw)
  To: Tom de Vries; +Cc: dwz, jakub, nickc

Hi,

Added Nick to the CC since he seems to have introduced this new
"default".

On Sun, Feb 28, 2021 at 08:36:49AM +0100, Tom de Vries wrote:
> Since binutils commit c46b706620e "Change the readelf and objdump programs so
> that they will automatically follow links to separate debug info files." there
> are a few FAILs in the dwz testsuite.
> 
> In the case of gnu-debugaltlink-name.sh, I think this is caused by a binutils
> bug, filed as PR27478.
> 
> In the case of odr-struct-multifile.sh, this is just due to flipping the
> default.
> 
> Fix/workaround this by testing whether the new -Wn readelf flag is supported,
> and if so, adding it to the readelf call.
> 
> Any comments?

I think this is an odd bug in binutils.  --debug-dump=follow-links
seems to confuses two separate concepts. First whether or not to show
data that might be stored in a "linked" file. Like whether to show a
DW_FORM_GNU_alt_strp value. This seems fine and should indeed be done
by default (that is also what eu-readelf does).

Second whether to dump whole sections from the linked files. That is
IMHO something completely different and causes the bug you filed. This
second use should not be the default. And probably should be called
something different, maybe --debug-dump=dump-links.

Since this is luckily not yet in any released binutils lets fix this
in binutils instead of trying to work around it in dwz. I am pretty
sure it will break various other testsuites that rely on binutils
readelf --debug-dump output if it suddenly also dumped sections from
other files by default.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][testsuite] Handle readelf following links by default
  2021-02-28 15:21 ` Mark Wielaard
@ 2021-03-01 12:50   ` Mark Wielaard
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2021-03-01 12:50 UTC (permalink / raw)
  To: Tom de Vries; +Cc: dwz, nickc

Hi,

On Sun, 2021-02-28 at 16:21 +0100, Mark Wielaard wrote:
> I think this is an odd bug in binutils.  --debug-dump=follow-links
> seems to confuses two separate concepts. First whether or not to show
> data that might be stored in a "linked" file. Like whether to show a
> DW_FORM_GNU_alt_strp value. This seems fine and should indeed be done
> by default (that is also what eu-readelf does).
> 
> Second whether to dump whole sections from the linked files. That is
> IMHO something completely different and causes the bug you filed. This
> second use should not be the default. And probably should be called
> something different, maybe --debug-dump=dump-links.
> 
> Since this is luckily not yet in any released binutils lets fix this
> in binutils instead of trying to work around it in dwz. I am pretty
> sure it will break various other testsuites that rely on binutils
> readelf --debug-dump output if it suddenly also dumped sections from
> other files by default.

Found the thread on the binutils list where Nick is asking for feedback:
https://sourceware.org/pipermail/binutils/2021-March/115582.html
Lets continue the discussion there.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-01 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-28  7:36 [PATCH][testsuite] Handle readelf following links by default Tom de Vries
2021-02-28 15:21 ` Mark Wielaard
2021-03-01 12:50   ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).