Patchwork [SPARC] Fix PR target/52717

login
register
mail settings
Submitter Eric Botcazou
Date April 9, 2012, 8:53 a.m.
Message ID <201204091053.47330.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/151424/
State New
Headers show

Comments

Eric Botcazou - April 9, 2012, 8:53 a.m.
This is the LTO issue with -fpic/-fpie on SPARC/Linux.  When the special GOT 
helper function is generated, the compiler invokes:

	  make_decl_one_only (decl, DECL_ASSEMBLER_NAME (decl));

on it, which sets the TREE_PUBLIC flag as expected.  The problem is that, in 
LTO mode, DECL_ASSEMBLER_NAME (decl) depends on TREE_PUBLIC being set or not.

Tested on SPARC/Linux, applied to all active branches.


2012-04-09  Eric Botcazou  <ebotcazou@adacore.com>

	PR target/52717
	* config/sparc/sparc.c (sparc_file_end): Set TREE_PUBLIC explicitly on
	the DECL generated for the special GOT helper.

Patch

Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 186176)
+++ config/sparc/sparc.c	(working copy)
@@ -10800,6 +10800,7 @@  sparc_file_end (void)
                                                             NULL_TREE));
 	  DECL_RESULT (decl) = build_decl (BUILTINS_LOCATION, RESULT_DECL,
 					   NULL_TREE, void_type_node);
+	  TREE_PUBLIC (decl) = 1;
 	  TREE_STATIC (decl) = 1;
 	  make_decl_one_only (decl, DECL_ASSEMBLER_NAME (decl));
 	  DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;