This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: aarch64 prelink issue
- From: Richard Henderson <rth at twiddle dot net>
- To: Mark Salter <msalter at redhat dot com>
- Cc: marcus dot shawcroft at linaro dot org, libc-ports <libc-ports at sourceware dot org>
- Date: Mon, 24 Jun 2013 10:18:01 -0700
- Subject: Re: aarch64 prelink issue
- References: <1372092109 dot 3739 dot 13 dot camel at t520 dot redhat dot com>
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~