From patchwork Wed Nov 9 21:29:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 81572 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp414295qge; Wed, 9 Nov 2016 13:30:01 -0800 (PST) X-Received: by 10.98.8.84 with SMTP id c81mr3008783pfd.114.1478727001214; Wed, 09 Nov 2016 13:30:01 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id t188si1289509pfb.122.2016.11.09.13.30.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Nov 2016 13:30:01 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-440899-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-440899-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-440899-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=cV0lgKlaWKrirWT3cNE60AGz0yxej4qkohQPNFRPiOutF1 MCHb+O+XAhCU226ourI/HzL5XzPZo3pr/GvOvzvexSoO3HG2o9K+aqRPMqvfFwx0 ML3YTswO73MwW7w2/joXs3TgPDxz2gIY5wkwcaNr2r6E8xgPTLcnVTDyE9+NM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=UlH8nVX92lXMMmC77YuANTQllpk=; b=UkhgrjBKyt7g4MePnd6T VM/T3RrOf4Dul0wgFNehMZozhQx/DHqBb4v71vQ8FvYOK05pXqzlvVKzlhfC2kQi A8Csbo/9m6FH/xvKpmFwrbbc/55fboOpcVwv/hqhaU92mOD12BzmEzaNrgJPqsmD +z7EA3oplA88Egb/myzgGaU= Received: (qmail 88420 invoked by alias); 9 Nov 2016 21:29:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 88402 invoked by uid 89); 9 Nov 2016 21:29:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=christophelyonlinaroorg, christophe.lyon@linaro.org, gained, corner X-HELO: mail-qk0-f173.google.com Received: from mail-qk0-f173.google.com (HELO mail-qk0-f173.google.com) (209.85.220.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Nov 2016 21:29:39 +0000 Received: by mail-qk0-f173.google.com with SMTP id q130so273101060qke.1 for ; Wed, 09 Nov 2016 13:29:39 -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:from:date:message-id:subject:to; bh=oOUCkUMMwVQ1nE3/JKeo6Ju59Yt5QBZwlAa2deQu1Ck=; b=EbrmxYUZ1CsGbnd2InA7nedLMT5UN/UxfL7pktokMvLB0KFfX3eyQi9oswo6mlr7rC YBcUsaWQTRkCq1SbSMQ0hyrvuW2kjwodmtN3+NJCyVx9C6pEYgBg2A1JooByqpTdSYwV N6teOFk7ogyDmFxzzfqoAx3Nh2H5gVMUnWVXXwbF3max7uBpm6xvyHXnHZmVkmvVDwIb uaY4SeCglJznoz8xDGiXCAbszgz3xZ7Y5C5ZgLj9nWhslqROWVFlyCOJOTdgMSv8kBa3 Vj7ULIBJ/Ut3VvUFu9YExcgsl+eRXh07KUBKNL8daRT+EbOOAKRurHGNXt5aykow22SS gosQ== X-Gm-Message-State: ABUngvdPlM3nU/7++YBlnqCCArIVhm6Tyel0/RuKrBDRnoG3qdFLTI2S4dLWe5t2yt8AqMnW6hoz5laElSfKWfC0 X-Received: by 10.55.79.86 with SMTP id d83mr1986958qkb.24.1478726977459; Wed, 09 Nov 2016 13:29:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.28.226 with HTTP; Wed, 9 Nov 2016 13:29:36 -0800 (PST) From: Christophe Lyon Date: Wed, 9 Nov 2016 22:29:36 +0100 Message-ID: Subject: [ARM] PR 78253 do not resolve weak ref locally To: "gcc-patches@gcc.gnu.org" X-IsSubscribed: yes Hi, PR 78253 shows that the handling of weak references has changed for ARM with gcc-5. When r220674 was committed, default_binds_local_p_2 gained a new parameter (weak_dominate), which, when true, implies that a reference to a weak symbol defined locally will be resolved locally, even though it could be overridden by a strong definition in another object file. With r220674, default_binds_local_p forces weak_dominate=true, effectively changing the previous behavior. The attached patch introduces default_binds_local_p_4 which is a copy of default_binds_local_p_2, but using weak_dominate=false, and updates the ARM target to call default_binds_local_p_4 instead of default_binds_local_p_2. I ran cross-tests on various arm* configurations with no regression, and checked that the test attached to the original bugzilla now works as expected. I am not sure why weak_dominate defaults to true, and I couldn't really understand why by reading the threads related to r220674 and following updates to default_binds_local_p_* which all deal with other corner cases and do not discuss the weak_dominate parameter. Or should this patch be made more generic? Thanks, Christophe 2016-11-09 Christophe Lyon PR target/78253 * output.h (default_binds_local_p_4): New. * varasm.c (default_binds_local_p_4): New, use weak_dominate=false. * config/arm/linux-elf.h (TARGET_BINDS_LOCAL_P): Define to default_binds_local_p_4. diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h index cc17b51..4f32ce8 100644 --- a/gcc/config/arm/linux-elf.h +++ b/gcc/config/arm/linux-elf.h @@ -110,7 +110,7 @@ strong definitions in dependent shared libraries, will resolve to COPY relocated symbol in the executable. See PR65780. */ #undef TARGET_BINDS_LOCAL_P -#define TARGET_BINDS_LOCAL_P default_binds_local_p_2 +#define TARGET_BINDS_LOCAL_P default_binds_local_p_4 /* Define this to be nonzero if static stack checking is supported. */ #define STACK_CHECK_STATIC_BUILTIN 1 diff --git a/gcc/output.h b/gcc/output.h index 0924499..11b5ce5 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -585,6 +585,7 @@ extern bool default_binds_local_p (const_tree); extern bool default_binds_local_p_1 (const_tree, int); extern bool default_binds_local_p_2 (const_tree); extern bool default_binds_local_p_3 (const_tree, bool, bool, bool, bool); +extern bool default_binds_local_p_4 (const_tree); extern void default_globalize_label (FILE *, const char *); extern void default_globalize_decl_name (FILE *, tree); extern void default_emit_unwind_label (FILE *, tree, int, int); diff --git a/gcc/varasm.c b/gcc/varasm.c index 6a7ffc2..7a3cf99 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -6952,6 +6952,16 @@ default_binds_local_p_2 (const_tree exp) !flag_pic); } +/* Similar to default_binds_local_p_2, but local weak definition does + not imply local resolution (weak_dominate is false). */ + +bool +default_binds_local_p_4 (const_tree exp) +{ + return default_binds_local_p_3 (exp, flag_shlib != 0, false, true, + !flag_pic); +} + bool default_binds_local_p_1 (const_tree exp, int shlib) {