[PATCH] ld: Keep PREINIT_ARRAY/INIT_ARRAY/FINI_ARRAY sections for -r --gc-section

Alan Modra amodra@gmail.com
Fri Jan 12 08:10:00 GMT 2018


On Thu, Jan 11, 2018 at 08:57:14AM -0800, H.J. Lu wrote:
> We must keep all PREINIT_ARRAY, INIT_ARRAY as well as FINI_ARRAY sections
> for ld -r --gc-section.
> 
> OK for master?
> 
> H.J.
> ---
> bfd/
> 
> 	PR ld/22677
> 	* elflink.c (bfd_elf_gc_sections): Keep all PREINIT_ARRAY,
> 	INIT_ARRAY as well as FINI_ARRAY sections for ld -r --gc-section.

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?

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list