Hello,

This change is a proposal to introduce a target overridable macro
to replace the hardcoded value used in common.opt to initialize
dwarf_version.

The main advantage compared to special code in a target
override_options hook is that redefinitions by target config files
are visible by both the compiler proper and by the driver, which
might refer to dwarf_version in ASM_DEBUG_SPECs and friends.

This is useful at least on VxWorks, where we usually need to
default to dwarf 4 or even 2 to accommodate non-gdb debuggers
provided by the environment, including for assembly sources
used in libgcc for some ports (witnessed with lse.S on aarch64).

We have been using this in a lot of gcc-11 based toolchains
for various configurations for a while, cross and native.

This is a noop for anything but VxWorks and helped cure crashes
of target debuggers in VxWorks environments.

Bootstrapped and regression tested for mainline on x86_64-linux.

Is this ok to commit?

Thanks in advance!

Best Regards,

Olivier

2022-09-30  Olivier Hainque  <hain...@adacore.com>

gcc/
        * defaults.h (DWARF_DEFAULT_VERSION): Define if not
        defined already.
        * common.opt (gdwarf-): Use it.
        * doc/tm.texi.in (DWARF_DEFAULT_VERSION): Document.
        * doc/tm.texi: Update accordingly.

        * config/vxworks.h (DWARF_DEFAULT_VERSION): Redefine.
        * config/vxworks.cc: Remove code setting dwarf_version, now
        handled by the DWARF_DEFAULT_VERSION redefinition.

Attachment: 0012-Introduce-DWARF_VERSION_DEFAULT-and-redefine-for-VxW.patch
Description: Binary data

Reply via email to