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