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

Hans-Peter Nilsson hp@bitrange.com
Thu May 31 07:15:00 GMT 2012

On Thu, 31 May 2012, Georg-Johann Lay wrote:
> PR13697 appeared to be the easiest to fix so I proposed a patch.
> I am aware that the proposition is not optimal but it *works*.

Did you understand the point that you're marking an input
section when you should be marking the whole output section and
that your solution will break if the whole code is compiled with
-fdata-sections?  (Assuming no assembly code adding anything to
.data.)  And as there isn't a way to do the latter, better mark
all input sections.

> And as long as there is so much resistance to restore reasonable
> behavior (not move . backwards)

What you see as resistance is really attempts at a resolution to
help getting this fixed *without breaking expeced behavior

> I am fine with the suboptimal
> patch if it avoids users applications to break.

Better do it right then and mark all input sections in the .data
output section.  I would have suggested doing it for a single
one which will always be there, but as the whole section can be
GC:ed I guess there isn't any.

> > Alan pointed at two test-cases asserting the current behavior.
> As I already said it's a bug to move the location counter backwards.

The "backwards" view is apparently "just" an artefact of the
map-file being done before the section being GC:ed away, which
is admittedly also surprising.

brgds, H-P

More information about the Binutils mailing list