From patchwork Tue Jun 21 05:06:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 70515 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1832054qgy; Mon, 20 Jun 2016 22:14:06 -0700 (PDT) X-Received: by 10.36.253.3 with SMTP id m3mr2410085ith.52.1466486046850; Mon, 20 Jun 2016 22:14:06 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id jh2si15157965pac.149.2016.06.20.22.14.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 22:14:06 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-70822-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-70822-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-70822-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=B3EEp r6xJNO6v+kaCFpllkn7JiiQSnoA7NJ+hmfBAci/LvVAXddTZ6dMLpV70WnRZVlfw 1GZCqqWDG/nc8BeSACcZJPLUOSPJTV8OZdh2BthvDx5MXfLay6tYfL4QAuE+1bmW N/SKor0rbYIMxx2k7ll/g8tV744TTK2/Qw6WuY= 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=lKYdI2BYJ9t 3BVezs5t7eskIYu0=; b=V1HlN0sMJ4w+JRxMnFCKOeSaibp4l/mV54MdOX5IHPn 3od/t7wUohYx+Q0nHZ6LBfh0wvk0laABbZ0L/rUEH8yfaT8B7pkmPcmgWEzUAg+2 9vV7eCPK3j/ZSXVH8OhXgbAd8+472anK18G/1zaRKc0v8NGGGQj8yo35tAg9WHic = Received: (qmail 21279 invoked by alias); 21 Jun 2016 05:13:31 -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 19769 invoked by uid 89); 21 Jun 2016 05:13:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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 12/27] [AARCH64] Add ILP32 support to elf_machine_load_address. Date: Tue, 21 Jun 2016 08:06:56 +0300 Message-ID: <1466485631-3532-14-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: HE1PR03CA0024.eurprd03.prod.outlook.com (10.163.170.162) To SN1PR07MB2256.namprd07.prod.outlook.com (10.164.47.150) X-MS-Office365-Filtering-Correlation-Id: a43de0ad-3213-4618-fbd8-08d399924dd1 X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2256; 2:gsyHpFGSE+xwTtqGYPNS2gXGsCc2qgS1CCqb+t4YjfEprYpm2tk4VVx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yMUjWt8NZVIHdg23ydpOJX6H+jKDA/KQljgPSwsBFiEDaTQfeq7LYnZY8U6DDV6K/BVFyQ+krFqZoH+1i7VX0QYicTtZutf5JTHSIHBOnQ21pN57WbGn+3v4dzVa3LClH0Y6VHxQjss7OyI/Zse4mmxdmZgaL0cyDikqnF0IQFpgabjwzrxoTAu+ZuqvmmnTdstMWKmrr4MBGMlNh6/bx6YcQHWfvTnZ3A1aRxXHTpuklkFnr7wa0exVc9VztNsR+WZ6uv9BtrU5Xfo7KDy43XUEuj/Y0ivz5oSQM3GfaS+8yfNyrFI5yyi6eyFcxbINml/Ztc1PWgc7l8qm/AOpU= 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)(10201501046)(3002001); SRVR:SN1PR07MB2256; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2256; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2256; 4:nuQlAA7lHHER+vIFCMRIB4klHZxDg0jShgxmljtRKjGSVY0yLUb7veixL+onMXrMUQCejsecNkVPlxduRC9NvioQLzV5R0keRhsq1q0qzm1CWXKw/lf6lBNx0VZvAbEnkiSR4Qphb1GH+l/4nqsJWxuVXhtwNhtz4oYPXHCxC4LFfav7Z7muIaVzFmxMoKzvFiBSXwURWSV5US24NbmhVZSY4bXUSX6syVAIXXqMABE6n69+h8JPnH4EuheGLbCy9OePZX3GzmBRo24nVW5rVDuO5Xj3Oquey8Wugs3s8sAy2pBrNuAjrQk4OL3dYhq2JdeEpPvTSEzP1LynvKr8q67HIs89UGXZvGP0TlyMjwdxiQdwO7yZ5awzExNtZFft X-Forefront-PRVS: 098076C36C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(3846002)(2950100001)(107886002)(6116002)(97736004)(5001770100001)(36756003)(586003)(47776003)(2906002)(77096005)(76176999)(4326007)(50986999)(50226002)(5003940100001)(66066001)(42186005)(575784001)(68736007)(92566002)(7736002)(189998001)(4001430100002)(81156014)(81166006)(105586002)(7846002)(8676002)(229853001)(33646002)(101416001)(76506005)(19580395003)(48376002)(50466002)(19580405001)(106356001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2256; 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; SN1PR07MB2256; 23:SfW03dtEEvyLbR751hwGGWo0N+y7W0WBcUglNwi+g?= =?us-ascii?Q?PKqaRWcUghOYf7cSYXhHz0bjV/VWlfw7WsPqu3DDcJQAphuJiWvuY7EBHOKr?= =?us-ascii?Q?oCTKQZ0oggRawtBlIu/WidE0cYljjazgrXtJIBuCr2m/2/I8suf6Ko5IXlzg?= =?us-ascii?Q?SroCXi2M1g+XiOy6RpsBgnVzYDBfh/4Y6g57bVwA8FMIxF7VDBHtJASz/EM0?= =?us-ascii?Q?scgvpPHb5BXIhKCgTekNDKDDOjFigQ4i/Ueo1mG9mCNTd/iXhxx5IrJct3YK?= =?us-ascii?Q?zW4nZSFWdDfu4Ie/WTooV6yzfWMDyDyQ4zlXkmvCd9yse8oSaLyr/iR40Gcz?= =?us-ascii?Q?+x8xg3S4WyWLMDUuN8I0x9scaYx29EjdN0LNk5prVjvSJaFrqIo2mLJkNX+f?= =?us-ascii?Q?bs4znCoKXJC0FybnvidbTecnIJe6Jrjm6zokSc+z2RyY0nyYtrBcBBSgIdzk?= =?us-ascii?Q?dKJfSJzIvDnLJwQOAV1rcBaimA7bdyb3mfIG1rIbLPEN1DZpfx3aTgM8JKi/?= =?us-ascii?Q?EgQK+0ML6oLW6vdnr4Lguu0BlzGXNX2oNqmNvZHf6wq416XQB9XSdBpS1J3V?= =?us-ascii?Q?o6E1JPrP9QDXyuxaiHClJ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FnWbfdQ3yKdj0gJftYCEovJtswaogWumN3ydFDFCrrAcknGrRQL6UgsyiUsj1+tsq2T6FuB49riteRfWl/mdjYiKNw==; 24:MJ+3gYaGQoH0UnrTY9oa2ILwPAjOP3JAnqPC3ZvTSgWNu/SYqTZolMfbjjQ5b6FLta3ZMOf36r0+7kP8+kWLA0CqBzj4z9aGXodde8L6kCs=; 7:qkjOjxCG2T0FPLku5UK2hYgqEohUEMOdQlN2ztKKZXDBkcvlNL3TmrKEJnYwsntxciP8SGWHRtzDRFg4Oh+sdOmczwnZdf9JLmcPwV1cFLkD9ThfVfzXFeuAmynMOXViBg7+1OO3jJgyWNg5ncJsFTV+Uzki5RWcBJq9qEBF1xF/oqzVQ8032e+y1gCCaAZnvMIJZHDKpWV/ElN0/Za7tSDIBDwfDCuhFPqLIid6ie5kEAivffVGOHCY2LimW6jF SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2016 05:10:03.4520 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2256 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(-) -- 2.7.4 diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index 7a49852..771b0c6 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;