public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: gcc-patches@gcc.gnu.org
Subject: Fix dealII LTO link error
Date: Tue, 14 Jun 2011 12:53:00 -0000	[thread overview]
Message-ID: <20110614125041.GB16995@kam.mff.cuni.cz> (raw)

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)
 		{

                 reply	other threads:[~2011-06-14 12:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110614125041.GB16995@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).