From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id E92143858D29 for ; Sun, 28 Feb 2021 07:36:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E92143858D29 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 13375AC24; Sun, 28 Feb 2021 07:36:51 +0000 (UTC) Date: Sun, 28 Feb 2021 08:36:49 +0100 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org Subject: [PATCH][testsuite] Handle readelf following links by default Message-ID: <20210228073647.GA25615@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: dwz@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dwz mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Feb 2021 07:36:53 -0000 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 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\] //'