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

Alan Modra amodra@gmail.com
Thu May 31 08:23:00 GMT 2012


On Thu, May 31, 2012 at 03:14:49AM -0400, Hans-Peter Nilsson wrote:
> 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.

I agree with the rest of your comments, but not this one.  I think
you'll find that gas always emits .data, which is why I gave the OK to
Johann's patch.  Marking .data as kept also shouldn't adversely effect
--gc-sections operation on -ffunction-sections -fdata-sections code.

The best solution is probably using SEGMENT_START in avr.sc.  That
way -Tdata would affect an assignment to dot in the script *outside*
of an output section statement, so whether or not the section is kept
becomes irrelevant.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list