From patchwork Mon May 13 09:41:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 243343 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 18B4C2C009F for ; Mon, 13 May 2013 19:42:03 +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=qAXBHwoA7Tb228/3q 4BFkI5cHxrSvFE4zz5Bg0CHtjAT1V1gsToO82hNlU9nSbdEYqFT9lh1m5Hryfk/Q IDabMHyaEHnRGFrskiQzKcu0pJYiGAZZOAVfK2kKCk7SCy3I1AEjz/SPN4yv5jQD 3kekH4BTHiajaupuw71lxZRV2U= 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=sy57hKVpHANwARWtrMiLXs5 MV/g=; b=VS+4Pf20fhHMV9ImfyNmuoRujibJ9nPubAfZYqs5nkTvUndOGrwNidp duB9DZR3K81JgzFvwF02+3+e2MgIHWAIhatMcUJsgaiIjAgfZWK9YB00GfFuW03e Fv/XySYWSd+XYuIjTz5mfUWWR6eQtcQYnio/63cGfoXYP0mFQYrU= Received: (qmail 27176 invoked by alias); 13 May 2013 09:41:58 -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 27157 invoked by uid 89); 13 May 2013 09:41:56 -0000 X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-bk0-f46.google.com (HELO mail-bk0-f46.google.com) (209.85.214.46) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 13 May 2013 09:41:54 +0000 Received: by mail-bk0-f46.google.com with SMTP id my1so123313bkb.33 for ; Mon, 13 May 2013 02:41:52 -0700 (PDT) X-Received: by 10.205.76.129 with SMTP id ze1mr5422052bkb.12.1368438112597; Mon, 13 May 2013 02:41:52 -0700 (PDT) Received: from [192.168.44.100] ([90.204.76.101]) by mx.google.com with ESMTPSA id 2sm1819092bki.19.2013.05.13.02.41.50 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 13 May 2013 02:41:51 -0700 (PDT) Message-ID: <5190B55C.7060303@acm.org> Date: Mon, 13 May 2013 10:41:48 +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> In-Reply-To: <518B3C11.7070103@acm.org> X-Virus-Found: No On 05/09/13 07:02, Nathan Sidwell wrote: > On 05/08/13 18:47, Jan Hubicka wrote: >> Thinking about it again, isn't decl_replaceable_p the thing you are looking for >> here? > > that looks promising. I'll try !decl_replaceable_p in the section anchor hook. It does indeed seem to be the right predicate. tested with a ppc-linux target, ok? nathan 2013-05-13 Nathan Sidwell gcc/ * varasm.c (default_use_anchors_for_symbol_p): Use decl_replaceable_p. gcc/testsuite/ * gcc.dg/visibility-21.c: New. +int __attribute__((weak, visibility("hidden"))) weak_hidden[3]; + +int *f_weak_hidden () +{ + return weak_hidden; +} Index: varasm.c =================================================================== --- varasm.c (revision 198771) +++ varasm.c (working copy) @@ -6582,10 +6582,18 @@ default_use_anchors_for_symbol_p (const_ { /* Don't use section anchors for decls that might be defined by other modules. */ - if (!targetm.binds_local_p (decl)) + if (decl_replaceable_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" } } */ +