From patchwork Fri Dec 20 08:32:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 22668 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C0A1023FC4 for ; Fri, 20 Dec 2013 08:32:31 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id lx4sf8982164iec.10 for ; Fri, 20 Dec 2013 00:32:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=P9mNVM+5A92hTiOn0SeoJ+ya1xtv59xWvpXdKDxRd0s=; b=Ku7sskJ70OW1Kf6RiF/Esla/7bKC+pc6O6tsIDRveYjBfJnTgFasFdCwWu9EMbhT+V Y0GLiuYs7hg077ggRweyG3Ei3oiRhdCMjaaykAVUXXZysuANSteNkB+Fyr/qge6ZnLPw xyHz8zGH7vUGTgmjoqNVAL+mB64q8s4UYkIVfKkCFu3aaw22pK3nycquL2Ex8B8fVFT/ K5lhaBJ9YltLy5JB+U5hwHd48BztZnfnN4VXahwxRJesk1XzKuV3uH044diuI5V7zgYL 8ByYQ/UjGe8o/wGsRUBzfKbO9V3uuaF9iEKTFCZX38d2NAq/tBWG5E4LOtnnKVgqap5b iRjw== X-Gm-Message-State: ALoCoQkv6M8SEwCxBrv9ac0IleIAvZ6tqh9h1/MqH3SRfEo3wSqGFzS4kzV1tMYj9LZK9E2x4BIO X-Received: by 10.182.223.18 with SMTP id qq18mr2735528obc.33.1387528350343; Fri, 20 Dec 2013 00:32:30 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.131.162 with SMTP id on2ls637217qeb.73.gmail; Fri, 20 Dec 2013 00:32:30 -0800 (PST) X-Received: by 10.220.95.139 with SMTP id d11mr604846vcn.21.1387528350260; Fri, 20 Dec 2013 00:32:30 -0800 (PST) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id a6si1336092vdp.39.2013.12.20.00.32.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Dec 2013 00:32:30 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.46; Received: by mail-vb0-f46.google.com with SMTP id w20so1280863vbb.33 for ; Fri, 20 Dec 2013 00:32:30 -0800 (PST) X-Received: by 10.220.199.5 with SMTP id eq5mr4292253vcb.16.1387528350157; Fri, 20 Dec 2013 00:32:30 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp43785ved; Fri, 20 Dec 2013 00:32:28 -0800 (PST) X-Received: by 10.67.14.231 with SMTP id fj7mr6839806pad.115.1387528348226; Fri, 20 Dec 2013 00:32:28 -0800 (PST) Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by mx.google.com with ESMTPS id qh6si4631536pbb.184.2013.12.20.00.32.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Dec 2013 00:32:28 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.179 is neither permitted nor denied by best guess record for domain of kugan.vivekanandarajah@linaro.org) client-ip=209.85.192.179; Received: by mail-pd0-f179.google.com with SMTP id r10so2256836pdi.38 for ; Fri, 20 Dec 2013 00:32:27 -0800 (PST) X-Received: by 10.68.189.34 with SMTP id gf2mr6960083pbc.91.1387528347705; Fri, 20 Dec 2013 00:32:27 -0800 (PST) Received: from [192.168.0.100] ([120.158.19.173]) by mx.google.com with ESMTPSA id qv8sm12572147pbc.31.2013.12.20.00.32.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Dec 2013 00:32:26 -0800 (PST) Message-ID: <52B4008F.1000403@linaro.org> Date: Fri, 20 Dec 2013 19:32:15 +1100 From: Kugan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: binutils@sourceware.org CC: Marcus Shawcroft , Michael Hudson-Doyle , "patches@linaro.org" Subject: [ Bug 16340][AARCH64][PATCH] Offset into GOT for TLS relocation computed inconsistently References: <52B29EF7.7040209@linaro.org> In-Reply-To: <52B29EF7.7040209@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: kugan.vivekanandarajah@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , [Apologies if you get this twice; Noticed a typo with email address] Hi, mongodb for aarch64 segfaults due to an error in applying GOT for TLS relocation. Michael Hudson-Doyle tracked this down to wrong usage of offset for the relocation. Attached patch (by Michael Hudson-Doyle) fixes this. Regression tested on aarch64-none-linux-gnu with no new regressions. Is this OK for trunk and backport for 2.24? Thanks, Kugan bfd/ +2013-12-19 Michael Hudson-Doyle + + * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use correct + offset for GOT in TLS while calculating relocation address. + diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 8f0e716..e1ab769 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -3831,7 +3831,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, value = (symbol_got_offset (input_bfd, h, r_symndx) + globals->root.sgot->output_section->vma - + globals->root.sgot->output_section->output_offset); + + globals->root.sgot->output_offset); value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value, 0, weak_undef_p); @@ -3863,7 +3863,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, value = (symbol_tlsdesc_got_offset (input_bfd, h, r_symndx) + globals->root.sgotplt->output_section->vma - + globals->root.sgotplt->output_section->output_offset + + globals->root.sgotplt->output_offset + globals->sgotplt_jump_table_size); value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value,