From patchwork Fri Jun 17 12:03:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramana Radhakrishnan X-Patchwork-Id: 2027 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D48A123E51 for ; Fri, 17 Jun 2011 12:03:58 +0000 (UTC) Received: from mail-vx0-f180.google.com (mail-vx0-f180.google.com [209.85.220.180]) by fiordland.canonical.com (Postfix) with ESMTP id 9D43CA180A5 for ; Fri, 17 Jun 2011 12:03:58 +0000 (UTC) Received: by vxd7 with SMTP id 7so277080vxd.11 for ; Fri, 17 Jun 2011 05:03:58 -0700 (PDT) Received: by 10.52.100.72 with SMTP id ew8mr2889172vdb.247.1308312237987; Fri, 17 Jun 2011 05:03:57 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.52.183.130 with SMTP id em2cs244610vdc; Fri, 17 Jun 2011 05:03:57 -0700 (PDT) Received: by 10.224.104.80 with SMTP id n16mr1598021qao.361.1308312237170; Fri, 17 Jun 2011 05:03:57 -0700 (PDT) Received: from mail-qw0-f50.google.com (mail-qw0-f50.google.com [209.85.216.50]) by mx.google.com with ESMTPS id 13si3551877qcc.75.2011.06.17.05.03.57 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 17 Jun 2011 05:03:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.216.50 is neither permitted nor denied by best guess record for domain of ramana.radhakrishnan@linaro.org) client-ip=209.85.216.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.216.50 is neither permitted nor denied by best guess record for domain of ramana.radhakrishnan@linaro.org) smtp.mail=ramana.radhakrishnan@linaro.org Received: by qwe5 with SMTP id 5so519819qwe.37 for ; Fri, 17 Jun 2011 05:03:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.190.132 with SMTP id di4mr1584572qab.265.1308312236633; Fri, 17 Jun 2011 05:03:56 -0700 (PDT) Received: by 10.224.45.69 with HTTP; Fri, 17 Jun 2011 05:03:56 -0700 (PDT) Date: Fri, 17 Jun 2011 13:03:56 +0100 Message-ID: Subject: [Patch ARM] Allow R_ARM_TLS_LE32 in PIE Executables. From: Ramana Radhakrishnan To: binutils@sourceware.org Cc: Patch Tracking Hi, With a recent change to the GCC testsuite to run tls tests with PIE I see a few failures when things like run-le.c are built PIE, with an error message that shared-objects shouldn't contain a LOCAL_EXEC relocation. (I needed a modified gcc-testglue.o built with -fPIC to be able to build these tests in this form and see these errors. ) Well, if you are creating a PIE executable the static block for the TLS still exists and the distance between the thread pointer and the actual thread variable is the same. Thus it shouldn't matter that you have a R_ARM_TLS_LE32 in a PIE executable being created. Testing the simple case (torture/tls/run-le.c) with LOCALEXEC in the testsuite now allows this to pass. I tried runing a cross test with eglibc and that didn't appear to show any regressions. I was able to torture on tls.exp if I built gcc-testglue.c -fPIC and made this change in the linker. Ok to commit ? Tested in a cross-configuration with arm-linux-gnueabi with no regressions. cheers Ramana 2011-06-16 Ramana Radhakrishnan * elf32-arm.c (elf32_arm_final_link_relocate): Allow R_ARM_TLS_LE32 for PIE. --- bfd/elf32-arm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) (_("%B(%A+0x%lx): R_ARM_TLS_LE32 relocation not permitted in shared object"), diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index b0f315b..257f7a5 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -9454,7 +9454,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, } case R_ARM_TLS_LE32: - if (info->shared) + if (info->shared && !info->pie) { (*_bfd_error_handler)