From patchwork Tue Jun 14 12:50:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 100323 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 59576B6FB7 for ; Tue, 14 Jun 2011 22:51:01 +1000 (EST) Received: (qmail 27871 invoked by alias); 14 Jun 2011 12:50:59 -0000 Received: (qmail 27863 invoked by uid 22791); 14 Jun 2011 12:50:58 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Jun 2011 12:50:42 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 412649AC7EE; Tue, 14 Jun 2011 14:50:41 +0200 (CEST) Date: Tue, 14 Jun 2011 14:50:41 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix dealII LTO link error Message-ID: <20110614125041.GB16995@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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 Hi, this patch solves problem with DealII and WHOPR. The code to handle comdat groups was written with assumption that everything in the group is COMDAT that is not always true. Bootstrapped/regtested x86_64-linux, comitted. Honza * cgraph.c (cgraph_make_decl_local): Handle DECL_ONE_ONLY similarly to DECL_COMDAT. * cgraphunit.c (cgraph_analyze_function): Likewise. * ipa.c (function_and_variable_visibility): Likewise. Index: cgraph.c =================================================================== --- cgraph.c (revision 175001) +++ cgraph.c (working copy) @@ -2487,7 +2487,7 @@ cgraph_make_decl_local (tree decl) DECL_COMMON (decl) = 0; else gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); - if (DECL_COMDAT (decl)) + if (DECL_ONE_ONLY (decl) || DECL_COMDAT (decl)) { /* It is possible that we are linking against library defining same COMDAT function. To avoid conflict we need to rename our local name of the Index: cgraphunit.c =================================================================== --- cgraphunit.c (revision 175001) +++ cgraphunit.c (working copy) @@ -830,9 +830,9 @@ cgraph_analyze_function (struct cgraph_n if (TREE_PUBLIC (node->decl) && node->same_body_alias) { DECL_EXTERNAL (node->decl) = DECL_EXTERNAL (node->thunk.alias); - if (DECL_COMDAT (node->thunk.alias)) + if (DECL_ONE_ONLY (node->thunk.alias)) { - DECL_COMDAT (node->decl) = 1; + DECL_COMDAT (node->decl) = DECL_COMDAT (node->thunk.alias); DECL_COMDAT_GROUP (node->decl) = DECL_COMDAT_GROUP (node->thunk.alias); if (DECL_ONE_ONLY (node->thunk.alias) && !node->same_comdat_group) { Index: ipa.c =================================================================== --- ipa.c (revision 175001) +++ ipa.c (working copy) @@ -904,9 +904,9 @@ function_and_variable_visibility (bool w We also need to arrange the thunk into the same comdat group as the function it reffers to. */ - if (DECL_COMDAT (decl_node->decl)) + if (DECL_ONE_ONLY (decl_node->decl)) { - DECL_COMDAT (node->decl) = 1; + DECL_COMDAT (node->decl) = DECL_COMDAT (decl_node->decl); DECL_COMDAT_GROUP (node->decl) = DECL_COMDAT_GROUP (decl_node->decl); if (DECL_ONE_ONLY (decl_node->decl) && !node->same_comdat_group) {