From patchwork Thu Jan 16 10:28:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 23260 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f72.google.com (mail-pb0-f72.google.com [209.85.160.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C7B84202E2 for ; Thu, 16 Jan 2014 10:30:19 +0000 (UTC) Received: by mail-pb0-f72.google.com with SMTP id up15sf4111854pbc.11 for ; Thu, 16 Jan 2014 02:30:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:subject:date :message-id:x-original-sender:x-original-authentication-results; bh=T+V8unTVD2TjSYDdSqEPU0TK3U1MENPi2SakcMFclxk=; b=MVJOg6hAeemnydA/6dkQhIrgnhz/8befWU0l5VYXZH37gZnS+7lZbazNdXa/WPK/Tb VsnOkSEKP8LpF56jDcf21JRivC10ykghw2MXS+a/LUKRFqkRKddiYVadJJ6FnSa1pNFn gdrPmYuJ5ZloIlaCeaM//yIBL6epJQsI5QQ76J00xIXj6P+nPHmLU5gy7ZliMdPPowfO SEwqIPnGoqrLwANY7HYajWyvvqJwBE81EICNYIr4aMdJBoptFJzYacbeyTr1v8O/6Qvn XApYD1wcKjX2O4kQJ2Mygden4zEQc8HPQUoneoHiJ1g1VacpMM+UIYa7k409/QTVFKGU ky8Q== X-Gm-Message-State: ALoCoQkS3aH6D71ZuwNY7uPYrjFSmeINdtt5OSSZG4NAb5bCaWmKIP2SOg0S8TYdnlMoO7YIHpAs X-Received: by 10.67.3.34 with SMTP id bt2mr2812056pad.41.1389868218950; Thu, 16 Jan 2014 02:30:18 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.100.173 with SMTP id s42ls146150qge.8.gmail; Thu, 16 Jan 2014 02:30:18 -0800 (PST) X-Received: by 10.140.39.208 with SMTP id v74mr6632209qgv.81.1389868218849; Thu, 16 Jan 2014 02:30:18 -0800 (PST) Received: from mail-vb0-x22a.google.com (mail-vb0-x22a.google.com [2607:f8b0:400c:c02::22a]) by mx.google.com with ESMTPS id f1si9248708qej.88.2014.01.16.02.30.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 Jan 2014 02:30:18 -0800 (PST) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22a; Received: by mail-vb0-f42.google.com with SMTP id i3so468440vbh.15 for ; Thu, 16 Jan 2014 02:30:18 -0800 (PST) X-Received: by 10.220.159.4 with SMTP id h4mr6059978vcx.1.1389868218572; Thu, 16 Jan 2014 02:30:18 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp336508ved; Thu, 16 Jan 2014 02:30:18 -0800 (PST) X-Received: by 10.68.143.196 with SMTP id sg4mr8905799pbb.155.1389868217719; Thu, 16 Jan 2014 02:30:17 -0800 (PST) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id im1si6605205pbb.335.2014.01.16.02.30.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jan 2014 02:30:17 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-return-82587-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 18002 invoked by alias); 16 Jan 2014 10:30:02 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Subscribe: List-Archive: List-Post: , List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 17961 invoked by uid 89); 16 Jan 2014 10:30:01 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f47.google.com Received: from mail-wg0-f47.google.com (HELO mail-wg0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 16 Jan 2014 10:30:00 +0000 Received: by mail-wg0-f47.google.com with SMTP id m15so2903341wgh.2 for ; Thu, 16 Jan 2014 02:29:57 -0800 (PST) X-Received: by 10.180.13.139 with SMTP id h11mr7254143wic.3.1389868196557; Thu, 16 Jan 2014 02:29:56 -0800 (PST) Received: from localhost.localdomain ([82.1.113.198]) by mx.google.com with ESMTPSA id gd5sm32847391wic.0.2014.01.16.02.29.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jan 2014 02:29:55 -0800 (PST) From: Will Newton To: binutils@sourceware.org Subject: [RFC PATCH] bfd/elf32-arm.c: Set st_value to zero for undefined symbols. Date: Thu, 16 Jan 2014 10:28:45 +0000 Message-Id: <1389868125-7349-1-git-send-email-will.newton@linaro.org> X-IsSubscribed: yes X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22a 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; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 I'm not sure what the implications of this patch are, so I thought I would post it here in the hope that someone can explain what might break. The issue comes from a report that Qt does not work correctly on ARM when built with -Bsymbolic: http://lists.linaro.org/pipermail/linaro-toolchain/2014-January/003942.html Unless point_equality_needed is set then set st_value to be zero for undefined symbols. bfd/ChangeLog: 2014-01-10 Will Newton * elf32-arm.c (elf32_arm_check_relocs): Set pointer_equality_needed for absolute references within executable links. (elf32_arm_finish_dynamic_symbol): Set st_value to zero unless pointer_equality_needed is set. ld/testsuite/ChangeLog: 2014-01-10 Will Newton * ld-arm/ifunc-14.rd: Update symbol values. --- bfd/elf32-arm.c | 7 ++++++- ld/testsuite/ld-arm/ifunc-14.rd | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 7216244..a999b64 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -12681,6 +12681,11 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, /* Fall through. */ case R_ARM_ABS32: case R_ARM_ABS32_NOI: + if (h != NULL && info->executable) + { + h->pointer_equality_needed = 1; + } + /* Fall through. */ case R_ARM_REL32: case R_ARM_REL32_NOI: case R_ARM_MOVW_PREL_NC: @@ -14046,7 +14051,7 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, Otherwise, the PLT entry would provide a definition for the symbol even if the symbol wasn't defined anywhere, and so the symbol would never be NULL. */ - if (!h->ref_regular_nonweak) + if (!h->ref_regular_nonweak || !h->pointer_equality_needed) sym->st_value = 0; } else if (eh->is_iplt && eh->plt.noncall_refcount != 0) diff --git a/ld/testsuite/ld-arm/ifunc-14.rd b/ld/testsuite/ld-arm/ifunc-14.rd index 59ea29b..9c44092 100644 --- a/ld/testsuite/ld-arm/ifunc-14.rd +++ b/ld/testsuite/ld-arm/ifunc-14.rd @@ -8,5 +8,5 @@ Relocation section '\.rel\.dyn' at offset 0x8000 contains 4 entries: Relocation section '\.rel\.plt' at offset 0x8020 contains 2 entries: Offset Info Type Sym\.Value Sym\. Name -0001100c ......16 R_ARM_JUMP_SLOT 00009014 f2t -00011010 ......16 R_ARM_JUMP_SLOT 00009020 f2 +0001100c ......16 R_ARM_JUMP_SLOT 00000000 f2t +00011010 ......16 R_ARM_JUMP_SLOT 00000000 f2