This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Do not bring local builtin functions and function with user defined assembler name
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 1 Dec 2010 19:47:26 +0100
- Subject: Do not bring local builtin functions and function with user defined assembler name
Hi,
this patch solves rest of builtin problems in testsuite with linker plugin.
First it disables localization of builtin functions. This can easily
lead to wrong code when we do some IPA propagation but later we decide
to introduce new call of the builtin (either in expansion or by folding).
Until problems with user defined assembler names are solved more resonably,
it is also better to not touch those.
Bootstrapped/regtested x86_64-linux, will commit this later today if there
are no complains.
* ipa.c (cgraph_externally_visible_p): Do not declare local
built ins and object with defined assembler names.
(varpool_externally_visible_p): Do not declare local vars
with defined assembler names.
Index: ipa.c
===================================================================
*** ipa.c (revision 167242)
--- ipa.c (working copy)
*************** cgraph_externally_visible_p (struct cgra
*** 655,660 ****
--- 655,676 ----
if (aliased)
return true;
+ /* Do not try to localize built-in functions yet. One of problems is that we
+ end up mangling their asm for WHOPR that makes it impossible to call them
+ using the implicit built-in declarations anymore. Similarly this enables
+ us to remove them as unreachable before actual calls may appear during
+ expansion or folding. */
+ if (DECL_BUILT_IN (node->decl))
+ return true;
+
+ /* FIXME: We get wrong symbols with asm aliases in callgraph and LTO.
+ This is because very little of code knows that assembler name needs to
+ mangled. Avoid touching declarations with user asm name set to mask
+ some of the problems. */
+ if (DECL_ASSEMBLER_NAME_SET_P (node->decl)
+ && IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl))[0]=='*')
+ return true;
+
/* If linker counts on us, we must preserve the function. */
if (cgraph_used_from_object_file_p (node))
return true;
*************** varpool_externally_visible_p (struct var
*** 721,726 ****
--- 737,750 ----
if (varpool_used_from_object_file_p (vnode))
return true;
+ /* FIXME: We get wrong symbols with asm aliases in callgraph and LTO.
+ This is because very little of code knows that assembler name needs to
+ mangled. Avoid touching declarations with user asm name set to mask
+ some of the problems. */
+ if (DECL_ASSEMBLER_NAME_SET_P (vnode->decl)
+ && IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (vnode->decl))[0]=='*')
+ return true;
+
if (DECL_PRESERVE_P (vnode->decl))
return true;
if (lookup_attribute ("externally_visible",