public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [PATCH] Don't dwz-compress file with compressed debug section
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <20190306153100.GA32623@delia> (raw)

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  <tdevries@suse.de>

	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

             reply	other threads:[~2019-03-06 15:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-01  0:00 Tom de Vries [this message]
2019-01-01  0:00 ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190306153100.GA32623@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).