diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-02 10:41:24 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-02 10:41:24 +0000 |
commit | da722561fdc4850dee00780c7cd076ff5c82301b (patch) | |
tree | 05d172b704e7c63048f3ef9b5fd618f3b89ee016 | |
parent | 33e7b55c2549d655d88ec64c06c51912d0d07527 (diff) | |
download | gcc-da722561fdc4850dee00780c7cd076ff5c82301b.tar.gz |
PR lto/47247
* lto-plugin.c (get_symbols_v2): New variable.
(write_resolution): Use V2 API when available.
(onload): Handle LDPT_GET_SYMBOLS_V2.
* lto-symtab.c (lto_symtab_resolve_symbols): Do not resolve
when resolution is already availbale from plugin.
(lto_symtab_merge_decls_1): Handle LDPR_PREVAILING_DEF_IRONLY_EXP.
* cgraph.c (ld_plugin_symbol_resolution): Add prevailing_def_ironly_exp.
* lto-cgraph.c (LDPR_NUM_KNOWN): Update.
* ipa.c (varpool_externally_visible_p): IRONLY variables are never
externally visible.
* varasm.c (resolution_to_local_definition_p): Add
LDPR_PREVAILING_DEF_IRONLY_EXP.
(resolution_local_p): Likewise.
* common.c (lto_resolution_str): Add new resolution.
* common.h (lto_resolution_str): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179424 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/cgraph.c | 3 | ||||
-rw-r--r-- | gcc/ipa.c | 2 | ||||
-rw-r--r-- | gcc/lto-cgraph.c | 2 | ||||
-rw-r--r-- | gcc/lto-symtab.c | 16 | ||||
-rw-r--r-- | gcc/lto/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lto/common.c | 5 | ||||
-rw-r--r-- | gcc/lto/common.h | 5 | ||||
-rw-r--r-- | gcc/varasm.c | 2 | ||||
-rw-r--r-- | lto-plugin/ChangeLog | 7 | ||||
-rw-r--r-- | lto-plugin/lto-plugin.c | 12 |
11 files changed, 60 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c6c8322e0aa..5373a31e291 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2011-10-02 Jan Hubicka <jh@suse.cz> + + PR lto/47247 + * lto-symtab.c (lto_symtab_resolve_symbols): Do not resolve + when resolution is already availbale from plugin. + (lto_symtab_merge_decls_1): Handle LDPR_PREVAILING_DEF_IRONLY_EXP. + * cgraph.c (ld_plugin_symbol_resolution): Add prevailing_def_ironly_exp. + * lto-cgraph.c (LDPR_NUM_KNOWN): Update. + * ipa.c (varpool_externally_visible_p): IRONLY variables are never + externally visible. + * varasm.c (resolution_to_local_definition_p): Add + LDPR_PREVAILING_DEF_IRONLY_EXP. + (resolution_local_p): Likewise. + 2011-10-01 David S. Miller <davem@davemloft.net> * config/sparc/sparc.opt (VIS3): New option. diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 14e7a3b0f08..84d6bd5198a 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -110,7 +110,8 @@ const char * const ld_plugin_symbol_resolution_names[]= "preempted_ir", "resolved_ir", "resolved_exec", - "resolved_dyn" + "resolved_dyn", + "prevailing_def_ironly_exp" }; static void cgraph_node_remove_callers (struct cgraph_node *node); diff --git a/gcc/ipa.c b/gcc/ipa.c index 9d54811e5c9..a8c4a358e04 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -685,6 +685,8 @@ varpool_externally_visible_p (struct varpool_node *vnode, bool aliased) This is needed for i.e. references from asm statements. */ if (varpool_used_from_object_file_p (vnode)) return true; + if (vnode->resolution == LDPR_PREVAILING_DEF_IRONLY) + return false; /* As a special case, the COMDAT virutal tables can be unshared. In LTO mode turn vtables into static variables. The variable is readonly, diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 0f1a8c5ff27..9254b8f9014 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -52,7 +52,7 @@ static void output_cgraph_opt_summary (cgraph_node_set set); static void input_cgraph_opt_summary (VEC (cgraph_node_ptr, heap) * nodes); /* Number of LDPR values known to GCC. */ -#define LDPR_NUM_KNOWN (LDPR_RESOLVED_DYN + 1) +#define LDPR_NUM_KNOWN (LDPR_PREVAILING_DEF_IRONLY_EXP + 1) /* Cgraph streaming is organized as set of record whose type is indicated by a tag. */ diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index 3a7c783f770..68c6231760e 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -441,12 +441,14 @@ lto_symtab_resolve_symbols (void **slot) e->node = cgraph_get_node (e->decl); else if (TREE_CODE (e->decl) == VAR_DECL) e->vnode = varpool_get_node (e->decl); + if (e->resolution == LDPR_PREVAILING_DEF_IRONLY + || e->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP + || e->resolution == LDPR_PREVAILING_DEF) + prevailing = e; } - e = (lto_symtab_entry_t) *slot; - /* If the chain is already resolved there is nothing else to do. */ - if (e->resolution != LDPR_UNKNOWN) + if (prevailing) return; /* Find the single non-replaceable prevailing symbol and @@ -586,6 +588,7 @@ lto_symtab_merge_decls_1 (void **slot, void *data ATTRIBUTE_UNUSED) for (prevailing = (lto_symtab_entry_t) *slot; prevailing && prevailing->resolution != LDPR_PREVAILING_DEF_IRONLY + && prevailing->resolution != LDPR_PREVAILING_DEF_IRONLY_EXP && prevailing->resolution != LDPR_PREVAILING_DEF; prevailing = prevailing->next) ; @@ -595,6 +598,7 @@ lto_symtab_merge_decls_1 (void **slot, void *data ATTRIBUTE_UNUSED) for (e = prevailing->next; e; e = e->next) { if (e->resolution == LDPR_PREVAILING_DEF_IRONLY + || e->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP || e->resolution == LDPR_PREVAILING_DEF) fatal_error ("multiple prevailing defs for %qE", DECL_NAME (prevailing->decl)); @@ -685,9 +689,9 @@ lto_symtab_merge_decls_1 (void **slot, void *data ATTRIBUTE_UNUSED) to handle UNKNOWN relocation well. The problem with storing guessed decision is whether to use - PREVAILING_DEF or PREVAILING_DEF_IRONLY. First one would disable - some whole program optimizations, while ther second would imply - to many whole program assumptions. */ + PREVAILING_DEF, PREVAILING_DEF_IRONLY, PREVAILING_DEF_IRONLY_EXP. + First one would disable some whole program optimizations, while + ther second would imply to many whole program assumptions. */ if (prevailing->node && !flag_ltrans && !prevailing->guessed) prevailing->node->resolution = prevailing->resolution; else if (prevailing->vnode && !flag_ltrans && !prevailing->guessed) diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 6ca8f5b7b1d..d3d7ffd484e 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2011-10-02 Jan Hubicka <jh@suse.cz> + + PR lto/47247 + * common.c (lto_resolution_str): Add new resolution. + * common.h (lto_resolution_str): Likewise. + 2011-09-30 H.J. Lu <hongjiu.lu@intel.com> Andi Kleen <ak@linux.intel.com> diff --git a/gcc/lto/common.c b/gcc/lto/common.c index b54ec491e12..a23fdbb8434 100644 --- a/gcc/lto/common.c +++ b/gcc/lto/common.c @@ -31,7 +31,7 @@ const char *lto_visibility_str[4] __attribute__ ((visibility ("hidden"))) = "INTERNAL", "HIDDEN" }; -const char *lto_resolution_str[9] __attribute__ ((visibility ("hidden"))) = +const char *lto_resolution_str[10] __attribute__ ((visibility ("hidden"))) = { "UNKNOWN", "UNDEF", @@ -41,6 +41,7 @@ const char *lto_resolution_str[9] __attribute__ ((visibility ("hidden"))) = "PREEMPTED_IR", "RESOLVED_IR", "RESOLVED_EXEC", - "RESOLVED_DYN" + "RESOLVED_DYN", + "PREVAILING_DEF_IRONLY_EXP", }; diff --git a/gcc/lto/common.h b/gcc/lto/common.h index e82184795ba..6f9a6928916 100644 --- a/gcc/lto/common.h +++ b/gcc/lto/common.h @@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see -static const char *lto_resolution_str[9] = +static const char *lto_resolution_str[10] = { "UNKNOWN", "UNDEF", @@ -30,5 +30,6 @@ static const char *lto_resolution_str[9] = "PREEMPTED_IR", "RESOLVED_IR", "RESOLVED_EXEC", - "RESOLVED_DYN" + "RESOLVED_DYN", + "PREVAILING_DEF_IRONLY_EXP", }; diff --git a/gcc/varasm.c b/gcc/varasm.c index 9eb7295d68f..9b4dfad5cbb 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -6683,6 +6683,7 @@ static bool resolution_to_local_definition_p (enum ld_plugin_symbol_resolution resolution) { return (resolution == LDPR_PREVAILING_DEF + || resolution == LDPR_PREVAILING_DEF_IRONLY_EXP || resolution == LDPR_PREVAILING_DEF_IRONLY); } @@ -6694,6 +6695,7 @@ resolution_local_p (enum ld_plugin_symbol_resolution resolution) { return (resolution == LDPR_PREVAILING_DEF || resolution == LDPR_PREVAILING_DEF_IRONLY + || resolution == LDPR_PREVAILING_DEF_IRONLY_EXP || resolution == LDPR_PREEMPTED_REG || resolution == LDPR_PREEMPTED_IR || resolution == LDPR_RESOLVED_IR diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog index 7b0f3bc8b27..bf149e4b880 100644 --- a/lto-plugin/ChangeLog +++ b/lto-plugin/ChangeLog @@ -1,3 +1,10 @@ +2011-10-02 Jan Hubicka <jh@suse.cz> + + PR lto/47247 + * lto-plugin.c (get_symbols_v2): New variable. + (write_resolution): Use V2 API when available. + (onload): Handle LDPT_GET_SYMBOLS_V2. + 2011-09-30 H.J. Lu <hongjiu.lu@intel.com> Andi Kleen <ak@linux.intel.com> diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c index 9323bd201ed..d7a78136827 100644 --- a/lto-plugin/lto-plugin.c +++ b/lto-plugin/lto-plugin.c @@ -130,7 +130,7 @@ enum symbol_style static char *arguments_file_name; static ld_plugin_register_claim_file register_claim_file; static ld_plugin_register_all_symbols_read register_all_symbols_read; -static ld_plugin_get_symbols get_symbols; +static ld_plugin_get_symbols get_symbols, get_symbols_v2; static ld_plugin_register_cleanup register_cleanup; static ld_plugin_add_input_file add_input_file; static ld_plugin_add_input_library add_input_library; @@ -443,7 +443,12 @@ write_resolution (void) struct plugin_symtab *symtab = &info->symtab; struct ld_plugin_symbol *syms = symtab->syms; - get_symbols (info->handle, symtab->nsyms, syms); + /* Version 2 of API supports IRONLY_EXP resolution that is + accepted by GCC-4.7 and newer. */ + if (get_symbols_v2) + get_symbols_v2 (info->handle, symtab->nsyms, syms); + else + get_symbols (info->handle, symtab->nsyms, syms); finish_conflict_resolution (symtab, &info->conflicts); @@ -988,6 +993,9 @@ onload (struct ld_plugin_tv *tv) case LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK: register_all_symbols_read = p->tv_u.tv_register_all_symbols_read; break; + case LDPT_GET_SYMBOLS_V2: + get_symbols_v2 = p->tv_u.tv_get_symbols; + break; case LDPT_GET_SYMBOLS: get_symbols = p->tv_u.tv_get_symbols; break; |