public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Generalize overriding mechanism for debug info output options defaults
@ 2016-08-18  9:32 Pierre-Marie de Rodat
  2016-08-18  9:40 ` Jakub Jelinek
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre-Marie de Rodat @ 2016-08-18  9:32 UTC (permalink / raw)
  To: gcc-patches; +Cc: Pierre-Marie de Rodat

Hello,

Currently, the VxWorks target overrides the defaults for debug info
output options (DWARF version, strictness) in a target-specific options
hook.  This patch creates macros so that these defaults can be overriden
in config headers.  In particular, this will make it easier to have
different default for different VxWorks versions.

No behavior change, bootstrapped and regtested on x86_64-linux.  We (at
AdaCore) also have this patch in our branches for more than a year.  Ok
to commit?  Thank you in advance!

gcc/
	* defaults.h (DWARF_STRICT_DEFAULT, DWARF_VERSION_DEFAULT): New
	macros.
	* common.opt (-gdwarf-, -gno-strict-dwarf): Update to use macros
	for default values.
---
 gcc/common.opt       | 4 ++--
 gcc/config/vxworks.c | 8 --------
 gcc/config/vxworks.h | 8 ++++++++
 gcc/defaults.h       | 8 ++++++++
 4 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/gcc/common.opt b/gcc/common.opt
index 65a9762..23d3576 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2736,7 +2736,7 @@ Common JoinedOrMissing Negative(gdwarf-)
 Generate debug information in default version of DWARF format.
 
 gdwarf-
-Common Joined UInteger Var(dwarf_version) Init(4) Negative(gstabs)
+Common Joined UInteger Var(dwarf_version) Init(DWARF_VERSION_DEFAULT) Negative(gstabs)
 Generate debug information in DWARF v2 (or later) format.
 
 ggdb
@@ -2780,7 +2780,7 @@ Common JoinedOrMissing Negative(gvms)
 Generate debug information in extended STABS format.
 
 gno-strict-dwarf
-Common RejectNegative Var(dwarf_strict,0) Init(0)
+Common RejectNegative Var(dwarf_strict,0) Init(DWARF_STRICT_DEFAULT)
 Emit DWARF additions beyond selected version.
 
 gstrict-dwarf
diff --git a/gcc/config/vxworks.c b/gcc/config/vxworks.c
index ce2c170..229ed93 100644
--- a/gcc/config/vxworks.c
+++ b/gcc/config/vxworks.c
@@ -143,12 +143,4 @@ vxworks_override_options (void)
   /* PIC is only supported for RTPs.  */
   if (flag_pic && !TARGET_VXWORKS_RTP)
     error ("PIC is only supported for RTPs");
-
-  /* Default to strict dwarf-2 to prevent potential difficulties observed with
-     non-gdb debuggers on extensions > 2.  */
-  if (!global_options_set.x_dwarf_strict)
-    dwarf_strict = 1;
-
-  if (!global_options_set.x_dwarf_version)
-    dwarf_version = 2;
 }
diff --git a/gcc/config/vxworks.h b/gcc/config/vxworks.h
index f356926..ba07274 100644
--- a/gcc/config/vxworks.h
+++ b/gcc/config/vxworks.h
@@ -138,3 +138,11 @@ extern void vxworks_asm_out_destructor (rtx symbol, int priority);
 
 /* The diab linker does not handle .gnu_attribute sections.  */
 #undef HAVE_AS_GNU_ATTRIBUTE
+
+/* Default to strict dwarf-2 with all GNAT encodings to prevent potential
+   difficulties observed with non-gdb debuggers on extensions > 2.  */
+#undef DWARF_STRICT_DEFAULT
+#define DWARF_STRICT_DEFAULT 1
+
+#undef DWARF_VERSION_DEFAULT
+#define DWARF_VERSION_DEFAULT 2
diff --git a/gcc/defaults.h b/gcc/defaults.h
index af8fe91..3658ae6 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1485,6 +1485,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #endif /* GCC_INSN_FLAGS_H  */
 
+#ifndef DWARF_STRICT_DEFAULT
+#define DWARF_STRICT_DEFAULT 0
+#endif
+
+#ifndef DWARF_VERSION_DEFAULT
+#define DWARF_VERSION_DEFAULT 4
+#endif
+
 #ifndef DWARF_GNAT_ENCODINGS_DEFAULT
 #define DWARF_GNAT_ENCODINGS_DEFAULT DWARF_GNAT_ENCODINGS_GDB
 #endif
-- 
2.9.3

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

* Re: [PATCH] Generalize overriding mechanism for debug info output options defaults
  2016-08-18  9:32 [PATCH] Generalize overriding mechanism for debug info output options defaults Pierre-Marie de Rodat
@ 2016-08-18  9:40 ` Jakub Jelinek
  2016-08-18 14:01   ` Pierre-Marie de Rodat
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Jelinek @ 2016-08-18  9:40 UTC (permalink / raw)
  To: Pierre-Marie de Rodat; +Cc: gcc-patches

On Thu, Aug 18, 2016 at 11:32:45AM +0200, Pierre-Marie de Rodat wrote:
> Currently, the VxWorks target overrides the defaults for debug info
> output options (DWARF version, strictness) in a target-specific options
> hook.  This patch creates macros so that these defaults can be overriden

I believe that is the preferred way, rather than macros.
The macros are yet another thing that would need to be undone if we ever
start supporting multiple targets in the same binary.
I don't see any advantages of introducing the macros.

> gcc/
> 	* defaults.h (DWARF_STRICT_DEFAULT, DWARF_VERSION_DEFAULT): New
> 	macros.
> 	* common.opt (-gdwarf-, -gno-strict-dwarf): Update to use macros
> 	for default values.

	Jakub

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

* Re: [PATCH] Generalize overriding mechanism for debug info output options defaults
  2016-08-18  9:40 ` Jakub Jelinek
