https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97355
John David Anglin <danglin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #4 from John David Anglin <danglin at gcc dot gnu.org> ---
dave@atlas:~/gnu/gcc/gcc$ git bisect bad
6923255e35a3d54f2083ad0f67edebb3f1b86506 is the first bad commit
commit 6923255e35a3d54f2083ad0f67edebb3f1b86506
Author: Jakub Jelinek <[email protected]>
Date: Wed Oct 7 10:55:35 2020 +0200
debug: Pass --gdwarf-N to assembler if fixed gas is detected during
configure
> > As for the test assembly, I'd say we should take
> > #define F void foo (void) {}
> > F
> > compile it with
> > gcc -S -O2 -g1 -dA -gno-as-loc-support -fno-merge-debug-strings
> > remove .cfi_* directives, remove the ret instruction, change @function
> > and @progbits to %function and %progbits, change .uleb128 to just
.byte,
> > I think all the values should be small enough, maybe change .value to
> > .2byte and .long to .4byte (whatever is most portable across different
> > arches and gas versions), simplify (shorten) strings and adjust
> > sizes, and do something with the .quad directives, that is dependent on
> > the address size, perhaps just take those attributes out and adjust
> > .debug_abbrev? Finally, remove all comments (emit them in the first
case
> > just to better understand the debug info).
>
> I'm afraid it is hard to avoid the .quad or .8byte.
> Here is a 64-bit address version that assembles fine by both x86_64 and
> aarch64 as.
> Unfortunately doesn't fail with broken gas versions with -gdwarf-2
without
> the nop, so we'll need at least a nop in there.
> Fortunately gcc/configure.ac already determines the right nop insn for
the
> target, in $insn.
> So I guess what we want next is have the 32-bit version of this with
.4byte
> instead of .8byte and just let's try to assemble both versions, first
> without -gdwarf-2 and the one that succeeds assemble again with -gdwarf-2
> and check for the duplicate .debug_line sections error.
Ok, here it is in patch form.
I've briefly tested it, with the older binutils I have around (no
--gdwarf-N
support), with latest gas (--gdwarf-N that can be passed to as even when
compiling C/C++ etc. code and emitting .debug_line) and latest gas with
Mark's fix
reverted (--gdwarf-N support, but can only pass it to as when assembling
user .s/.S files, not when compiling C/C++ etc.).
2020-10-07 Jakub Jelinek <[email protected]>
* configure.ac (HAVE_AS_GDWARF_5_DEBUG_FLAG,
HAVE_AS_WORKING_DWARF_4_FLAG): New tests.
* gcc.c (ASM_DEBUG_DWARF_OPTION): Define.
(ASM_DEBUG_SPEC): Use ASM_DEBUG_DWARF_OPTION instead of
"--gdwarf2". Use %{cond:opt1;:opt2} style.
(ASM_DEBUG_OPTION_DWARF_OPT): Define.
(ASM_DEBUG_OPTION_SPEC): Define.
(asm_debug_option): New variable.
(asm_options): Add "%(asm_debug_option)".
(static_specs): Add asm_debug_option entry.
(static_spec_functions): Add dwarf-version-gt.
(debug_level_greater_than_spec_func): New function.
* config/darwin.h (ASM_DEBUG_OPTION_SPEC): Define.
* config/darwin9.h (ASM_DEBUG_OPTION_SPEC): Redefine.
* config.in: Regenerated.
* configure: Regenerated.
gcc/config.in | 13 +++
gcc/config/darwin.h | 1 +
gcc/config/darwin9.h | 3 +
gcc/configure | 310 +++++++++++++++++++++++++++++++++++++++++++++++++++
gcc/configure.ac | 188 +++++++++++++++++++++++++++++++
gcc/gcc.c | 77 ++++++++++++-
6 files changed, 588 insertions(+), 4 deletions(-)
dave@atlas:~/gnu/gcc/gcc$ as --version
GNU assembler (GNU Binutils for Debian) 2.35.1