public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Mark Salter <msalter@redhat.com>
Cc: marcus.shawcroft@linaro.org, libc-ports <libc-ports@sourceware.org>
Subject: Re: aarch64 prelink issue
Date: Mon, 24 Jun 2013 17:18:00 -0000	[thread overview]
Message-ID: <51C87F49.3070008@twiddle.net> (raw)
In-Reply-To: <1372092109.3739.13.camel@t520.redhat.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~

  reply	other threads:[~2013-06-24 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24 16:41 Mark Salter
2013-06-24 17:18 ` Richard Henderson [this message]
2013-06-26 12:43   ` Mark Salter
2013-06-26 15:36     ` Marcus Shawcroft
2013-06-26 16:48       ` Richard Henderson

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=51C87F49.3070008@twiddle.net \
    --to=rth@twiddle.net \
    --cc=libc-ports@sourceware.org \
    --cc=marcus.shawcroft@linaro.org \
    --cc=msalter@redhat.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).