From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1493 invoked by alias); 24 Jun 2013 17:18:09 -0000 Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org Received: (qmail 1481 invoked by uid 89); 24 Jun 2013 17:18:08 -0000 X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.1 Received: from mail-qa0-f52.google.com (HELO mail-qa0-f52.google.com) (209.85.216.52) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 24 Jun 2013 17:18:07 +0000 Received: by mail-qa0-f52.google.com with SMTP id bv4so2379644qab.4 for ; Mon, 24 Jun 2013 10:18:06 -0700 (PDT) X-Received: by 10.224.151.137 with SMTP id c9mr19862370qaw.107.1372094286109; Mon, 24 Jun 2013 10:18:06 -0700 (PDT) Received: from anchor.twiddle.net (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id w2sm21060683qec.8.2013.06.24.10.18.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 24 Jun 2013 10:18:05 -0700 (PDT) Message-ID: <51C87F49.3070008@twiddle.net> Date: Mon, 24 Jun 2013 17:18:00 -0000 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: Mark Salter CC: marcus.shawcroft@linaro.org, libc-ports Subject: Re: aarch64 prelink issue References: <1372092109.3739.13.camel@t520.redhat.com> In-Reply-To: <1372092109.3739.13.camel@t520.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-06/txt/msg00045.txt.bz2 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~