[PATCH] ld: Early detection of orphans we know will be discarded
Alan Modra
amodra@gmail.com
Wed Aug 23 22:22:00 GMT 2017
On Wed, Aug 23, 2017 at 04:47:30PM +0100, Andrew Burgess wrote:
> PR 21961
> * ldlang.c (lang_discard_section_p): New function.
> (lang_add_section): Checks moved out into new function, which is
> now called.
> (lang_place_orphans): Call lang_discard_section_p instead of
> duplicating some of the checks from lang_add_section.
> * testsuite/ld-elf/orphan-11.d: New file.
> * testsuite/ld-elf/orphan-11.ld: New file.
> * testsuite/ld-elf/orphan-11.s: New file.
> * testsuite/ld-elf/orphan-12.d: New file.
> * testsuite/ld-elf/orphan-12.s: New file.
OK with a minor nit fixed.
> +static bfd_boolean
> +lang_discard_section_p (asection *section)
> +{
> + bfd_boolean discard;
> + flagword flags = section->flags;
> +
> + /* Discard sections marked with SEC_EXCLUDE. */
> + discard = (flags & SEC_EXCLUDE) != 0;
> +
> + /* Discard the group descriptor sections when we're finally placing the
> + sections from within the group. */
> + if ((section->flags & SEC_GROUP) == SEC_GROUP
if ((flags & SEC_GROUP) != 0)
> + && link_info.resolve_section_groups)
> + discard = TRUE;
> +
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list