From patchwork Thu Jun 13 10:18:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 251034 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 0C2822C007E for ; Thu, 13 Jun 2013 20:18:17 +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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=dVeFhQmVg+3hmyInvlh0L6yU2FJEy4U60svEIfRQNtem+F+kWiEo9 uf2LC3sSOfYGdjDfsi/gh/kQg6Qq2lKnLt8iV+nhZXY8Bb9ibxnBWW5LQt7jBpiw qAGZS+jRDlLNDHB+jXmf4wCivkbHnGh1BLrqzogUuhqHu+tHBGMjYM= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=n+RJ2I8Zzsct5xAYJUzKFJgWXBE=; b=ouED2Z5sP+CyZuts297i QbQeeFMfHx1vF8DMb5GWLUiYg4h2utF2f9jIc/3Oz9gryroBGyGoNlhgqety14Pl pozmHvumnmBelEZUE4z7WvcUDm2ObSvaQAnifzw+4Pr68w26BWI8fQl4o8Levqp4 Ogl9+dCsnHVJ1+g/crwe/cc= Received: (qmail 11444 invoked by alias); 13 Jun 2013 10:18:10 -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 11424 invoked by uid 89); 13 Jun 2013 10:18:06 -0000 X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 13 Jun 2013 10:18:05 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id B9253542F21; Thu, 13 Jun 2013 12:18:02 +0200 (CEST) Date: Thu, 13 Jun 2013 12:18:02 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix LTO support for compound literals Message-ID: <20130613101802.GG24302@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Hi, compount literals are constructed COMDAT but not PUBLIC by C frontned. A while ago I discussed with with Jason? (I believe) and the reason for that is that they allow sharing even if it is not done by linker. This however breaks our partitioning code that assumes that COMDAT is always exported. This patch sives it and fixes one of two problems seen while linking Linux kernel. Bootstrapped/regtested x86_64-linux, comitted. Honza * ipa.c (cgraph_externally_visible_p, varpool_externally_visible_p): Local comdats are not externally visible. * symtab.c (dump_symtab_base): Dump externally visible. (verify_symtab_base): Verify back links in the symtab hash. Index: ipa.c =================================================================== --- ipa.c (revision 200016) +++ ipa.c (working copy) @@ -606,9 +606,8 @@ cgraph_externally_visible_p (struct cgra { if (!node->symbol.definition) return false; - if (!DECL_COMDAT (node->symbol.decl) - && (!TREE_PUBLIC (node->symbol.decl) - || DECL_EXTERNAL (node->symbol.decl))) + if (!TREE_PUBLIC (node->symbol.decl) + || DECL_EXTERNAL (node->symbol.decl)) return false; /* Do not try to localize built-in functions yet. One of problems is that we @@ -667,7 +666,7 @@ varpool_externally_visible_p (struct var if (DECL_EXTERNAL (vnode->symbol.decl)) return true; - if (!DECL_COMDAT (vnode->symbol.decl) && !TREE_PUBLIC (vnode->symbol.decl)) + if (!TREE_PUBLIC (vnode->symbol.decl)) return false; /* If linker counts on us, we must preserve the function. */ Index: symtab.c =================================================================== --- symtab.c (revision 200018) +++ symtab.c (working copy) @@ -508,6 +508,8 @@ dump_symtab_base (FILE *f, symtab_node n fprintf (f, " force_output"); if (node->symbol.forced_by_abi) fprintf (f, " forced_by_abi"); + if (node->symbol.externally_visible) + fprintf (f, " externally_visible"); if (node->symbol.resolution != LDPR_UNKNOWN) fprintf (f, " %s", ld_plugin_symbol_resolution_names[(int)node->symbol.resolution]); @@ -655,6 +657,15 @@ verify_symtab_base (symtab_node node) error ("node not found in symtab decl hashtable"); error_found = true; } + if (hashed_node != node + && (!is_a (node) + || !dyn_cast (node)->clone_of + || dyn_cast (node)->clone_of->symbol.decl + != node->symbol.decl)) + { + error ("node differs from symtab decl hashtable"); + error_found = true; + } } if (assembler_name_hash) {