This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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: aarch64 prelink issue


On 06/24/2013 09:41 AM, Mark Salter wrote:
> I worked around this with:
> 
> diff --git a/ports/sysdeps/aarch64/dl-machine.h b/ports/sysdeps/aarch64/dl-machine.h
> index 94f1108..f69c618 100644
> --- a/ports/sysdeps/aarch64/dl-machine.h
> +++ b/ports/sysdeps/aarch64/dl-machine.h
> @@ -36,7 +36,14 @@ elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
>  static inline ElfW(Addr) __attribute__ ((unused))
>  elf_machine_dynamic (void)
>  {
> -  ElfW(Addr) addr = (ElfW(Addr)) &_DYNAMIC;
> +  ElfW(Addr) addr;
> +
> +  asm ("					\n\
> +        ldr	%w0, 1f				\n\
> +        b	2f                              \n\
> +1:	 .word	_DYNAMIC			\n\
> +2:						\n\
> +       " : "=r" (addr));
>    return addr;
>  }
>  
> I suppose the prelink tool could work around this itself which would
> allow it to work on all versions of glibc. Even in that case, the
> above patch still saves an unnecessary got+reloc.

Try the x86_64 solution:

  /* This produces an IP-relative reloc which is resolved at link time. */
  extern const ElfW(Addr) _GLOBAL_OFFSET_TABLE_[] attribute_hidden;
  return _GLOBAL_OFFSET_TABLE_[0];

with the extra hidden attribute, this should result in an ADR(P)
reference to the _G_O_T_.


r~


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