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
On Fri, Jan 12, 2018 at 10:29:45AM +0000, Nick Clifton wrote:
> 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.
Duh! I hadn't even taken note of the fact that the section match
contained a wild card.
--
Alan Modra
Australia Development Lab, IBM