public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: Alan Modra <amodra@gmail.com>, "H.J. Lu" <hjl.tools@gmail.com>
Cc: 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:29:00 -0000	[thread overview]
Message-ID: <746c0fc4-fd1c-c5e9-2dbe-f77017ff751b@redhat.com> (raw)
In-Reply-To: <20180112080959.GI20622@bubble.grove.modra.org>

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.

Cheers
  Nick

  reply	other threads:[~2018-01-12 10:29 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 [this message]
2018-01-12 10:45     ` Alan Modra

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=746c0fc4-fd1c-c5e9-2dbe-f77017ff751b@redhat.com \
    --to=nickc@redhat.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.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).