From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25135 invoked by alias); 15 Apr 2013 18:22:33 -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 25126 invoked by uid 89); 15 Apr 2013 18:22:33 -0000 X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KAM_STOCKGEN,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_CP autolearn=no version=3.3.1 Received: from mail-qc0-f171.google.com (HELO mail-qc0-f171.google.com) (209.85.216.171) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 15 Apr 2013 18:22:32 +0000 Received: by mail-qc0-f171.google.com with SMTP id q2so755277qch.16 for ; Mon, 15 Apr 2013 11:22:30 -0700 (PDT) X-Received: by 10.49.25.163 with SMTP id d3mr4722573qeg.6.1366050150366; Mon, 15 Apr 2013 11:22:30 -0700 (PDT) Received: from pebble.twiddle.net (214.Red-217-126-56.staticIP.rima-tde.net. [217.126.56.214]) by mx.google.com with ESMTPS id c3sm33101427qed.1.2013.04.15.11.22.24 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 15 Apr 2013 11:22:29 -0700 (PDT) Message-ID: <516C4554.3090202@twiddle.net> Date: Mon, 15 Apr 2013 18:22:00 -0000 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 MIME-Version: 1.0 To: Will Newton CC: libc-ports@sourceware.org, Patch Tracking Subject: Re: [PATCH] ARM: Add Cortex-A15 optimized NEON and VFP memcpy routines, with IFUNC. References: <516BCEE5.9070809@linaro.org> <516C357F.40406@twiddle.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-04/txt/msg00068.txt.bz2 On 2013-04-15 19:44, Will Newton wrote: > On 15 April 2013 18:14, Richard Henderson wrote: >> On 2013-04-15 11:56, Will Newton wrote: >>> >>> +# ifdef PIC >>> +1: .long _GLOBAL_OFFSET_TABLE_ - 0b - PC_OFS >>> +.Lmemcpy_neon: >>> + .long C_SYMBOL_NAME(__memcpy_neon)(GOT) >>> +.Lmemcpy_vfp: >>> + .long C_SYMBOL_NAME(__memcpy_vfp)(GOT) >>> +.Lmemcpy_arm: >>> + .long C_SYMBOL_NAME(__memcpy_arm)(GOT) >> >> >> There's no need for GOT entries. Just use pc-relative references. > > Are you suggesting I use GOTOFF here or something else? Declining to look up the real names of the constants, something like ldr r1, .Lmemcpy_arm tst r0, #VFP ldrne r1, .Lmemcpy_vfp tst r0, #NEON ldrne r1, .Lmemcpy_neon 1: add r0, r1, pc bx lr .Lmemcpy_arm: .long C_SYMBOL_NAME(__memcpy_arm) - 1b - PC_OFS .Lmemcpy_vfp: .long C_SYMBOL_NAME(__memcpy_vfp) - 1b - PC_OFS .Lmemcpy_neon: .long C_SYMBOL_NAME(__memcpy_neon) - 1b - PC_OFS And I forgot -- this is a bug fix. Using GOT references from IFUNC resolvers is not guaranteed to work, due to the one pass nature of ld.so. See comments by Dave Miller in the glibc archive wrt Sparc IFUNC. And does anyone see a benefit to obfuscating this code with PIC tests just to avoid a single ADD insn in the static library? r~