diff mbox

Fix LTO weakref handling without .weakref assembler support (PR target/47333)

Message ID 20120106164139.GT18937@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Jan. 6, 2012, 4:41 p.m. UTC
Hi!

If as doesn't support .weakref, we handle weakrefs by
assemble_alias setting IDENTIFIER_TRANSPARENT_ALIAS and using
ultimate_transparent_alias_target from assemble_name.
But for this to work, assemble_alias has to be called before
asm for functions is emitted, not after it.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux
and tested with the hacked up x86_64-linux gcc without HAVE_GAS_WEAKREF
in auto-host.h on the testcase.

Ok for trunk?

2012-01-06  Jakub Jelinek  <jakub@redhat.com>

	PR target/47333
	* cgraphunit.c (cgraph_optimize): Call output_weakrefs
	before emitting functions.


	Jakub

Comments

Richard Henderson Jan. 6, 2012, 9:52 p.m. UTC | #1
On 01/07/2012 03:41 AM, Jakub Jelinek wrote:
> 	PR target/47333
> 	* cgraphunit.c (cgraph_optimize): Call output_weakrefs
> 	before emitting functions.

Ok.


r~
Jan Hubicka Jan. 6, 2012, 9:55 p.m. UTC | #2
> Hi!
> 
> If as doesn't support .weakref, we handle weakrefs by
> assemble_alias setting IDENTIFIER_TRANSPARENT_ALIAS and using
> ultimate_transparent_alias_target from assemble_name.
> But for this to work, assemble_alias has to be called before
> asm for functions is emitted, not after it.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux
> and tested with the hacked up x86_64-linux gcc without HAVE_GAS_WEAKREF
> in auto-host.h on the testcase.
> 
> Ok for trunk?

OK,
thanks!
Honza
diff mbox

Patch

--- gcc/cgraphunit.c.jj	2011-12-15 08:06:54.000000000 +0100
+++ gcc/cgraphunit.c	2012-01-06 14:50:50.291364878 +0100
@@ -2187,6 +2187,7 @@  cgraph_optimize (void)
 #endif
   bitmap_obstack_release (NULL);
   cgraph_mark_functions_to_output ();
+  output_weakrefs ();
 
   cgraph_state = CGRAPH_STATE_EXPANSION;
   if (!flag_toplevel_reorder)
@@ -2201,7 +2202,6 @@  cgraph_optimize (void)
       varpool_assemble_pending_decls ();
     }
 
-  output_weakrefs ();
   cgraph_process_new_functions ();
   cgraph_state = CGRAPH_STATE_FINISHED;