From patchwork Tue Nov 18 16:43:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 41048 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6666A241C9 for ; Tue, 18 Nov 2014 16:44:25 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf122261wgh.1 for ; Tue, 18 Nov 2014 08:44:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results; bh=ySDgIOEuBYCM6a+UyFRmUsfYu8r0SfSyHpK8DFTo3W8=; b=FxfEcuForvPgc8yySpr8NwUeiDt88OOG0sBjtd1QVtup1M1hAiMUNDzla7omXk5waN a60uTblZO+U0pxSN0c+jMajNFhLRn8ciPiDrGu4qMivdK9xP1zABzcR3vUmoLS12DH9x qNvJjpjpVzSBTbsUGnodNXlLA9r0HAX3Je35HWbiQaXV/Ea75oR5QFKULeFeKfvFFK6w 4CUxaRyzWvPLJIp3orK6DrSr7RkGp+qaI7ZoQfwf4yEbmf9FEFeFfrHt6Q6tRkumMLie xv80RTxVxgwp9bPAyr3hmI3QrbkHJ5yKy4m6R9FaOZTLVPWwe3nUnPBp6UAtybTK5ZwM 0tgw== X-Gm-Message-State: ALoCoQmHtHk+Aj+LqQNhvbrYr9ZQX28JJiCdtB3YHjXrrAgf+3RZO7nftdYRkcG/SlFYwikZhgTZ X-Received: by 10.180.82.34 with SMTP id f2mr5047834wiy.1.1416329064693; Tue, 18 Nov 2014 08:44:24 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.94.9 with SMTP id cy9ls1097422wib.22.canary; Tue, 18 Nov 2014 08:44:24 -0800 (PST) X-Received: by 10.181.13.106 with SMTP id ex10mr5430482wid.36.1416329064599; Tue, 18 Nov 2014 08:44:24 -0800 (PST) Received: from mail-ee0-x231.google.com (mail-ee0-x231.google.com. [2a00:1450:4013:c00::231]) by mx.google.com with ESMTPS id jq2si20624137wjc.53.2014.11.18.08.44.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 08:44:24 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4013:c00::231 as permitted sender) client-ip=2a00:1450:4013:c00::231; Received: by mail-ee0-f49.google.com with SMTP id e53so209875eek.22 for ; Tue, 18 Nov 2014 08:44:24 -0800 (PST) X-Received: by 10.194.3.45 with SMTP id 13mr48001255wjz.47.1416329064354; Tue, 18 Nov 2014 08:44:24 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp1359991lbc; Tue, 18 Nov 2014 08:44:23 -0800 (PST) X-Received: by 10.70.134.10 with SMTP id pg10mr589327pdb.47.1416329062252; Tue, 18 Nov 2014 08:44:22 -0800 (PST) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id ov3si38337662pbc.228.2014.11.18.08.44.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Nov 2014 08:44:22 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-54482-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 23847 invoked by alias); 18 Nov 2014 16:43:46 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Subscribe: List-Archive: List-Post: , List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 23704 invoked by uid 89); 18 Nov 2014 16:43:44 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ee0-f54.google.com X-Received: by 10.180.218.74 with SMTP id pe10mr18471586wic.48.1416329019513; Tue, 18 Nov 2014 08:43:39 -0800 (PST) From: Will Newton To: libc-alpha@sourceware.org Subject: [PATCH 3/3] AArch64: Reformat inline-asm in elf_machine_load_address Date: Tue, 18 Nov 2014 16:43:30 +0000 Message-Id: <1416329010-8683-4-git-send-email-will.newton@linaro.org> In-Reply-To: <1416329010-8683-1-git-send-email-will.newton@linaro.org> References: <1416329010-8683-1-git-send-email-will.newton@linaro.org> X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4013:c00::231 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 From: Andrew Pinski This patch reformats the inline-asm in elf_machine_load_address so it is easier to change only part of the inline-asm. That is using string concatenating instead of string continuation. Also document why this inline-asm works - it depends on the 32bit relocation being resolved at link time. ChangeLog: 2014-11-18 Will Newton Andrew Pinski * sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Refactor inline-asm. Also add comment. --- sysdeps/aarch64/dl-machine.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index 7f5ce2b..1294369 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -52,19 +52,22 @@ elf_machine_load_address (void) The choice of symbol is arbitrary. The static address we obtain by constructing a non GOT reference to the symbol, the dynamic address of the symbol we compute using adrp/add to compute the - symbol's address relative to the PC. */ + symbol's address relative to the PC. + This depends on 32bit relocations being resolved at link time + and that the static address fits in the 32bits. */ ElfW(Addr) static_addr; ElfW(Addr) dynamic_addr; - asm (" \n\ - adrp %1, _dl_start; \n\ - add %1, %1, #:lo12:_dl_start \n\ - ldr %w0, 1f \n\ - b 2f \n\ -1: .word _dl_start \n\ -2: \n\ - " : "=r" (static_addr), "=r" (dynamic_addr)); + asm (" \n" +" adrp %1, _dl_start; \n" +" add %1, %1, #:lo12:_dl_start \n" +" ldr %w0, 1f \n" +" b 2f \n" +"1: \n" +" .word _dl_start \n" +"2: \n" + : "=r" (static_addr), "=r" (dynamic_addr)); return dynamic_addr - static_addr; }