This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Always keep sections marked with SEC_KEEP
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 23 Oct 2015 11:46:11 +1030
- Subject: Re: [PATCH] Always keep sections marked with SEC_KEEP
- Authentication-results: sourceware.org; auth=none
- References: <1445541893-8228-1-git-send-email-hjl dot tools at gmail dot com> <20151022235157 dot GS13961 at bubble dot grove dot modra dot org>
On Fri, Oct 23, 2015 at 10:21:57AM +1030, Alan Modra wrote:
> diff --git a/bfd/elflink.c b/bfd/elflink.c
> index 2ed07e0..0bec93d 100644
> --- a/bfd/elflink.c
> +++ b/bfd/elflink.c
> @@ -12109,7 +12109,7 @@ _bfd_elf_gc_mark_hook (asection *sec,
> {
> sec = bfd_get_section_by_name (i, sec_name);
> if (sec)
> - sec->flags |= SEC_KEEP;
> + return sec;
> }
> }
> break;
BTW, I'm not sure what should happen if there are multiple input
sections mapping to an output section with __start_ and __stop_
symbols. The above change just keeps the first one whereas before you
attempted to keep them all.
--
Alan Modra
Australia Development Lab, IBM