This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

On Wed, 30 May 2012, Georg-Johann Lay wrote:
> upgraded to you new version, but with no avail:

Alas, but maybe not too far away.

Maybe -Tsegment (-Tdata here) can be made equivalent to the
newly proposed KEEP-on-output-sections or...

> These symbols have the expected addresses (just as without the patch)
> but the /subsequent/ data is still misplaced.

...maybe the recent changes just needs bits to check if
-Tsegment was passed to say the user wants the placement (with
holes) to be kept as well.

> I still prefer correct code over optimized but wrong code.

If you think the current behavior from --gc-sections is plain
wrong (i.e. even without -Tdata), don't use it.  Alan pointed at
two test-cases asserting the current behavior.  They were
introduced in 2006, for bugs ld/3223 and ld/3267 at a glance,
says the ChangeLogs.  I haven't analyzed if your concerns can be
made compatible with those, maybe they can; at least they didn't
use the -Tsegment option.  Right now however, the test-cases
that were thankfully added back then say "no, the current
behavior is as expected" and this stops us from oscillating (at
about 4e-8 Hz :) on the behavior, changing it as per your

> Until there is a proper fix, could the KEEP solution be applied?

KEEP all the input-sections then, not just the one with the same
name as the output section.

> Tristan Gingold wrote:
> > Why not adding a KEEP attribute on sections, ie like:

(I'm undecided, FWIW.  Maybe better make -Tsegment have
more intuitive and usable and less surprising effects, and
then we'd have a new feature with no users.)

> >
> > .data : KEEP ...
> > {
> >  ...
> > }
> Isn't this the same like the proposed KEEP(*(.data)) from above?

No, your patch was just marking one random input section which
happened to work for your test-case.

For example, if you had compiled the code that had the input
.data with -fdata-sections, it would have arrived as
.data.variable_name (IIRC).  So, marking them all would have
been the proper cover-up. :)

> If not: what is the difference?
> And what is the right syntax?
> This always exits with a syntax error and dosc don't mention KEEP at all:

Because that was a suggestion for new functionality, so the
syntax error from older linkers is good. :)

(You want that instead of silently "wrong" behavior from old

brgds, H-P

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]