[Patch,AVR]: Fix PR13697: Wrong symbols with --gc-sections

Tristan Gingold gingold@adacore.com
Wed May 30 07:54:00 GMT 2012


On May 30, 2012, at 6:17 AM, Alan Modra wrote:

> On Tue, May 29, 2012 at 03:37:45PM -0400, Hans-Peter Nilsson wrote:
>> On Tue, 29 May 2012, Georg-Johann Lay wrote:
>>> At the start of .bss the location counter is moved backwards!
>>> I still think this is a linker bug.
>> 
>> Well yes, but the point was that the bug is not the linker
>> script's lack of KEEP.
> 
> Whether or not this is a bug depends on how you think zero size
> discarded output sections should be treated.  One extreme is to treat
> discarded output sections as if they do not exist, so address,
> alignment, mapping to segments, and probably other things I've
> forgotten, are ignored and so do not affect following sections.  The
> other extreme is to just remove them from the section headers, but
> otherwise apply all their attributes.  Johann seems to want this
> latter behaviour judging from his comment about optimisation.  The
> trouble is that whatever ld does, someone will be unhappy.  For
> instance, if we always apply alignment then you can get holes in the
> memory image caused by unused sections.  Some will view that as a
> "bug".

Why not adding a KEEP attribute on sections, ie like:

.data : KEEP ...
{
 ...
}

to many everyone happy ?

Tristan.



More information about the Binutils mailing list