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 <[email protected]>
PR target/52717
* config/sparc/sparc.c (sparc_file_end): Set TREE_PUBLIC explicitly on
the DECL generated for the special GOT helper.
--
Eric Botcazou
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;