public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Nick Clifton <nickc@redhat.com>
Cc: "H.J. Lu" <hjl.tools@gmail.com>, binutils@sourceware.org
Subject: Re: [PATCH] ld: Keep PREINIT_ARRAY/INIT_ARRAY/FINI_ARRAY sections for -r --gc-section
Date: Fri, 12 Jan 2018 10:45:00 -0000	[thread overview]
Message-ID: <20180112104543.GN20622@bubble.grove.modra.org> (raw)
In-Reply-To: <746c0fc4-fd1c-c5e9-2dbe-f77017ff751b@redhat.com>

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

      reply	other threads:[~2018-01-12 10:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 16:57 H.J. Lu
2018-01-12  8:10 ` Alan Modra
2018-01-12 10:29   ` Nick Clifton
2018-01-12 10:45     ` Alan Modra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180112104543.GN20622@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).