@ 2016-08-18 14:01   ` Pierre-Marie de Rodat
  2016-08-18 14:41     ` Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre-Marie de Rodat @ 2016-08-18 14:01 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches, Olivier Hainque

On 08/18/2016 11:40 AM, Jakub Jelinek wrote:
> I believe that is the preferred way, rather than macros.
> The macros are yet another thing that would need to be undone if we ever
> start supporting multiple targets in the same binary.
> I don't see any advantages of introducing the macros.

Ah, I understand, thank you. We debated a bit internally about whether 
one was better than the other, so thank you for the rationale!

By the way, are there “official” plans to support multiple targets in 
the same binary at some point, by the way? It’s the first time I hear 
about it (that would be nice!).

-- 
Pierre-Marie de Rodat

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

* Re: [PATCH] Generalize overriding mechanism for debug info output options defaults
  2016-08-18 14:01   ` Pierre-Marie de Rodat
@ 2016-08-18 14:41     ` Jeff Law
  2016-08-26 10:46       ` Pierre-Marie de Rodat
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Law @ 2016-08-18 14:41 UTC (permalink / raw)
  To: Pierre-Marie de Rodat, Jakub Jelinek; +Cc: gcc-patches, Olivier Hainque

On 08/18/2016 08:01 AM, Pierre-Marie de Rodat wrote:
> On 08/18/2016 11:40 AM, Jakub Jelinek wrote:
>> I believe that is the preferred way, rather than macros.
>> The macros are yet another thing that would need to be undone if we ever
>> start supporting multiple targets in the same binary.
>> I don't see any advantages of introducing the macros.
>
> Ah, I understand, thank you. We debated a bit internally about whether
> one was better than the other, so thank you for the rationale!
>
> By the way, are there “official” plans to support multiple targets in
> the same binary at some point, by the way? It’s the first time I hear
> about it (that would be nice!).
It's pie in the sky right now, but it's something many of us want to see 
happen.  To that end we're trying to steer away from certain problematic 
idioms (like using macros to conditionalize behavior) towards schemes 
that would work in that world (hooks).

One good way to start thinking about this stuff is what would need to 
change to support a world where the target (or front-end) were a DSO and 
replaceable.

jeff


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

* Re: [PATCH] Generalize overriding mechanism for debug info output options defaults
  2016-08-18 14:41     ` Jeff Law
@ 2016-08-26 10:46       ` Pierre-Marie de Rodat
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre-Marie de Rodat @ 2016-08-26 10:46 UTC (permalink / raw)
  To: Jeff Law, Jakub Jelinek; +Cc: gcc-patches, Olivier Hainque

On 08/18/2016 04:41 PM, Jeff Law wrote:
> It's pie in the sky right now, but it's something many of us want to see
> happen.  To that end we're trying to steer away from certain problematic
> idioms (like using macros to conditionalize behavior) towards schemes
> that would work in that world (hooks).
>
> One good way to start thinking about this stuff is what would need to
> change to support a world where the target (or front-end) were a DSO and
> replaceable.

Interesting, thank you! So, I hereby abandon this patch. ;-)

-- 
Pierre-Marie de Rodat

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

end of thread, other threads:[~2016-08-26 10:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-18  9:32 [PATCH] Generalize overriding mechanism for debug info output options defaults Pierre-Marie de Rodat
2016-08-18  9:40 ` Jakub Jelinek
2016-08-18 14:01   ` Pierre-Marie de Rodat
2016-08-18 14:41     ` Jeff Law
2016-08-26 10:46       ` Pierre-Marie de Rodat

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