summaryrefslogtreecommitdiff
path: root/gcc/lto
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-06 13:59:55 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-06 13:59:55 +0000
commit18ff06f9eb3202377b3eb511469abc4fb63f2d72 (patch)
tree0c275b274a19f744168cc3a157e933f102062784 /gcc/lto
parent0f328cd66581eb00730cce6ca1cc93ecd341a3ad (diff)
downloadgcc-18ff06f9eb3202377b3eb511469abc4fb63f2d72.tar.gz
PR lto/54790
* lto.c (resolution_map): New static var. (register_resolution): New function. (lto_register_var_decl_in_symtab): Use it. (read_cgraph_and_symbols): Copy resolutions into the symtab. * lto-streamer.h (lto_symtab_register_decl, lto_symtab_get_resolution, lto_mark_nothrow_fndecl, lto_fixup_nothrow_decls): Remove. * lto-symtab.c (lto_symtab_register_decl): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192159 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto')
-rw-r--r--gcc/lto/ChangeLog8
-rw-r--r--gcc/lto/lto.c37
2 files changed, 41 insertions, 4 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 7c437d6c9e5..86acc2417d2 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,11 @@
+2012-10-06 Jan Hubicka <jh@suse.cz>
+
+ PR lto/54790
+ * lto.c (resolution_map): New static var.
+ (register_resolution): New function.
+ (lto_register_var_decl_in_symtab): Use it.
+ (read_cgraph_and_symbols): Copy resolutions into the symtab.
+
2012-09-20 Martin Jambor <mjambor@suse.cz>
* lto.c (lto_materialize_function): Call push_struct_function and
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 44718537b3c..c6b882d6941 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -1692,6 +1692,19 @@ get_resolution (struct data_in *data_in, unsigned index)
return LDPR_UNKNOWN;
}
+/* Map assigning declarations their resolutions. */
+static pointer_map_t *resolution_map;
+
+/* We need to record resolutions until symbol table is read. */
+static void
+register_resolution (tree decl, enum ld_plugin_symbol_resolution resolution)
+{
+ if (resolution == LDPR_UNKNOWN)
+ return;
+ if (!resolution_map)
+ resolution_map = pointer_map_create ();
+ *pointer_map_insert (resolution_map, decl) = (void *)(size_t)resolution;
+}
/* Register DECL with the global symbol table and change its
name if necessary to avoid name clashes for static globals across
@@ -1730,8 +1743,7 @@ lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl)
unsigned ix;
if (!streamer_tree_cache_lookup (data_in->reader_cache, decl, &ix))
gcc_unreachable ();
- lto_symtab_register_decl (decl, get_resolution (data_in, ix),
- data_in->file_data);
+ register_resolution (decl, get_resolution (data_in, ix));
}
}
@@ -1789,8 +1801,7 @@ lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl)
unsigned ix;
if (!streamer_tree_cache_lookup (data_in->reader_cache, decl, &ix))
gcc_unreachable ();
- lto_symtab_register_decl (decl, get_resolution (data_in, ix),
- data_in->file_data);
+ register_resolution (decl, get_resolution (data_in, ix));
}
}
@@ -2946,6 +2957,24 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
timevar_push (TV_IPA_LTO_CGRAPH_IO);
/* Read the symtab. */
input_symtab ();
+
+ /* Store resolutions into the symbol table. */
+ if (resolution_map)
+ {
+ void **res;
+ symtab_node snode;
+
+ FOR_EACH_SYMBOL (snode)
+ if (symtab_real_symbol_p (snode)
+ && (res = pointer_map_contains (resolution_map,
+ snode->symbol.decl)))
+ snode->symbol.resolution
+ = (enum ld_plugin_symbol_resolution)(size_t)*res;
+
+ pointer_map_destroy (resolution_map);
+ resolution_map = NULL;
+ }
+
timevar_pop (TV_IPA_LTO_CGRAPH_IO);
if (!quiet_flag)