public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Will Newton <will.newton@linaro.org>
To: "binutils@sourceware.org" <binutils@sourceware.org>,
	Alan Modra <amodra@gmail.com>
Subject: Re: 32-bit PowerPC sdata linker problem
Date: Mon, 16 Jun 2014 11:21:00 -0000	[thread overview]
Message-ID: <CANu=Dmi46CDbvT3ozcjNJkyMY47Qh_TbgAgrAMPW1SpbeXX4mA@mail.gmail.com> (raw)
In-Reply-To: <20140607124711.GO5592@bubble.grove.modra.org>

On 7 June 2014 13:47, Alan Modra <amodra@gmail.com> wrote:

Hi Alan,

> On Fri, Jun 06, 2014 at 09:46:59PM +0930, Alan Modra wrote:
>> Ah, light dawns.  I'm guessing you still have a definition for
>> _SDA_BASE_ in your linker script, but using PROVIDE.  Due to the way I
>> implemented the automatic define of _SDA_BASE_, PROVIDE in a linker
>> script won't override the automatic define.  That's a bug.
>
> Fixed like this.  Will fail to work if crt1.o happens to have a
> .sdata section, due to the necessity of defining _SDA_BASE_ on the
> first .sdata section.
>
>         * ldexp.c (exp_fold_tree_1 <etree_provide>): Make PROVIDEd
>         linker script symbol value override a built-in linker symbol.
> diff --git a/ld/ldexp.c b/ld/ldexp.c
> index d573fb7..5c4f8dd 100644
> --- a/ld/ldexp.c
> +++ b/ld/ldexp.c
> @@ -1001,7 +1001,10 @@ exp_fold_tree_1 (etree_type *tree)
>               if (h == NULL
>                   || (h->type != bfd_link_hash_new
>                       && h->type != bfd_link_hash_undefined
> -                     && h->type != bfd_link_hash_common))
> +                     && h->type != bfd_link_hash_common
> +                     && !(h->type == bfd_link_hash_defined
> +                          && (h->u.def.section->flags
> +                              & SEC_LINKER_CREATED) != 0)))
>                 {
>                   /* Do nothing.  The symbol was never referenced, or was
>                      defined by some object.  */


This patch seems to break static ifunc links on ARM. I believe it is
caused by the default linker script providing symbols twice
(__rel_iplt_start, __rel_iplt_end) and the second definition now
overriding the first. At first glance that would appear to be sane
behaviour, but with the current linker script the result is a broken
binary. Any ideas on what the best fix would be?

Thanks,

  .rel.dyn        :
    {
      *(.rel.init)
      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
      *(.rel.fini)
      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
      *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*)
      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
      *(.rel.ctors)
      *(.rel.dtors)
      *(.rel.got)
      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
      PROVIDE_HIDDEN (__rel_iplt_start = .);
      *(.rel.iplt)
      PROVIDE_HIDDEN (__rel_iplt_end = .);
      PROVIDE_HIDDEN (__rela_iplt_start = .);
      PROVIDE_HIDDEN (__rela_iplt_end = .);
    }
  .rela.dyn       :
    {
      *(.rela.init)
      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
      *(.rela.fini)
      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
      *(.rela.ctors)
      *(.rela.dtors)
      *(.rela.got)
      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
      PROVIDE_HIDDEN (__rel_iplt_start = .);
      PROVIDE_HIDDEN (__rel_iplt_end = .);
      PROVIDE_HIDDEN (__rela_iplt_start = .);
      *(.rela.iplt)
      PROVIDE_HIDDEN (__rela_iplt_end = .);



-- 
Will Newton
Toolchain Working Group, Linaro

  reply	other threads:[~2014-06-16 11:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <53918356.3040102@embedded-brains.de>
2014-06-06 10:54 ` Alan Modra
2014-06-06 11:23   ` Sebastian Huber
2014-06-06 11:31     ` Sebastian Huber
2014-06-06 12:15       ` Alan Modra
2014-06-06 12:49         ` Sebastian Huber
     [not found]           ` <20140606130559.GK5592@bubble.grove.modra.org>
     [not found]             ` <5391C0E8.7010409@embedded-brains.de>
     [not found]               ` <20140606134915.GL5592@bubble.grove.modra.org>
     [not found]                 ` <5391CCFB.5060206@embedded-brains.de>
2014-06-07 12:34                   ` Alan Modra
2014-06-10  6:28                     ` Sebastian Huber
2014-06-06 12:17     ` Alan Modra
2014-06-07 12:47       ` Alan Modra
2014-06-16 11:21         ` Will Newton [this message]
2014-06-16 13:07           ` Alan Modra
2014-06-16 14:10             ` Will Newton
2014-06-16 14:11               ` Will Newton
2014-06-18  0:29                 ` 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='CANu=Dmi46CDbvT3ozcjNJkyMY47Qh_TbgAgrAMPW1SpbeXX4mA@mail.gmail.com' \
    --to=will.newton@linaro.org \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /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).