public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Drop .debug_gnu_{names,types} sections
@ 2019-01-01  0:00 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

Hi,

When using -ggnu-pubnames to generate .debug_gnu_{names,types} sections we run
into:
...
$ gcc hello.c -g -ggnu-pubnames
$ dwz a.out
dwz: a.out: Unknown debugging section .debug_gnu_pubnames
...

Fix this conservatively by dropping the section, similar to how the
.debug_{names,types} sections are handled.

Committed to trunk.

Thanks,
- Tom

Drop .debug_gnu_{names,types} sections

2019-07-05  Tom de Vries  <tdevries@suse.de>

	PR dwz/24771
	* dwz.c (enum debug_section_kind): Add DEBUG_GNU_PUBNAMES and
	DEBUG_GNU_PUBTYPES.
	(debug_sections): Add entries for .debug_gnu_pubnames and
	.debug_gnu_pubtypes.
	(dwz): Drop .debug_gnu_{names,types} sections.
	* Makefile (TEST_EXECS): Add hello-gnu-pubnames.
	(hello-gnu-pubnames): New target
	* testsuite/dwz.tests/pr24771.sh: New test.

---
 Makefile                       | 5 ++++-
 dwz.c                          | 8 ++++++++
 testsuite/dwz.tests/pr24771.sh | 9 +++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 534fc74..df7fb17 100644
--- a/Makefile
+++ b/Makefile
@@ -25,11 +25,14 @@ PWD:=$(shell pwd -P)
 TEST_SRC = $(srcdir)/testsuite/dwz.tests
 TEST_EXECS = hello dw2-restrict py-section-script dwz-for-test min two-typedef \
 	dw2-skip-prologue start implptr-64bit-d2o4a8r8t0 hello-gold-gdb-index \
-	start-gold
+	start-gold hello-gnu-pubnames
 
 hello:
 	$(CC) $(TEST_SRC)/hello.c -o $@ -g
 
+hello-gnu-pubnames:
+	$(CC) $(TEST_SRC)/hello.c -o $@ -g -ggnu-pubnames
+
 dw2-restrict:
 	$(CC) -no-pie $(TEST_SRC)/dw2-restrict.S -o $@ || touch $@
 
diff --git a/dwz.c b/dwz.c
index f854c66..f959ffb 100644
--- a/dwz.c
+++ b/dwz.c
@@ -436,6 +436,8 @@ enum debug_section_kind
   DEBUG_ARANGES,
   DEBUG_PUBNAMES,
   DEBUG_PUBTYPES,
+  DEBUG_GNU_PUBNAMES,
+  DEBUG_GNU_PUBTYPES,
   DEBUG_MACINFO,
   DEBUG_LOC,
   DEBUG_FRAME,
@@ -467,6 +469,8 @@ static struct
     { ".debug_aranges", NULL, NULL, 0, 0, 0 },
     { ".debug_pubnames", NULL, NULL, 0, 0, 0 },
     { ".debug_pubtypes", NULL, NULL, 0, 0, 0 },
+    { ".debug_gnu_pubnames", NULL, NULL, 0, 0, 0 },
+    { ".debug_gnu_pubtypes", NULL, NULL, 0, 0, 0 },
     { ".debug_macinfo", NULL, NULL, 0, 0, 0 },
     { ".debug_loc", NULL, NULL, 0, 0, 0 },
     { ".debug_frame", NULL, NULL, 0, 0, 0 },
@@ -11755,6 +11759,10 @@ dwz (const char *file, const char *outfile, struct file_result *res,
 	  debug_sections[DEBUG_PUBNAMES].new_size = 0;
 	  debug_sections[DEBUG_PUBTYPES].new_data = NULL;
 	  debug_sections[DEBUG_PUBTYPES].new_size = 0;
+	  debug_sections[DEBUG_GNU_PUBNAMES].new_data = NULL;
+	  debug_sections[DEBUG_GNU_PUBNAMES].new_size = 0;
+	  debug_sections[DEBUG_GNU_PUBTYPES].new_data = NULL;
+	  debug_sections[DEBUG_GNU_PUBTYPES].new_size = 0;
 
 	  if (multifile && !fi_multifile && !low_mem)
 	    write_multifile (dso);
diff --git a/testsuite/dwz.tests/pr24771.sh b/testsuite/dwz.tests/pr24771.sh
new file mode 100644
index 0000000..4eb6c02
--- /dev/null
+++ b/testsuite/dwz.tests/pr24771.sh
@@ -0,0 +1,9 @@
+exec=$execs/hello-gnu-pubnames
+
+cp $exec 1
+
+dwz 1
+
+smaller-than.sh 1 $exec
+
+rm -f 1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-05 14:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [committed] Drop .debug_gnu_{names,types} sections Tom de Vries

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