bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/25561] Incorrect DWARF info emitted when variable removed due to


From: chrisc112358 at gmail dot com
Subject: [Bug ld/25561] Incorrect DWARF info emitted when variable removed due to --gc-sections
Date: Tue, 03 Mar 2020 16:22:02 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=25561

--- Comment #2 from chrisc112358 at gmail dot com ---
(In reply to Nick Clifton from comment #1)
> Hi Chris,
> 
> > The "DW_AT_location" of a variable which is discarded as a result of using
> > the CFLAG -fdata-sections and the LDFLAG --gc-sections will be incorrectly
> > set to 0. 
> 
> Sadly this is a known problem and not an easy one to fix.
> 
> The issue is that in order for the linker to be able to correctly discard
> DWARF information that is no longer relevant it must be told which pieces of
> information below to which variable (or function, or whatever).  In order to
> do this the compiler needs to compartmentalise the debug information so that
> all the DWARF associated with one data section is placed into a separate
> debug section, and the two are linked together by a section group.  Once
> this is done, the linker will automatically discard the debug information
> when it discards the data section.  Hence this is really a gcc problem, not
> a binutils one.
> 
> Cheers
>   Nick

Thanks for the info and context Nick, appreciate it! At a high level I figured
the linker is already updating "DW_AT_location" today when it determines the
actual address during the placement process so I figured if the symbol didn't
get placed, the linker could strip the info instead.

Do you know if there are any tickets already tracking the suggested gcc changes
you mentioned? It's a pretty confusing issue when it does happen (esp for archs
where 0x0 is a valid location) but totally understand if it is the kind of
thing that is just too difficult to fix.

Thanks,
Chris

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]