public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [arm-embedded] [PATCH, GCC/LTO, ping] Fix PR69866: LTO with def for weak alias in regular object file
       [not found] <20170615122318.GC84372@kam.mff.cuni.cz>
@ 2017-11-28 15:49 ` Thomas Preudhomme
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Preudhomme @ 2017-11-28 15:49 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

Hi,

We have decided to apply the forwarded patch to the embedded-7-branch to fix an 
ICE when doing partial LTO with weak symbols.

ChangeLog entry is as follows:

2017-11-28  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	Backport from mainline
	2017-06-15  Jan Hubicka  <hubicka@ucw.cz>
		    Thomas Preud'homme  <thomas.preudhomme@arm.com>

	PR lto/69866
	* lto-symtab.c (lto_symtab_merge_symbols): Drop useless definitions
	that resolved externally.

	Backport from mainline
	2017-06-15  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	PR lto/69866
	* gcc.dg/lto/pr69866_0.c: New test.
	* gcc.dg/lto/pr69866_1.c: Likewise.


Best regards,

Thomas

[-- Attachment #2: Re: [PATCH, GCC/LTO, ping] Fix PR69866: LTO with def for weak alias in regular object file.eml --]
[-- Type: message/rfc822, Size: 3319 bytes --]

From: Jan Hubicka <hubicka@ucw.cz>
To: Thomas Preudhomme <thomas.preudhomme@foss.arm.com>
Subject: Re: [PATCH, GCC/LTO, ping] Fix PR69866: LTO with def for weak alias in regular object file
Date: Thu, 15 Jun 2017 14:23:19 +0200
Message-ID: <20170615122318.GC84372@kam.mff.cuni.cz>

Hi,
I am testing the following. Let me know if it works for you.

Honza

Index: lto/lto-symtab.c
===================================================================
--- lto/lto-symtab.c	(revision 249213)
+++ lto/lto-symtab.c	(working copy)
@@ -952,6 +952,42 @@
 	      if (tgt)
 		node->resolve_alias (tgt, true);
 	    }
+	  /* If the symbol was preempted outside IR, see if we want to get rid
+	     of the definition.  */
+	  if (node->analyzed
+	      && !DECL_EXTERNAL (node->decl)
+	      && (node->resolution == LDPR_PREEMPTED_REG
+		  || node->resolution == LDPR_RESOLVED_IR
+		  || node->resolution == LDPR_RESOLVED_EXEC
+		  || node->resolution == LDPR_RESOLVED_DYN))
+	    {
+	      DECL_EXTERNAL (node->decl) = 1;
+	      /* If alias to local symbol was preempted by external definition,
+		 we know it is not pointing to the local symbol.  Remove it.  */
+	      if (node->alias
+		  && !node->weakref
+		  && !node->transparent_alias
+		  && node->get_alias_target ()->binds_to_current_def_p ())
+		{
+		  node->alias = false;
+		  node->remove_all_references ();
+		  node->definition = false;
+		  node->analyzed = false;
+		  node->cpp_implicit_alias = false;
+		}
+	      else if (!node->alias
+		       && node->definition
+		       && node->get_availability () <= AVAIL_INTERPOSABLE)
+		{
+		  if ((cnode = dyn_cast <cgraph_node *> (node)) != NULL)
+		    cnode->reset ();
+		  else
+		    {
+		      node->analyzed = node->definition = false;
+		      node->remove_all_references ();
+		    }
+		}
+	    }
 
 	  if (!(cnode = dyn_cast <cgraph_node *> (node))
 	      || !cnode->clone_of

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [arm-embedded] [PATCH, GCC/LTO, ping] Fix PR69866: LTO with def for weak alias in regular object file
  2017-06-18 19:56 Jan Hubicka
@ 2017-06-20 13:20 ` Thomas Preudhomme
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Preudhomme @ 2017-06-20 13:20 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 943 bytes --]

Hi,

We have decided to apply the referenced fix (r249352) to the 
ARM/embedded-6-branch along with its initial commit (r249224) to fix an ICE with 
LTO and aliases.

Fix PR69866

     2017-06-20  Thomas Preud'homme  <thomas.preudhomme@arm.com>

         Backport from mainline
         2017-06-15  Jan Hubicka  <hubicka@ucw.cz>
                     Thomas Preud'homme  <thomas.preudhomme@arm.com>

         gcc/
         PR lto/69866
         * lto-symtab.c (lto_symtab_merge_symbols): Drop useless definitions
         that resolved externally.
         2017-06-15  Thomas Preud'homme  <thomas.preudhomme@arm.com>

         gcc/testsuite/
         PR lto/69866
         * gcc.dg/lto/pr69866_0.c: New test.
         * gcc.dg/lto/pr69866_1.c: Likewise.

         Backport from mainline
         2017-06-18  Jan Hubicka  <hubicka@ucw.cz>

         gcc/testsuite/
         * gcc.dg/lto/pr69866_0.c: This test needs alias.

Best regards,

Thomas

[-- Attachment #2: Re: [PATCH, GCC/LTO, ping] Fix PR69866: LTO with def for weak alias in regular object file.eml --]
[-- Type: message/rfc822, Size: 3534 bytes --]

From: Jan Hubicka <hubicka@ucw.cz>
To: Dominique d'Humi??res <dominiq@lps.ens.fr>
Cc: hubicka Jan <hubicka@ucw.cz>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, GCC/LTO, ping] Fix PR69866: LTO with def for weak alias in regular object file
Date: Sun, 18 Jun 2017 21:56:01 +0200
Message-ID: <20170618195601.GG30427@atrey.karlin.mff.cuni.cz>

> The new test fails on darwin with the usual
> 
> FAIL: gcc.dg/lto/pr69866 c_lto_pr69866_0.o-c_lto_pr69866_1.o link, -O0 -flto -flto-partition=none
> 
> IMO it requires a
> 
> /* { dg-require-alias "" } */

Yep,I will add it shortly.

Honza
> 
> directive.
> 
> TIA
> 
> Dominique

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-28 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170615122318.GC84372@kam.mff.cuni.cz>
2017-11-28 15:49 ` [arm-embedded] [PATCH, GCC/LTO, ping] Fix PR69866: LTO with def for weak alias in regular object file Thomas Preudhomme
2017-06-18 19:56 Jan Hubicka
2017-06-20 13:20 ` [arm-embedded] " Thomas Preudhomme

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