On 01/10/2017 03:51 PM, Jakub Jelinek wrote:
Hi!
ASM_DEBUG_SPEC uses usually %{g:%{!g0:--gdwarf2}} or something similar.
In the past, it used to be %{g:--gdwarf2}. Both have problems (and thus
this is also a regression). The problem with the current ASM_DEBUG_SPEC
is that if one uses -g0 -g, which normally means that -g overrides -g0,
we still don't supply --gdwarf2 to as. Also, there are many options
starting with -g, so if one just uses gcc -grecord-gcc-switches foo.s,
--gdwarf2 is passed to as too, even when gcc -grecord-gcc-switches foo.c
actually doesn't emit any debug info. The problem with older
ASM_DEBUG_SPEC has been that even -g0 resulted in --gdwarf2 being passed
to as, or -g -g0 too.
The following patch fixes that by introducing a new spec function, which
compares debug_info_level against its argument (so in some other place
we could e.g. check if debug_info_level >= 3 and similar if needed).
To make this work, I had to mark all the -g* options with the Driver
flag, so that debug_info_level isn't computed just in the FEs, but also in
the driver.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2017-01-10 Jakub Jelinek <ja...@redhat.com>
PR driver/49726
* gcc.c (debug_level_greater_than_spec_func): New function.
(static_spec_functions): Add debug-level-gt spec function.
(ASM_DEBUG_SPEC, cpp_options): Use %:debug-level-gt(0) instead of
!g0.
* config/darwin.h (DSYMUTIL_SPEC, ASM_DEBUG_SPEC): Likewise.
* config/darwin9.h (DSYMUTIL_SPEC, ASM_DEBUG_SPEC): Likewise.
* common.opt (g, gcoff, gdwarf, gdwarf-, ggdb, gno-pubnames,
gpubnames, ggnu-pubnames, gno-record-gcc-switches,
grecord-gcc-switches, gno-strict-dwarf, gstrict-dwarf, gstabs,
gstabs+, gtoggle, gvms, gxcoff, gxcoff+): Add Driver flag.
c-family/
* c.opt (gen-decls): Add Driver flag.
ada/
* gcc-interface/lang.opt (gant, gnatO, gnat): Add Driver flag.
OK.
jeff