https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97355
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nickc at gcc dot gnu.org
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Mark Wielaard from comment #11)
> I don't understand why the .debug sections are compared in this case.
>
> But if they are then the diff comes from this gas issue:
> https://sourceware.org/bugzilla/show_bug.cgi?id=26740
>
> Even though unused gas -g might emit the input file name in the file table
> in some situations. It is harmless but since the the generated assembly file
> name might be different between stage2 and stage3 you will see a diff.
>
> If this really is an issue I think a workaround might be to make sure that
> the .file 1 directive is emitted as early as possible.
But what is the problematic line before .file 1? E.g. if I look at
lbasename.s, I see:
.file "lbasename.c"
.text
.Ltext0:
.p2align 4
.globl unix_lbasename
.type unix_lbasename, @function
unix_lbasename:
.LVL0:
.LFB20:
.file 1 "../../libiberty/lbasename.c"
In any case, the change to use -gdwarf-* by default even when not compiling
just assembly was based on the assumption that gas would in that case pretty
much only change the format of the .debug_line section generated from
.file/.loc directives, but certainly not append anything on top of that itself
(e.g. append some stuff to the compiler emitted .debug* sections).
So, if that is not the case, we either need to fix gas in a similar way how it
has been changed before for compiler generated .debug_line, if gas starts
generating something and then sees compiler generated .debug* sections, it
should throw away everything as if -gdwarf-* only affected the default version.
Or we need a different gas option to just change the default dwarf level but
don't enable any other -gdwarf behavior of gas.