From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122753 invoked by alias); 6 Mar 2019 15:43:26 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 122741 invoked by uid 89); 6 Mar 2019 15:43:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy=UD:err X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Tue, 01 Jan 2019 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [PATCH] Don't dwz-compress file with compressed debug section Message-ID: <20190306153100.GA32623@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-SW-Source: 2019-q1/txt/msg00074.txt.bz2 Hi, When running dwz with an executable containing compressed debug sections we get: ... $ gcc -g ~/hello.c $ objcopy --compress-debug-sections a.out $ dwz a.out dwz: a.out: DWARF version 0 unhandled ... Fix this by emitting an appropriate error message: ... dwz: a.out: Found compressed .debug_aranges section, not attempting dwz \ compression ... OK for trunk? Thanks, - Tom Don't dwz-compress file with compressed debug section 2019-02-14 Tom de Vries PR dwz/24174 * dwz.c (read_dwarf): Return 1 on finding compressed debug section. * testsuite/dwz.tests/pr24174.sh: New test. --- dwz.c | 8 ++++++++ testsuite/dwz.tests/pr24174.sh | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/dwz.c b/dwz.c index d348418..4ef8657 100644 --- a/dwz.c +++ b/dwz.c @@ -9886,6 +9886,14 @@ read_dwarf (DSO *dso, bool quieter) || strcmp (name, ".gdb_index") == 0 || strcmp (name, ".gnu_debugaltlink") == 0) { + if (dso->shdr[i].sh_flags & SHF_COMPRESSED) + { + error (0, 0, + "%s: Found compressed %s section, not attempting dwz" + " compression", + dso->filename, name); + return 1; + } for (j = 0; debug_sections[j].name; ++j) if (strcmp (name, debug_sections[j].name) == 0) { diff --git a/testsuite/dwz.tests/pr24174.sh b/testsuite/dwz.tests/pr24174.sh new file mode 100755 index 0000000..e522b06 --- /dev/null +++ b/testsuite/dwz.tests/pr24174.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +set -e + +cp ../hello 1 +objcopy --compress-debug-sections 1 +if dwz 1 2>dwz.err; status=$?; then + true +fi + +grep "DWARF version 0 unhandled" dwz.err || true +rm -f dwz.err + +[ $status -eq 1 ] + +[ $(ls) = "1" ] + +rm -f 1