From patchwork Tue May 14 06:11:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 243612 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 3DA262C009D for ; Tue, 14 May 2013 16:11:51 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=fu9EklZEDBLIZJWlU 0jDvfdp2Ap/WzbueSGgS9tR416NqJljL5T1Inp4KC+NRIeTvlxQyq/sXhHxstIdw 3c46E+8eGcPPa1XtbZm4Xi07dIDLzwjMmcjS27SPbHa/4wv1pL1J9YVcfIPMn3hC 6e0cEtSo6S+kXq6tY6+CfBvyss= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=RksJN3iGPAUuFN4IwP+NXkf DRz0=; b=IyMwW425v7qVpcl2SwhrhJnRGk0T97HXDaXtFlvm3gkuIOUtbbE1goW 2Ehhcf5BA5OohvL4Tedm6/Ey7CREsP07b+xRd3VS58IYbTP9Q7taw97adONG9KYs MZ1TGNdA1LDeNcMDfIBWfnLFpJE24X7efwygRI13QIFecgTEpo4w= Received: (qmail 26245 invoked by alias); 14 May 2013 06:11:45 -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 26232 invoked by uid 89); 14 May 2013 06:11:44 -0000 X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_STOCKGEN, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=no version=3.3.1 Received: from mail-wi0-f171.google.com (HELO mail-wi0-f171.google.com) (209.85.212.171) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 14 May 2013 06:11:44 +0000 Received: by mail-wi0-f171.google.com with SMTP id hq7so1886285wib.4 for ; Mon, 13 May 2013 23:11:42 -0700 (PDT) X-Received: by 10.180.37.109 with SMTP id x13mr2912311wij.20.1368511901432; Mon, 13 May 2013 23:11:41 -0700 (PDT) Received: from [192.168.44.100] ([90.204.76.101]) by mx.google.com with ESMTPSA id fu14sm17134346wic.8.2013.05.13.23.11.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 13 May 2013 23:11:40 -0700 (PDT) Message-ID: <5191D598.6080305@acm.org> Date: Tue, 14 May 2013 07:11:36 +0100 From: Nathan Sidwell User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: Jan Hubicka CC: GCC Patches Subject: Re: section anchors and weak hidden symbols References: <518A3D8E.5020800@acm.org> <20130508131118.GA23785@atrey.karlin.mff.cuni.cz> <518A56B7.6060902@acm.org> <20130508174751.GD2415@kam.mff.cuni.cz> <518B3C11.7070103@acm.org> <5190B55C.7060303@acm.org> <20130513130946.GA8726@kam.mff.cuni.cz> In-Reply-To: <20130513130946.GA8726@kam.mff.cuni.cz> X-Virus-Found: No On 05/13/13 14:09, Jan Hubicka wrote: >> Index: varasm.c >> =================================================================== > I think DECL_COMDAT is not what you really want to return true for. So perhaps > you really want (TREE_PUBLIC (decl) && decl_binds_to_current_def_p)? Like this? This too fixes the problem, tested on powerpc-linux target. nathan 2013-05-14 Nathan Sidwell gcc/ * varasm.c (default_use_anchors_for_symbol_p): Use decl_replaceable_p. gcc/testsuite/ * gcc.dg/visibility-21.c: New. Index: varasm.c =================================================================== --- varasm.c (revision 198771) +++ varasm.c (working copy) @@ -6580,9 +6580,9 @@ default_use_anchors_for_symbol_p (const_ decl = SYMBOL_REF_DECL (symbol); if (decl && DECL_P (decl)) { - /* Don't use section anchors for decls that might be defined by - other modules. */ - if (!targetm.binds_local_p (decl)) + /* Don't use section anchors for decls that might be defined or + usurped by other modules. */ + if (TREE_PUBLIC (decl) && !decl_binds_to_current_def_p (decl)) return false; /* Don't use section anchors for decls that will be placed in a Index: testsuite/gcc.dg/visibility-21.c =================================================================== --- testsuite/gcc.dg/visibility-21.c (revision 0) +++ testsuite/gcc.dg/visibility-21.c (revision 0) @@ -0,0 +1,13 @@ +/* Test visibility attribute on function definition. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fsection-anchors" } */ +/* { dg-require-visibility "" } */ +/* { dg-require-weak "" } */ +/* { dg-final { scan-assembler-not "ANCHOR" } } */ + +int __attribute__((weak, visibility("hidden"))) weak_hidden[3]; + +int *f_weak_hidden () +{ + return weak_hidden; +}