diff mbox

RFA: don't emit .debug_pub*

Message ID m3k4p8b56l.fsf@fleche.redhat.com
State New
Headers show

Commit Message

Tom Tromey July 6, 2010, 10:45 p.m. UTC
>>>>> "rth" == Richard Henderson <rth@redhat.com> writes:

rth> But now the patch needs to be re-written, since Joern has
rth> committed a patch that re-works the target hooks.  Which
rth> will also force you to write documentation, which you had
rth> forgotten for this new hook.  ;-)

Here's a new version, bootstrapped & regtested on x86-64 (compile farm).

As before, I can't actually test this on Darwin.  However, I think any
possible bug would be trivial.

Tom

2010-07-06  Tom Tromey  <tromey@redhat.com>

	* doc/tm.texi: Update.
	* doc/tm.texi.in (SDB and DWARF) <TARGET_WANT_DEBUG_PUB_SECTIONS>:
	Add @hook.
	* target.def (want_debug_pub_sections): New hook.
	* config/darwin.h (TARGET_WANT_DEBUG_PUB_SECTIONS): Define.
	* dwarf2out.c (add_pubname_string): Check
	targetm.want_debug_pub_sections.
	(add_pubname): Likewise.
	(add_pubtype): Likewise.

2010-07-06  Tom Tromey  <tromey@redhat.com>

	* g++.dg/debug/dwarf2/pubnames-1.C: Make darwin-specific.

Comments

Richard Henderson July 7, 2010, 12:17 a.m. UTC | #1
On 07/06/2010 03:45 PM, Tom Tromey wrote:
> 	* doc/tm.texi: Update.
> 	* doc/tm.texi.in (SDB and DWARF) <TARGET_WANT_DEBUG_PUB_SECTIONS>:
> 	Add @hook.
> 	* target.def (want_debug_pub_sections): New hook.
> 	* config/darwin.h (TARGET_WANT_DEBUG_PUB_SECTIONS): Define.
> 	* dwarf2out.c (add_pubname_string): Check
> 	targetm.want_debug_pub_sections.
> 	(add_pubname): Likewise.
> 	(add_pubtype): Likewise.
> 
> 2010-07-06  Tom Tromey  <tromey@redhat.com>
> 
> 	* g++.dg/debug/dwarf2/pubnames-1.C: Make darwin-specific.

Ok.


r~
diff mbox

Patch

Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	(revision 161742)
+++ gcc/doc/tm.texi	(working copy)
@@ -9276,6 +9276,10 @@ 
 tables, and hence is desirable if it works.
 @end defmac
 
+@deftypevr {Target Hook} bool TARGET_WANT_DEBUG_PUB_SECTIONS
+True if the @code{.debug_pubtypes} and @code{.debug_pubnames} sections should be emitted.  These sections are not used on most platforms, and in particular GDB does not use them.
+@end deftypevr
+
 @defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2})
 A C statement to issue assembly directives that create a difference
 @var{lab1} minus @var{lab2}, using an integer of the given @var{size}.
Index: gcc/doc/tm.texi.in
===================================================================
--- gcc/doc/tm.texi.in	(revision 161742)
+++ gcc/doc/tm.texi.in	(working copy)
@@ -9275,6 +9275,8 @@ 
 tables, and hence is desirable if it works.
 @end defmac
 
+@hook TARGET_WANT_DEBUG_PUB_SECTIONS
+
 @defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2})
 A C statement to issue assembly directives that create a difference
 @var{lab1} minus @var{lab2}, using an integer of the given @var{size}.
Index: gcc/target.def
===================================================================
--- gcc/target.def	(revision 161742)
+++ gcc/target.def	(working copy)
@@ -2335,6 +2335,13 @@ 
  "",
  bool, false)
 
+DEFHOOKPOD
+(want_debug_pub_sections,
+ "True if the @code{.debug_pubtypes} and @code{.debug_pubnames} sections\
+ should be emitted.  These sections are not used on most platforms, and\
+ in particular GDB does not use them.",
+ bool, false)
+
 /* Leave the boolean fields at the end.  */
 
 /* Empty macro arguments are undefined in C90, so use an empty macro.  */
Index: gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C
===================================================================
--- gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C	(revision 161742)
+++ gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C	(working copy)
@@ -1,7 +1,7 @@ 
 // Contributed by Dodji Seketeli <dodji@redhat.com>
 // Origin PR debug/39706
+// { dg-do compile { target *-*-darwin* } }
 // { dg-options "-g -dA -fno-merge-debug-strings" }
-// { dg-do compile }
 //
 // There should be one debug_pubnames section generated.
 // On Darwin though, there is also a label pointing at the begining of the
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 161742)
+++ gcc/dwarf2out.c	(working copy)
@@ -11238,17 +11238,20 @@ 
 static void
 add_pubname_string (const char *str, dw_die_ref die)
 {
-  pubname_entry e;
+  if (targetm.want_debug_pub_sections)
+    {
+      pubname_entry e;
 
-  e.die = die;
-  e.name = xstrdup (str);
-  VEC_safe_push (pubname_entry, gc, pubname_table, &e);
+      e.die = die;
+      e.name = xstrdup (str);
+      VEC_safe_push (pubname_entry, gc, pubname_table, &e);
+    }
 }
 
 static void
 add_pubname (tree decl, dw_die_ref die)
 {
-  if (TREE_PUBLIC (decl))
+  if (targetm.want_debug_pub_sections && TREE_PUBLIC (decl))
     {
       const char *name = dwarf2_name (decl, 1);
       if (name)
@@ -11263,6 +11266,9 @@ 
 {
   pubname_entry e;
 
+  if (!targetm.want_debug_pub_sections)
+    return;
+
   e.name = NULL;
   if ((TREE_PUBLIC (decl)
        || die->die_parent == comp_unit_die)
Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h	(revision 161742)
+++ gcc/config/darwin.h	(working copy)
@@ -471,6 +471,8 @@ 
 #define DEBUG_STR_SECTION	"__DWARF,__debug_str,regular,debug"
 #define DEBUG_RANGES_SECTION	"__DWARF,__debug_ranges,regular,debug"
 
+#define TARGET_WANT_DEBUG_PUB_SECTIONS true
+
 /* When generating stabs debugging, use N_BINCL entries.  */
 
 #define DBX_USE_BINCL