This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 32-bit PowerPC sdata linker problem


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]