public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Don't dwz-compress file with compressed debug section
@ 2019-01-01  0:00 Tom de Vries
  2019-01-01  0:00 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2019-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

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

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

end of thread, other threads:[~2019-03-06 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [PATCH] Don't dwz-compress file with compressed debug section Tom de Vries
2019-01-01  0:00 ` Jakub Jelinek

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).