This is the mail archive of the binutils@sourceware.org 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: PR ld/11133: Static linking with gc-sections deletes sections with __start/__stop reference


On Tue, Jan 05, 2010 at 01:25:36PM -0800, Ian Lance Taylor wrote:
> Bother.  I wonder what would break if we simply moved up the call to
> lang_insert_orphans in lang_process.

You mean, move the call to lang_gc_sections after lang_place_orphans.
I think the major reason we run gc_sections before any section
placement is to avoid creating unused output sections.  That used to
be a problem before we had strip_excluded_output_sections, but
shouldn't matter much now.  I suppose there is the possibility of
__start_foo and __stop_foo symbols being created for an orphan section
that is later garbage collected.

However, the biggest problem with your idea is that it won't define
the symbols.  That doesn't happen until later in lang_do_assignments,
and we certainly can't move lang_gc_sections past lang_size_sections.

> In any case, adding special handling of __start and __stop symbols in
> two widely separated places does not sound like the best approach to
> me.

I agree that it's a hack, but slightly better than the magic __libc
section hack.

-- 
Alan Modra
Australia Development Lab, IBM


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