aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2011-10-02 12:41:24 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2011-10-02 10:41:24 +0000
commited0d2da02b3189f014f027997e11e6dba5ad4761 (patch)
tree05d172b704e7c63048f3ef9b5fd618f3b89ee016 /gcc
parent96d7b15ff3ded45c424b1a240a7db64d3ae975e3 (diff)
downloadgcc-ed0d2da02b3189f014f027997e11e6dba5ad4761.zip
gcc-ed0d2da02b3189f014f027997e11e6dba5ad4761.tar.gz
gcc-ed0d2da02b3189f014f027997e11e6dba5ad4761.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/cgraph.c3
-rw-r--r--gcc/ipa.c2
-rw-r--r--gcc/lto-cgraph.c2
-rw-r--r--gcc/lto-symtab.c16
-rw-r--r--gcc/lto/ChangeLog6
-rw-r--r--gcc/lto/common.c5
-rw-r--r--gcc/lto/common.h5
-rw-r--r--gcc/varasm.c2
9 files changed, 43 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c6c8322..5373a31 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 14e7a3b..84d6bd5 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 9d54811..a8c4a35 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 0f1a8c5..9254b8f 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 3a7c783..68c6231 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 6ca8f5b..d3d7ffd 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 b54ec49..a23fdbb 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 e821847..6f9a692 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 9eb7295..9b4dfad 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