This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] ld: Early detection of orphans we know will be discarded
- From: Alan Modra <amodra at gmail dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 24 Aug 2017 07:52:38 +0930
- Subject: Re: [PATCH] ld: Early detection of orphans we know will be discarded
- Authentication-results: sourceware.org; auth=none
- References: <20170823154730.27290-1-andrew.burgess@embecosm.com>
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