From 62324487d5a7c61edfc0be6553c9d2dc86a96ada Mon Sep 17 00:00:00 2001 From: hubicka Date: Sun, 5 Dec 2010 00:21:12 +0000 Subject: [PATCH] * ipa.c (cgraph_externally_visible_p): Do not localize builtins and functions with user asm defined names. (varpool_externally_visible_p): Do not localize vars with user asm defined names. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167465 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/ipa.c | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7c1b32d..c9a578d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2010-12-03 Jan Hubicka + * ipa.c (cgraph_externally_visible_p): Do not localize builtins + and functions with user asm defined names. + (varpool_externally_visible_p): Do not localize vars with user + asm defined names. + +2010-12-03 Jan Hubicka + * dwarf2asm.c (dw2_output_indirect_constant_1): Set DECL_ASSEMBLER_NAME to prevent mangling with lto frontend. diff --git a/gcc/ipa.c b/gcc/ipa.c index 0b6518b..5f39904 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -655,6 +655,22 @@ cgraph_externally_visible_p (struct cgraph_node *node, bool whole_program, bool 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; @@ -721,6 +737,14 @@ varpool_externally_visible_p (struct varpool_node *vnode, bool aliased) 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", -- 2.7.4