This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: How do I get ld to pull sections from archived objects?
- From: David Fernandez <david dot fernandez dot work at googlemail dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Wed, 21 Aug 2013 12:34:26 +0100
- Subject: Re: How do I get ld to pull sections from archived objects?
- References: <CAA6dH31NUgy476CZ7Zzc_NjKoD1MooaTRACxw7AjrO9Nabtq-g at mail dot gmail dot com> <mvm7gffjp6z dot fsf at hawking dot suse dot de>
Hi Andreas,
Yes, I'm using --gc-sections currently.
Are you saying that I have to put it twice, one without KEEP to get it
in, and another with it to actually keep it?
My understanding is that KEEP only modifies the original specification
so that the garbage collector avoids dropping it.
My question is, Why do I have to have an actual object file either in
an INPUT() or in the command line to get the "*(my_special_thing)" to
pick the section, but it doesn't work if the object file is inside an
archive, say "libmyspecials.a", which is in a GROUP()?
Regards.
On Wed, Aug 21, 2013 at 11:47 AM, Andreas Schwab <schwab@suse.de> wrote:
> David Fernandez <david.fernandez.work@googlemail.com> writes:
>
>> SECTIONS
>> {
>> ...
>> my_special_thing ORIGIN(rom) : {
>> KEEP(*(my_special_thing))
>> }
>> ...
>> }
>>
>> If all the objects containing "my_special_thing" section are in
>> archives, this section never makes it to the final elf file.
>
> The KEEP operator is not about forcing a reference, only about not
> dropping it, if --gc-sections is in effect. It will not change in any
> way which inputs are considered for inclusion until the garbage
> collector runs. Thus it has no effect unless --gc-sections is used.
>
> Andreas.
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."