Introduce DWARF_VERSION_DEFAULT and redefine for VxWorks
authorOlivier Hainque <hainque@adacore.com>
Mon, 26 Sep 2022 16:05:48 +0000 (16:05 +0000)
committerOlivier Hainque <hainque@adacore.com>
Fri, 7 Oct 2022 06:53:30 +0000 (06:53 +0000)
commit8dffd0e9621d93faabb6676e7a018cb5267dfa22
treed0a90802d2284ff8d65a684481447d2b5551c45c
parent8307b7d6d0335da952a87bf56015f830072ac431
Introduce DWARF_VERSION_DEFAULT and redefine for VxWorks

This change introduces a target overridable macro to replace
the hardcoded value used to initialize dwarf_version from common.opt.

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

2022-02-28  Olivier Hainque  <hainque@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.
gcc/common.opt
gcc/config/vxworks.cc
gcc/config/vxworks.h
gcc/defaults.h
gcc/doc/tm.texi
gcc/doc/tm.texi.in