From patchwork Tue Jun 21 05:06:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 70507 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1830891qgy; Mon, 20 Jun 2016 22:09:31 -0700 (PDT) X-Received: by 10.66.160.41 with SMTP id xh9mr26275219pab.85.1466485771808; Mon, 20 Jun 2016 22:09:31 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id uq9si2222648pac.211.2016.06.20.22.09.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 22:09:31 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-70817-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-70817-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-70817-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type; q=dns; s=default; b=dhiNQ IjRK9rx0AhFvEgnQ9pIIHBAxZDOZT5TQiLSj19plAHYTkWe0sIeoPkf4gECm89Hq YGoW2AeLblGz1gaDLikA/ru0DQ47qPdUoIyjx8JWfGChs2Xyloz0zulmP/Cld8tH ii0tn2ls1QA4JFpebbMWlwqn0xjAgmjmRHBMKI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type; s=default; bh=RIYkRCKEBKe KlJUqpRevvvfc4V0=; b=qn4NN7P8rGGy4XB4DgwOViqKtlaFQWIXEv5WBYCeXR0 Q1b78tq9RZAucdUYn9U5Tn7lG9P0k7SGfGAOjVhlAT5tFPj+zmPLX6bEnnV2jvTW xzXWepiHhbbUAwO4/eoqN2HOwzhHzpU4lMOBX8jUtA97UVLBwwKzxEz3A1PZWZsU = Received: (qmail 109503 invoked by alias); 21 Jun 2016 05:09:22 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk 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 109488 invoked by uid 89); 21 Jun 2016 05:09:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=1917, Recover, 203, 7, 2037 X-HELO: na01-bl2-obe.outbound.protection.outlook.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; From: Yury Norov To: , CC: , , , , , , , , , Andrew Pinski , Yury Norov Subject: [PATCH 07/27] [AARCH64] Use PTR_* macros in dl-trampoline.S Date: Tue, 21 Jun 2016 08:06:51 +0300 Message-ID: <1466485631-3532-9-git-send-email-ynorov@caviumnetworks.com> In-Reply-To: <1466485631-3532-1-git-send-email-ynorov@caviumnetworks.com> References: <1466485631-3532-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-ClientProxiedBy: HE1PR03CA0017.eurprd03.prod.outlook.com (10.163.170.155) To SN1PR07MB2255.namprd07.prod.outlook.com (10.164.47.149) X-MS-Office365-Filtering-Correlation-Id: a1ce053c-90db-41e8-7b07-08d399922b7b X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2255; 2:M6/kBNhKXorDtBKsqHSnJqEJCy9GpnJhnUkz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KL+TRAnB0IlShGUF1/CiIDvSDdl5R7Jgap48U6yquZ8Kn1TL6lDaAy/qyBff2RaOAzhkJC+bbm0OW7v+G0Xue7IyHNpicDruSlIDLF7WQ== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2255; 20:sXuqEmdw1yPS+T0Z7sumcZlAIWdLfggI3f1PN0/6joaf/uW65Vf+7A5MXjAsfXomLICIUuVn3ALL36F9xluGpTQFWh8KaP9EiR22rKQ2kTGy1iR3C58SX3smXzIB26DN90FLrNV3ii4n/Sank8IIPlSk8yO2lmjq95y0jLR6ZpuH8WRR1WA67yXK5v4Luf8TxF5MUpvrjxhLnPTXN5hgnYHfJC2pRWtKkm+T4G3kKhSuJIGCC31Cz0CBXKjuEf+gQi4gj6oFBZUPy/1sx8Ji3uQyUq7xnOxyFEkqk+KeH7iVEs9qZupK6C6AZuhqxeMOKyscnrmfZpQ0gzeEHk9Ln1Vjt2cM1p0RjcxsIiR0/GtRXfglA1gOOlwFs+ZrGBF6Zno8XMXvM21bTfQJgdgTcUQ/885rV2C2CanK9MGbM2ZolVg9Tlc9IgezzDEW8spIzEuYb/CJyzFJ6QhHmTF+3NVDZ+nrpY1g7S5UhdbNycDF7IdL/J5njouq/uyHK21b7PuDbpZTOSRSTmnkh4B275oqWkAhSFoO9mfzRJezaaiVistDKSVG9eAotY5Qg8DdJ0Fql3Qlvt9Se4ZUfwap3oGkH7m+4RQ/4yc48ZgbYbM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:SN1PR07MB2255; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2255; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2255; 4:igD8s5zb0DUjgDyBWXzjGXBo2c1uBdjM8en8a2+qBaE1sSO1T+0d2qtoIhIS5MLNIagjUWAjl9y0U0hs64aZFcPmfuMc1UGKSn974oBYKsqMlhtcaR92WMNbEnhoQc6pZMr/yKAdLHVSbZFN6BdkZ840xIx78wjysQsj1qSIUR9qTmpowpAAftr8uP586luhD+48p6WhsHs4Cbzk2Ktr2HddOdMAy6OAHvN2ovdLCiSmOLFuC4qDwsLnaC6v7dThyd4glkzPdJVrHg3K7xQEtWo/1JU1xelCQzmps2EwhAXOcleSmbPUVZKiyjRC0weiI3JVG8m+zNpGRqZ050etztSQC/f/nACgrbM2jrmssE7fzLMLk4XhatiEDEQ61i9k X-Forefront-PRVS: 098076C36C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(48376002)(4001430100002)(68736007)(36756003)(5003940100001)(33646002)(81156014)(81166006)(8676002)(3846002)(6116002)(586003)(97736004)(42186005)(77096005)(189998001)(107886002)(5001770100001)(19580405001)(101416001)(76506005)(19580395003)(47776003)(105586002)(50986999)(106356001)(2950100001)(7736002)(7846002)(66066001)(229853001)(50466002)(50226002)(92566002)(76176999)(4326007)(2906002)(575784001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2255; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2255; 23:ndItpYMlWI0igEN8dpI2ItCMW5qZlYI1p2UWfLqd7?= =?us-ascii?Q?/wE8Q0DU3/cFC/6dUJ8NoIP7p8hgPrrnat7mRO+mBZgB8z/ZDE0lgy0/T0XS?= =?us-ascii?Q?HWdHf2F//tqN44cZl7SL9c2+1IoX9PYGvqhrVs0B46s6OO9po/FMrGw+MeJF?= =?us-ascii?Q?PDsDlPx3XNwDUFKlaSHceKC96T8hupn/DsMUycdOo+ErkUXsSFSkJJ4nEX5R?= =?us-ascii?Q?IAVZzuf5iGbqvL/ZUUKfTfz5mdA5IZW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ii?Q?fsC2RZu3p7k/XPVODXQv4HoeGuT7z+f?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2255; 6:EYy7dYKOrKhatBja5n4QsqMIamU6bWt4xc5rIXrH5jf7Up+mNMkrlcPbNy+738227acWxZlyyOuVDBBN+MZNnkRrrg7KrGAf8dPB0lz3xYE0HAncKIaqeBkK9c9OYbxouZexTsqiZ7eERfF8oYNzyHMILA5uQRkaQFn5M6pntOhM+8DSLww1Y5B6ywTKOaSTmrJ7f+kN9nbNGuqp8YZwVZ+Ek2hs/CEROPPiOp40wgjX3pz8TZ4MblPgu2rYqYcs/7cKu0yApoKEjEL0jLqA/AqlZqCxCPgD4a6rPccCHiE=; 5:DdUJCJJZPI0KaKsTb2kwjraHY0Uk61PFSQxQb3v4sA2hiMm5TkFV0MK1gQiurIRoTnSiVwPpB+WsPHZe2PKR3tzK76cVYgro9uGTgj/7nkln6MRheH2KvBUWv0Jjx4aCXq/WoRG8pAB4gvNaHa1i0g==; 24:UgKyQyyGdQtYP0fWvi/oW2vPuwwh7FSM7IuG5Ukx39XAydpNPgh2rPtzAWMDee6q/IqQT9/qDwZ9Yuj6+bja78yI7rRdM2/YYzicUdcLaQw=; 7:u6zUqJEe4toun0kmh6gZNiWq6v+4xe1rBJ58r6qBvLEHuqBb3APl0huHgh4S8rzxsWWoxnSVRCBndWVmax5RLlmDQ12j4crYqiFi+VPiiV3CQGaL8oNx67Rrx5do+1gQvi7pSGyf4TTJlqTPAIFQ090S8DoeDqmI6EYtILo2HRaALWv3uYSn24blJ9+ZD6PpVSu2VQGr/5lVK+BJ2tEItv1fPcZ6ajlAEOUaYPNVLG+hVdkxyTSFC0uLO93RVn1A SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2016 05:09:05.8365 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2255 From: Andrew Pinski Use the PTR_* macros in dl-trampoline.S so it can be used for both ILP32 and LP64. Also add a comment about what was an magic number (the size of the rela relocation entries). * sysdeps/aarch64/dl-trampoline.S (ip0l): New define. (RELA_SIZE): New define. (_dl_runtime_resolve): Use PTR_REG, PTR_SIZE. (_dl_runtime_profile): Likewise. Use RELA_SIZE and ip0l. Signed-off-by: Yury Norov --- sysdeps/aarch64/dl-trampoline.S | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S index 947a515..63ef6f7 100644 --- a/sysdeps/aarch64/dl-trampoline.S +++ b/sysdeps/aarch64/dl-trampoline.S @@ -22,9 +22,13 @@ #include "dl-link.h" #define ip0 x16 +#define ip0l PTR_REG (16) #define ip1 x17 #define lr x30 +/* RELA relocatons are 3 pointers */ +#define RELA_SIZE (PTR_SIZE * 3) + .text .globl _dl_runtime_resolve .type _dl_runtime_resolve, #function @@ -79,7 +83,7 @@ _dl_runtime_resolve: cfi_rel_offset (q1, 80+7*16) /* Get pointer to linker struct. */ - ldr x0, [ip0, #-8] + ldr PTR_REG (0), [ip0, #-PTR_SIZE] /* Prepare to call _dl_fixup(). */ ldr x1, [sp, 80+8*16] /* Recover &PLTGOT[n] */ @@ -87,7 +91,7 @@ _dl_runtime_resolve: sub x1, x1, ip0 add x1, x1, x1, lsl #1 lsl x1, x1, #3 - sub x1, x1, #192 + sub x1, x1, #(RELA_SIZE<<3) lsr x1, x1, #3 /* Call fixup routine. */ @@ -191,7 +195,7 @@ _dl_runtime_profile: stp x0, x1, [x29, #OFFSET_RG + DL_OFFSET_RG_SP] /* Get pointer to linker struct. */ - ldr x0, [ip0, #-8] + ldr PTR_REG (0), [ip0, #-PTR_SIZE] /* Prepare to call _dl_profile_fixup(). */ ldr x1, [x29, OFFSET_PLTGOTN] /* Recover &PLTGOT[n] */ @@ -199,7 +203,7 @@ _dl_runtime_profile: sub x1, x1, ip0 add x1, x1, x1, lsl #1 lsl x1, x1, #3 - sub x1, x1, #192 + sub x1, x1, #(RELA_SIZE<<3) lsr x1, x1, #3 stp x0, x1, [x29, #OFFSET_SAVED_CALL_X0] @@ -210,8 +214,8 @@ _dl_runtime_profile: add x4, x29, #OFFSET_FS /* address of framesize */ bl _dl_profile_fixup - ldr ip0, [x29, #OFFSET_FS] /* framesize == 0 */ - cmp ip0, #0 + ldr ip0l, [x29, #OFFSET_FS] /* framesize == 0 */ + cmp ip0l, #0 bge 1f cfi_remember_state @@ -243,7 +247,7 @@ _dl_runtime_profile: 1: /* The new frame size is in ip0. */ - sub x1, x29, ip0 + sub PTR_REG (1), PTR_REG (29), ip0l and sp, x1, #0xfffffffffffffff0 str x0, [x29, #OFFSET_T1]