From patchwork Mon Nov 14 21:59:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 125618 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]) by ozlabs.org (Postfix) with SMTP id 6A53FB71C5 for ; Tue, 15 Nov 2011 08:59:52 +1100 (EST) Received: (qmail 11125 invoked by alias); 14 Nov 2011 21:59:45 -0000 Received: (qmail 11114 invoked by uid 22791); 14 Nov 2011 21:59:43 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Nov 2011 21:59:30 +0000 Received: by wwe6 with SMTP id 6so5368427wwe.8 for ; Mon, 14 Nov 2011 13:59:28 -0800 (PST) Received: by 10.227.202.70 with SMTP id fd6mr16199901wbb.27.1321307968762; Mon, 14 Nov 2011 13:59:28 -0800 (PST) Received: by 10.227.202.70 with SMTP id fd6mr16199890wbb.27.1321307968618; Mon, 14 Nov 2011 13:59:28 -0800 (PST) Received: from [192.168.44.105] (5ac3c889.bb.sky.com. [90.195.200.137]) by mx.google.com with ESMTPS id ep16sm21801472wbb.21.2011.11.14.13.59.27 (version=SSLv3 cipher=OTHER); Mon, 14 Nov 2011 13:59:28 -0800 (PST) Message-ID: <4EC18F3D.60400@acm.org> Date: Mon, 14 Nov 2011 21:59:25 +0000 From: Nathan Sidwell User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110922 Lightning/1.0b2 Thunderbird/3.1.15 MIME-Version: 1.0 To: GCC Patches , markus@trippelsdorf.de Subject: coverage, propagate visibility 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 This patch propagates visibility information in the same way that weakness is for externally visible coverage objects. I don't know whether this will fix the reported firefox build failure -- can you try? Even if it doesn't, I'm pretty sure it's an improvement, but I'll leave it for comment before committing eitherway. built & tested on i686-pc-linux-gnu. nathan 2011-11-14 Nathan Sidwell PR gcov-profile/51113 * coverage.c (build_var): Propagate visibility for public decls. testsuite/ * gcc.misc-tests/gcov-16.c: New. * gcc.misc-tests/gcov-17.c: New. * g++.dg/gcov/gcov-8.C: New. * g++.dg/gcov/gcov-9.C: New. Index: coverage.c =================================================================== --- coverage.c (revision 181347) +++ coverage.c (working copy) @@ -674,6 +674,13 @@ build_var (tree fn_decl, tree type, int { TREE_PUBLIC (var) = TREE_PUBLIC (fn_decl); TREE_STATIC (var) = TREE_STATIC (fn_decl); + if (TREE_PUBLIC (var)) + { + DECL_WEAK (var) = DECL_WEAK (fn_decl); + DECL_VISIBILITY (var) = DECL_VISIBILITY (fn_decl); + DECL_VISIBILITY_SPECIFIED (var) + = DECL_VISIBILITY_SPECIFIED (fn_decl); + } } TREE_ADDRESSABLE (var) = 1; DECL_ALIGN (var) = TYPE_ALIGN (type); @@ -688,7 +695,6 @@ build_var (tree fn_decl, tree type, int if (TREE_PUBLIC (var)) DECL_ASSEMBLER_NAME (var); - DECL_WEAK (var) = TREE_PUBLIC (var) && DECL_WEAK (fn_decl); DECL_COMDAT (var) = DECL_COMDAT (fn_decl); DECL_COMDAT_GROUP (var) = DECL_COMDAT_GROUP (fn_decl); Index: testsuite/gcc.misc-tests/gcov-16.c =================================================================== --- testsuite/gcc.misc-tests/gcov-16.c (revision 0) +++ testsuite/gcc.misc-tests/gcov-16.c (revision 0) @@ -0,0 +1,10 @@ +/* Test visibility is copied */ + +/* { dg-options "-fprofile-arcs -fvisibility=hidden" } */ +/* { dg-require-visibility "" } */ + +void Foo () +{ +} + + /* { dg-final { scan-assembler "\\.hidden\t__gcov__Foo" } } */ Index: testsuite/gcc.misc-tests/gcov-17.c =================================================================== --- testsuite/gcc.misc-tests/gcov-17.c (revision 0) +++ testsuite/gcc.misc-tests/gcov-17.c (revision 0) @@ -0,0 +1,10 @@ +/* Test visibility is copied */ + +/* { dg-options "-fprofile-arcs" } */ +/* { dg-require-visibility "" } */ + +void __attribute__ ((visibility ("hidden"))) Foo () +{ +} + +/* { dg-final { scan-assembler "\\.hidden\t__gcov__Foo" } } */ Index: testsuite/g++.dg/gcov/gcov-8.C =================================================================== --- testsuite/g++.dg/gcov/gcov-8.C (revision 0) +++ testsuite/g++.dg/gcov/gcov-8.C (revision 0) @@ -0,0 +1,13 @@ +/* { dg-options "-fprofile-arcs -fvisibility=hidden" } */ +/* { dg-require-visibility "" } */ + +struct __attribute__((visibility ("hidden"))) X +{ + void Fink (); +}; + +void X::Fink () +{ +} + +/* { dg-final { scan-assembler "\\.hidden\t__gcov___ZN1X4FinkEv" } } */ Index: testsuite/g++.dg/gcov/gcov-9.C =================================================================== --- testsuite/g++.dg/gcov/gcov-9.C (revision 0) +++ testsuite/g++.dg/gcov/gcov-9.C (revision 0) @@ -0,0 +1,15 @@ +/* { dg-options "-fprofile-arcs -fvisibility-inlines-hidden" } */ +/* { dg-require-visibility "" } */ + +inline void Boo () +{ +} + +extern "C" void (*Foo ()) () +{ + return Boo; +} + +/* { dg-final { scan-assembler "\\.hidden\t__gcov___Z3Boov" } } */ +/* { dg-final { scan-assembler "__gcov__Foo:" } } */ +/* { dg-final { scan-assembler-not "\\.hidden\t__gcov__Foo" } } */