From patchwork Tue Jun 28 16:39:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 71128 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1692995qgy; Tue, 28 Jun 2016 09:41:29 -0700 (PDT) X-Received: by 10.66.165.145 with SMTP id yy17mr3515110pab.116.1467132085208; Tue, 28 Jun 2016 09:41:25 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5si7658396pfp.124.2016.06.28.09.41.24; Tue, 28 Jun 2016 09:41:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752667AbcF1QlO (ORCPT + 30 others); Tue, 28 Jun 2016 12:41:14 -0400 Received: from mail-bn1bon0073.outbound.protection.outlook.com ([157.56.111.73]:10240 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752223AbcF1QlI (ORCPT ); Tue, 28 Jun 2016 12:41:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=/8rHCr/g8IChSdYZXSc8QNxTsaWQlfT+iBWzl7CpUpk=; b=VKP0w+N97pdJ1CHVMY53C9roxKdSigV3IK794IilayXFLAyN8ZGzR1xUjtatl6OWw0iJneddT1blWwSNBaM0aHdegDv3RfOPqYq/dq3Z4uw92yaSRmCzbj+Ws3VX4nbSWXlDgEjIhjKrgFBMcneaFkOBPtwkiEGA5imJiAzZrYw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by SN1PR07MB2255.namprd07.prod.outlook.com (10.164.47.149) with Microsoft SMTP Server (TLS) id 15.1.528.16; Tue, 28 Jun 2016 16:41:05 +0000 From: Yury Norov To: , CC: , , , , , , , , , , , , , , , , Andrew Pinski , Yury Norov Subject: [PATCH 07/23] [AARCH64] Use PTR_* macros in dl-trampoline.S Date: Tue, 28 Jun 2016 19:39:22 +0300 Message-ID: <1467131978-669-8-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467131978-669-1-git-send-email-ynorov@caviumnetworks.com> References: <1467131978-669-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM5PR0901CA0008.eurprd09.prod.outlook.com (10.164.186.146) To SN1PR07MB2255.namprd07.prod.outlook.com (10.164.47.149) X-MS-Office365-Filtering-Correlation-Id: d6ec9747-14f6-461a-2b25-08d39f72ffb8 X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2255; 2:MppgCdxb6Gm3qush99qgEInzFsGAAU0dWh7zoN9BfnY8TpNx2R52vdVQYTZtpF6je1LPTUij8bpRUyUxr4n2VtYFEqAFvcX5x86+fR/O5JQnEDNn4+F9Cln9qiNchuCfMNxvFk+RIvAQa0taprttd0hRderEcmp4k/Hox+HOwmLSAIdvff8/vla/2lJ9m/9n; 3:Bb2Vo6KUgI+bNP2cBkUPwt8XJgosLhKtgZf1dsZ8UTGF98NsVWMtEqoWtp/XpIJc8Mz1NxUsF7W5fCzmeaWtfX+iabtkocfF5GQGYgYm6p9VJvPrx6Jvic7ah+4RgP0j X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR07M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qQlkFHyog==; 20:g+RZFSNpnhVLQi+aprm0cosLVB80a+cZrTkqaMIrw9rtS2ZvD5z7eB5eLXb+1l9t6awtRzNggISWGQPPsvMDlj9u/NAlGY2tV3x0dDr844rOksZQEnJjuUsa6MT1fY45xMkdGV8WlZC8ARZ+G8DO3ZggX1ENuVcct8yv+TfdlSRNxG/dRD/PB3t7M3XtnbmlsPl1vk2a3WSIYMeVG1So1qONk+E8pWkFcn0w4sAX4sRi9njw5IVmVA0WFpOABYsfnIRbV/mmcRjezyHywE/9Ds1AZaedy0vh8Z/uZHcExWYdwfPZ8dmYSqVjZT4hyW8CAeBga7DeTO4xYkxBH5DmVZBccQbkkk8mNedKCw+pHSxeFTJk4AitMJ5ilZE20/UO9I3qu8bOxyFjzRvUKpp4OVEDKhWr87BvEyPJOOjint+Ng82cRa5672mfVAUN/xdPlMUSyr4Te0HVOKFxlj2S/1+6VKyG0wyjBRn1cgbTyXrMKxJpbiPwuu+c9fx5aPkmAGHWIXVlb3R6E0CGfOOkdytRvXauWHpZm5hVZdF8JuxiXP/y2824xqbA0NgCjTVuPnpvkN74V1kUQu9c1X+GE9OBSZYX2F0XlPZ96jwpzqc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:SN1PR07MB2255; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2255; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2255; 4:36xiJVFYGxhPCosV+2f8CSZBlguM3uRMMtJpuF5dVI3gMVpsXrsImUVyjD0Up8XIYvpTqbMYM6wvARD4iJFzRn6pwZbWgYAk7lYHfzQ4Fg1wuFX2cRmCRYJmRUfnHOC8/fugyeYMy8Gm9kX9mO9iRih3O/MjPxfZWsBRFjvTpy3oesD/MiM+pYbgeOenDHKITtKKZtuXVRM+c//Q/G2tP2ahxUeIlT9oKv3RmdgOvM6s7KyAvI3Q9m3furNcOhOxaYnDdtAd8dYZZTrPJRiHB5w3948Imq6U1XUpB4XTd5t19B0ZCMTWt0bv6IUJ/o4lOUh/Fr5C/yKnt6KCEhaYpG71d7lO7LMVNMk+o2ZccyDxr52o++IeEFUHB16qahZx X-Forefront-PRVS: 0987ACA2E2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(305945005)(4001430100002)(586003)(6116002)(3846002)(7736002)(77096005)(68736007)(50226002)(7846002)(36756003)(2906002)(33646002)(5003940100001)(2950100001)(4326007)(76506005)(97736004)(42186005)(5001770100001)(81156014)(107886002)(189998001)(19580405001)(101416001)(229853001)(106356001)(76176999)(575784001)(66066001)(8676002)(50986999)(50466002)(48376002)(19580395003)(47776003)(105586002)(92566002)(81166006)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2255; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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:IUyf18r9EAeRcVZMk5WF0CPcHOd7SX8p8YWuOzlTY?= =?us-ascii?Q?T0joop14DL6qb5eEIdtEgeU9wlTo/A4z0OU465gC6rIcZdljnnsHGO87fvGP?= =?us-ascii?Q?+qzT8d4nx5nfXBjRYhyeoWsBBgri36y90PXgoQ4Auko1MsocipVzT4t/pf3a?= =?us-ascii?Q?E5fd4rD0fSfHccK0xJI4kjX4q3kMdfr1IJuJBK677QQHTQpoT2eUM0Z4vVa8?= =?us-ascii?Q?jpBjaU4hW+/TpOe7sFLrJIKnKw7GubRk8If7hhx+IuaVaAqokkJ7RqU5d0aE?= =?us-ascii?Q?shqc26o5Hzc1uArypB28ddFu8mIieiS9/PoF6YVWd/W6LI9iFWhKdrTYSye+?= =?us-ascii?Q?PkYxvkCGIsqHdIHV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2255; 6:Vz9h2VDUh7DWmyshXzTuSrM4OZJ+U/ChezCtfZ+CDwC8Z54LY8YfPbeT/rltloxxR7TrcixlNl9zxgkn3bdHSjeEGrfBby7+RAYR/YhIn/BPZ1BoFAvgxXWvbVGd0x0f+zAENY+2NdeHCv2gRK+TbrDkt/t3kSaI5Fjm6Ag3ZcNb0NRwVh4rawtSbwjw6pOntQB6ootX5hixBREnE98R2U/Y5eMyz8p5Yv0vjZqEJeSoCVZEmKtVM/AAgTEBt0sIwkcaZwz40UDSy0eEFumi+lTvihDp5ZDRphOFEnnWB14=; 5:PBhyeUA48y0KDeUn2ifMv49Mm12kfddkWNIvUPwvQyMHztEqf8c27xfLOQc4ExceRp5gfIIil4PpuQIhDz3giPKBvztdwh5373ObHV+E22rXn9L8A/R4IAj+o3B7B38pDMBZYO10qxoWdJnX9YUOMQ==; 24:BLx4TlFIfoDt+BmcAfbuNdxbo0GsBkSmejQueNUTvtgg1wBJ8tERo9AOkq5IE1VH/lEr2If9XDHardfBCfFVFKzzByJhvlYQ5RMMup67ams=; 7:DGrD84Jwkzvgq/1oRSeZzgUXWrnu4pex37oYPcZxZ1Rz/or8rnrUtciGWHaw4iHhizQbG3JwQGd8UlzR5lLF4AKyQHp6HAY4RRllzHXGNt6LVCDa3QWqF3FQd+43S1BhCjE+68pTZr5rdOHe1tn1HOxxv/zIzwe8TEZIxO1JmnIZY5Y1g51Y7TSjvztZ8sBP2jNXjAkLZvcjVrjFTBgEOMpreO99LOGbA6F0bYyX9V1yTOwGudL8CCzg4mkSgmjw SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2016 16:41:05.0856 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2255 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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]