re PR lto/47247 (Linker plugin specification makes it difficult to handle COMDATs)
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. From-SVN: r179424
This commit is contained in:
parent
96d7b15ff3
commit
ed0d2da02b
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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. */
|
||||
|
@ -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)
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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",
|
||||
};
|
||||
|
||||
|
@ -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",
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user