From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752788AbcF1Qmi (ORCPT ); Tue, 28 Jun 2016 12:42:38 -0400 Received: from mail-bn1bon0086.outbound.protection.outlook.com ([157.56.111.86]:60032 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752683AbcF1Qly (ORCPT ); Tue, 28 Jun 2016 12:41:54 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; From: Yury Norov To: , CC: , , , , , , , , , , , , , , , , Andrew Pinski , Yury Norov Subject: [PATCH 11/23] [AARCH64] Add ILP32 support to elf_machine_load_address. Date: Tue, 28 Jun 2016 19:39:26 +0300 Message-ID: <1467131978-669-12-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 Content-Type: text/plain X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM5PR0901CA0040.eurprd09.prod.outlook.com (10.164.186.178) To BN4PR07MB2242.namprd07.prod.outlook.com (10.164.63.148) X-MS-Office365-Filtering-Correlation-Id: 188da83e-17c4-4916-1297-08d39f73178f X-Microsoft-Exchange-Diagnostics: 1;BN4PR07MB2242;2:hXzTzqfZ88NTzSeSdeh4s9L9NRzCeZU8BTzlss5zHGhYWsCmp9X5PEh4cMNedSy/YlMdhSd64KQhobO0KI3ciqy09Gd9N8saQFV/k9jbj6gxmBYB8GvBlGKy8+bcSej2cbsaYbfH6Ik5JxwwICke6w2zDIYaw08reTWa7jQnzxmROr6+dGGLWqHYjeCpFO2k;3:EMIcNxkJW7xRBVzu5DXoza/4MfZePZInkxgbsvy5wsRpeAArLN4aqQwRXflMzlIyBXQRgJIAYlVHqmJgvCzG5T5EzjIQJxR7cnK+9L8vLKt8FRFhplC211t+eBPhLMhR X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN4PR07MB2242; X-Microsoft-Exchange-Diagnostics: 1;BN4PR07MB2242;25:Pgjj4COJybjMKB4HFbodPm5meDg4V4ZNSmzKVwry3BzevsyShPIKcpx53G11f9JZHp2NlLpBR/x97hlUKrJf4GVFY1Yp986yK2pa0EiVztzJx+EpkI0mqzuNQ3EGZK8eYXROb7a19Imcn/g3PL9X230/ZlVlQTYx0gHWtkhDq+XpVhLpAkC4+4aBouw/0kNv7aaRT38P3c4WqoLQ8Hlw+Hg20aicMSm+snXo54aDkZQyQYdy2ExeJr/3GfhanwzABpvgPyw9EllLvRSkj582dfFMgZXuxlYviOjBfYbx6AFzeh6VcDdCr+M7bwW+hByQgJAtxj83yMxbV09HdyWS23j/63YStc5i4nC3d4okc9Lxt4avEPKNVYC73LzYcYWgILHWAKseJCaGlN613R7YPPFwcJGTf3a/9PDhLpu0wItoFCSoNC7qlPnYra7q0s1M64UQ+rW7y9wQTAqKRShVjQ+FcILNwfEKCNzJw17skrcA37Ig4q7L4OcrEtg8qQ5lNWPwn9bl7XEB2FWZow36v/c1eXyTWhj/CnM+P+XpvB1pYzm9rXKKriSRp+BKW0P7SjfiZv7fsovW3wbVnQuuuiVuxN1DL+Aff6MD3gY6GX1RF5zUHr+ozZ8htocGvup55aIuoXYFq5lwlPq18/yUYFbdztvFK0g3IWp4fuHaPFbFb1irQzNsnbhaubpvxYray1mitiT0IKK/40FFIgIjdhfo1KqXEhhFlU0oSOQ/JRpwHy8IvTAo+milGSTdISEj X-Microsoft-Exchange-Diagnostics: 1;BN4PR07MB2242;31:qulGXbkqnN1tX1oEP/IJXP1nbHX+kxcoFbe39JasKKt4HY3d7cVdW8alp0yHJaaHABPqlxIP+xMec6Ghce9/u6EFlLfSh/y/CFRpRSSazISj/Wh/sMkz/yTwVyEui0Pon54OsEhc5iiQUVDUHIg3L48Jb2/EJWUS5+qCBnaR/w09bFIc158qOuuN1afYXtUuxF/NldDgn/iO7shIZT+pmQ==;20:cjTr23AtU7DWJlWzSGltVcQVAQLdzS7atvLGgK3FgbhL8fAVunn1Nn9qgXbrPsOJpkZ+OtAtFnafBU+nqFofdNPPVHj3kCyDkFDTEluoe8f3yEBIftUyncKD3JY75V1Rui8Kvm7ZAXHsJEL2hTB7XkJ67KkTNaQdCdyKqLXve4IWIoiXbJgp1A0224HhsHrnEBj4tDtlQiuffzNYiY8WT/RtU00z9fQcoAQu8liu1z/YRDjpV41OpgqXYzi+LfyqlmjZ58zEGpxWL5PpIKrWD1joTGYIdNKSAK7Ln8AgUQuDBnm1qzrndtezg2cqAb7Z/wRFlENYkEaejgx1oa9DARvvsIFmBvtHlGWnL/xaEHSyFqwSKr0pkNdby4KV9QZhhod5yeO2A91Tr3I/+c86ByfGBTmyHBWbB6+XmQSevoMB0SBdYUXPuG8zTDRdd2JyjP6N6A0J0AGtF3arLq3o7OzVVk5o0pg0YC3I6wynvoY7HemkKPAXXDFqoJpDyXjvuDdrBpQ2KVImFmCvgPMRKxkEqS9sVV14szGRC06YSE7KF3v1yxdNMXRFRSwMhheHwJ+bwbMFltl/pxelPsIhUscJg886YF8az9/J74FXPjI= 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:BN4PR07MB2242;BCL:0;PCL:0;RULEID:;SRVR:BN4PR07MB2242; X-Microsoft-Exchange-Diagnostics: 1;BN4PR07MB2242;4:Xwpjulg2ZdLFFCA6kAYDrIY5NCdNqs7eMnzeXRwA1qRi3jh54JP7voOEWKdKVrMxUIwGVJxXN8Ks/6KnZw6onqHfympqGI+D7Z5He9PXKzq+77XfuT/kaRExABp1ON3/50JvMuo1gcGldq7XjLVu/eGRVgmMtwqa8YHFvZKOW2WCl78y8oYtb5XwL18FYK4ZwChR10lTKg4oBhBXGC275Jc6djuC4nBmBT06QiXzrvkSZ6Q9Gfri+VvZxOiasTQG6KK786pQhKVIsViRhvBPsYsAFAMOrV9wk/3wR+RD3gpwIezAYNrXUNkM6fxJkTwz/SfQmCvyzBehVZvclnujj6BGpryPCI9fsHd2QTEdlnRWASQn9CRuXbglNFSjg7hj X-Forefront-PRVS: 0987ACA2E2 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(36756003)(77096005)(2950100001)(92566002)(19580405001)(305945005)(19580395003)(8676002)(229853001)(7736002)(189998001)(6116002)(81156014)(33646002)(47776003)(81166006)(2906002)(7846002)(66066001)(4326007)(68736007)(76176999)(105586002)(5001770100001)(4001430100002)(97736004)(50226002)(76506005)(50466002)(50986999)(42186005)(101416001)(106356001)(5003940100001)(107886002)(48376002)(3846002)(586003)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN4PR07MB2242;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN4PR07MB2242;23:CZS+b+qs4HHQQiW/XdxSd4eqV25Usd1C2R0SK3oEZ?= =?us-ascii?Q?nVEWfELaRdV+KlRqtI+o10+EUnN6a+yBWRBG44Kaa4jY6AsIQiv6dy0u+YmU?= =?us-ascii?Q?EbE8U/fu1M4Y8UUyFcvsjf0JehMGN+qXseCBKWnu1tTCnWW4wVcBsSnS8K6o?= =?us-ascii?Q?GFu9O6HFdjoZbDHtsH8g5VJNn9M/PA5ByIIWSujAitwOPmBm8tIte/tKGcrH?= =?us-ascii?Q?6WjG9u4irD34/N/Khm5E1uu/0TOGyjNSXL4Af78cpWSJYkVqPgbPDBHcA7kL?= =?us-ascii?Q?S9XIBEFkAd8EQmVDLpJmQm8nSZ8XSQU+bJt1xYPuIqUkHb0hZfrnEqu2UVQF?= =?us-ascii?Q?Sui/M1rOppeyHM4dOu3zPMnSkL6pQVE2dNp/WCNimoto31wIYbqFJjmYsx3X?= =?us-ascii?Q?mIdo0oXfeBZBUNSFdXK2YHyo9dLGG7Ca0Bwu9nrq2vamiAS0V2AL8h0pdpuq?= =?us-ascii?Q?i/AkGE2q3AmQ7Ub501BSFR3RtAkqzAtW45IoIvrp+8exlhR7WifGJGosoOqr?= =?us-ascii?Q?TyVx1UuyONEtN8lIeMoJXQLcpdleTz38zvQWhoq73pzJJq9wIiPVE7jIToEz?= =?us-ascii?Q?bfV0r1utudQEYKJ3ZYo4do1KeGxJFpxGbpovOeSlIK8V38wpP+HlAUosD6ZW?= =?us-ascii?Q?pNlAzMzYHp+mliup9LJuz4/VMXv1vrNuMh3E3eRVBndh9/Z+frbofai5W53K?= =?us-ascii?Q?eJMBlUaR5i+6NS+ygHAMyXa0RS4GBZvBrqnjy2Jjj1cotTX2iMhrEMJqJnxM?= =?us-ascii?Q?Tx7rE7x8MgUMIUrA43zNrIWwFtdqu8mISUGCcFR9fJTinM/nYmwUYe/gsNL+?= =?us-ascii?Q?I0QOALB0DctaLCIYqk8FB+9+pZTEnBlt4Ykuasrc94sXhaLWdbJkX25BkVZT?= =?us-ascii?Q?h1W2Y7mqHYmDCeagjq4gM+qsqFUfulHoOgcMETqyisMq3azClCT0JQEYch8z?= =?us-ascii?Q?ZZC7VU/z+8gzvpSoxFwEmbHm5E5rOqbD4khKZxzsoJ2JcCIkotHWptIqp2EF?= =?us-ascii?Q?Vz/dtCeU9stMMDfcMea3ZWpNldqddIYXNqizz/pFMflwS0ljpxfSsMqh+0Yf?= =?us-ascii?Q?RcviT5MuLNZTHORS+b20Sr0xqbBtBtj35wMOHJjA+JQYZLN1oI/ECwk8mqXc?= =?us-ascii?Q?uQGnf3zrSejkSxU+b+WA5biQMAKrPtA?= X-Microsoft-Exchange-Diagnostics: 1;BN4PR07MB2242;6:jrdZ7aC/CbWukEK1wIGokxF+YdMen3OQKIgDxs0e0Rv5QbGLnas+cJGSzqb42lBZogUman9CFQlqbxGaiQSfTlSK6wTCXMKCH+0MQ8WPfhCkD0Vg04M92QbgCL/MTi/P/u0Dxs9oo2Jd9pokKqiE/ZRxD5wyIUHaxNHZHvB5O2LE8FdgQjaQ8VLEkqTVj4T4jeWmyNI+KZB0c6MQyeQnteObeh2ZIr7/FyKmeufmRx9vvf59VgCfa4Gc1k2Hgn461pSepjCkwNHTy3hd4xtgSl0VCb8HK6cCm3FzDTl/vpg=;5:sR5u5CEkOqGjumAnlC+tcUF5+kS+U1fZNZq6KVYSb7kTPcM7SS6aVMa7YxFT4TWBCEHBR64Sc9mVBF0AG3CiFdhtcU9Gm2TbkDoioDqG/lggMF4BqE4ATBcb1oUpt26iXcLui/G5Z1/x8h+NpV9GuQ==;24:65+fv2i/c8Qj3sxoLE+WLKb+/HRG4HwL1+kPy3ApLbZyj7ll7NdTlrDl9eWDBWsmi5FwyIBNKm+bFKCuZ8IfMr+DBeBp2R/KWYVJJPvROLg=;7:x6Gy2Y16QOv6Nwby9qYb3jKf5NuWbc+xZrqSxLP4jZMhSVXsoyF+xYzjY8vV+LlVUcsx2Ywy6H0rxlpmzqKEgvKtSTckzmZFuYN33idIxfSjSixSHt1Gu17CTmhvP/DX5ST/zWqypIc07gEKkAgBqxjhN/C44ozynG6i3hptMcU6J4FiSiBhxvBZS7ioXyNL578YHpf/jqUvNAvI8zPDplHhPDmRMG9iATB5tEtiPphj/OoNLcEEOlSa4bnTepEL SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2016 16:41:45.1286 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN4PR07MB2242 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrew Pinski This adds ILP32 support to elf_machine_load_address. Since elf_machine_load_address depends on the static address being found without relocations, we need to use 16bit relocation which gets resolved at link time for ILP32. This is just like how the 32bit relocation gets resolved at link time for LP64. * sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Add support for ILP32. Signed-off-by: Yury Norov --- sysdeps/aarch64/dl-machine.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index ec41bfe..29d54e2 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -54,19 +54,33 @@ elf_machine_load_address (void) 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. - This depends on 32bit relocations being resolved at link time - and that the static address fits in the 32bits. */ + This depends on 32/16bit relocations being resolved at link time + and that the static address fits in the 32/16 bits. */ ElfW(Addr) static_addr; ElfW(Addr) dynamic_addr; asm (" \n" " adrp %1, _dl_start; \n" +#ifdef __LP64__ " add %1, %1, #:lo12:_dl_start \n" +#else +" add %w1, %w1, #:lo12:_dl_start \n" +#endif " ldr %w0, 1f \n" " b 2f \n" "1: \n" +#ifdef __LP64__ " .word _dl_start \n" +#else +# ifdef __AARCH64EB__ +" .short 0 \n" +# endif +" .short _dl_start \n" +# ifndef __AARCH64EB__ +" .short 0 \n" +# endif +#endif "2: \n" : "=r" (static_addr), "=r" (dynamic_addr)); return dynamic_addr - static_addr; -- 2.7.4