summaryrefslogtreecommitdiff
path: root/gcc/lto/lto-partition.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-07-16 11:40:25 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-07-16 11:40:25 +0000
commit8cd167a5ad8baf4988e07fcbc9c9cc338c02d3d1 (patch)
tree74fd60c507288ef44ed7f786fafeecbb5df0e160 /gcc/lto/lto-partition.c
parentf80b5ea1605c9f9408c5aa386ba71c16d918ebbf (diff)
downloadgcc-tarball-8cd167a5ad8baf4988e07fcbc9c9cc338c02d3d1.tar.gz
gcc-5.2.0gcc-5.2.0
Diffstat (limited to 'gcc/lto/lto-partition.c')
-rw-r--r--gcc/lto/lto-partition.c72
1 files changed, 42 insertions, 30 deletions
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 235b735a8f..7d117e9a49 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -877,27 +877,13 @@ validize_symbol_for_target (symtab_node *node)
}
}
-/* Mangle NODE symbol name into a local name.
- This is necessary to do
- 1) if two or more static vars of same assembler name
- are merged into single ltrans unit.
- 2) if previously static var was promoted hidden to avoid possible conflict
- with symbols defined out of the LTO world. */
+/* Helper for privatize_symbol_name. Mangle NODE symbol name
+ represented by DECL. */
static bool
-privatize_symbol_name (symtab_node *node)
+privatize_symbol_name_1 (symtab_node *node, tree decl)
{
- tree decl = node->decl;
- const char *name;
- cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
-
- /* If we want to privatize instrumentation clone
- then we need to change original function name
- which is used via transparent alias chain. */
- if (cnode && cnode->instrumentation_clone)
- decl = cnode->orig_decl;
-
- name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+ const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
if (must_not_rename (node, name))
return false;
@@ -906,31 +892,57 @@ privatize_symbol_name (symtab_node *node)
symtab->change_decl_assembler_name (decl,
clone_function_name_1 (name,
"lto_priv"));
+
if (node->lto_file_data)
lto_record_renamed_decl (node->lto_file_data, name,
IDENTIFIER_POINTER
(DECL_ASSEMBLER_NAME (decl)));
+
+ if (symtab->dump_file)
+ fprintf (symtab->dump_file,
+ "Privatizing symbol name: %s -> %s\n",
+ name, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
+
+ return true;
+}
+
+/* Mangle NODE symbol name into a local name.
+ This is necessary to do
+ 1) if two or more static vars of same assembler name
+ are merged into single ltrans unit.
+ 2) if previously static var was promoted hidden to avoid possible conflict
+ with symbols defined out of the LTO world. */
+
+static bool
+privatize_symbol_name (symtab_node *node)
+{
+ if (!privatize_symbol_name_1 (node, node->decl))
+ return false;
+
/* We could change name which is a target of transparent alias
chain of instrumented function name. Fix alias chain if so .*/
- if (cnode)
+ if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
{
tree iname = NULL_TREE;
if (cnode->instrumentation_clone)
- iname = DECL_ASSEMBLER_NAME (cnode->decl);
+ {
+ /* If we want to privatize instrumentation clone
+ then we also need to privatize original function. */
+ if (cnode->instrumented_version)
+ privatize_symbol_name (cnode->instrumented_version);
+ else
+ privatize_symbol_name_1 (cnode, cnode->orig_decl);
+ iname = DECL_ASSEMBLER_NAME (cnode->decl);
+ TREE_CHAIN (iname) = DECL_ASSEMBLER_NAME (cnode->orig_decl);
+ }
else if (cnode->instrumented_version
- && cnode->instrumented_version->orig_decl == decl)
- iname = DECL_ASSEMBLER_NAME (cnode->instrumented_version->decl);
-
- if (iname)
+ && cnode->instrumented_version->orig_decl == cnode->decl)
{
- gcc_assert (IDENTIFIER_TRANSPARENT_ALIAS (iname));
- TREE_CHAIN (iname) = DECL_ASSEMBLER_NAME (decl);
+ iname = DECL_ASSEMBLER_NAME (cnode->instrumented_version->decl);
+ TREE_CHAIN (iname) = DECL_ASSEMBLER_NAME (cnode->decl);
}
}
- if (symtab->dump_file)
- fprintf (symtab->dump_file,
- "Privatizing symbol name: %s -> %s\n",
- name, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
+
return true;
}