From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 614 invoked by alias); 4 Jun 2012 14:19:33 -0000 Received: (qmail 602 invoked by uid 22791); 4 Jun 2012 14:19:32 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Jun 2012 14:19:19 +0000 From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/53572] Some public symbols don't get to serialized LTO Date: Mon, 04 Jun 2012 14:19:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Keywords: lto X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-06/txt/msg00179.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53572 --- Comment #3 from Jan Hubicka 2012-06-04 14:19:02 UTC --- I do not have linker plugin enabled setup handy at the moment, but the following patch should fix it: Index: cgraph.h =================================================================== --- cgraph.h (revision 188138) +++ cgraph.h (working copy) @@ -1126,7 +1126,8 @@ varpool_can_remove_if_no_refs (struct va if (DECL_EXTERNAL (node->symbol.decl)) return true; return (!node->symbol.force_output && !node->symbol.used_from_other_partition - && (DECL_COMDAT (node->symbol.decl) + && ((DECL_COMDAT (node->symbol.decl) + && symtab_used_from_object_file_p ((symtab_node) node)) || !node->symbol.externally_visible || DECL_HAS_VALUE_EXPR_P (node->symbol.decl))); } I am testing this patch for mainline. As discussed on IRC, this patch can have negative effect on V1 linker API setups: here all comdats appears to be externally visible and thus they will be forced to output. But perhaps it is now resonable to expect V2 linker API even for GCC 4.7 based setups for sane LTO with C++? We already mention in release notes that V1 API is bad idea... Honza