This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] ld: Keep PREINIT_ARRAY/INIT_ARRAY/FINI_ARRAY sections for -r --gc-section
- From: Nick Clifton <nickc at redhat dot com>
- To: Alan Modra <amodra at gmail dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 12 Jan 2018 10:29:45 +0000
- Subject: Re: [PATCH] ld: Keep PREINIT_ARRAY/INIT_ARRAY/FINI_ARRAY sections for -r --gc-section
- Authentication-results: sourceware.org; auth=none
- References: <20180111165714.GA7379@gmail.com> <20180112080959.GI20622@bubble.grove.modra.org>
Hi Alan,
> I'm wondering why we need this part
>
>> + ${RELOCATING+${PREINIT_ARRAY}}
>> ${RELOCATING+${INIT_ARRAY}}
>> ${RELOCATING+${FINI_ARRAY}}
>
> given that if these were not wrapped in ${RELOCATING+} it seems like
> KEEP in the script ought to be good enough?
Ah ha - well I can answer that. If we are performing a relocatable link
then we need to preserve the section names because they may contain a
priority suffix. So for example we can input names like:
.init_array.100
.fini_array.444
.preinit_array.33
If the relocatable linker script contains something like:
.init_array { KEEP (*(.init_array.*)) }
then these priority suffixes will be lost.
Cheers
Nick