diff options
author | Bingfeng Mei <bmei@broadcom.com> | 2010-06-28 10:39:38 +0000 |
---|---|---|
committer | Bingfeng Mei <meibf@gcc.gnu.org> | 2010-06-28 10:39:38 +0000 |
commit | 6d41cd02387ab457b69206742af9edb8977f725d (patch) | |
tree | fcb4698113cc298ba8c467ab738e7c19bf245308 /gcc/lto-symtab.c | |
parent | 7802ca7cfd7f45af71b05ae3857be516d9a9d558 (diff) | |
download | gcc-6d41cd02387ab457b69206742af9edb8977f725d.zip gcc-6d41cd02387ab457b69206742af9edb8977f725d.tar.gz gcc-6d41cd02387ab457b69206742af9edb8977f725d.tar.bz2 |
cgraph.h (struct varpool_node): new used_from_object_file flag.
2010-06-28 Bingfeng Mei <bmei@broadcom.com>
* cgraph.h (struct varpool_node): new used_from_object_file flag.
(struct cgraph_local_info): new used_from_object_file flag.
* cgraph.c (dump_cgraph_node): dump used_from_object_file flag.
(cgraph_clone_node): initialize used_from_object_file.
(cgraph_create_virtual_clone): initialize used_from_object_file.
* lto-symbtab.c (lto_symtab_merge_decls_1): Set
used_from_object_file flags for symbols of LDPR_PREVAILING_DEF
when compiling with -fwhole-program.
(lto_symtab_resolve_symbols) Use LDPR_PREVAILING_DEF_IRONLY for
internal resolver.
* ipa.c (function_and_variable_visibility): Set externally_visible
flag of varpool_node if used_from_object_file flag is set.
(cgraph_externally_visible_p): check used_from_object_file flag.
* doc/invoke.texi (-fwhole-program option): Change description of
externally_visible attribute accordingly.
* doc/extend.texi (externally_visible): Ditto.
From-SVN: r161483
Diffstat (limited to 'gcc/lto-symtab.c')
-rw-r--r-- | gcc/lto-symtab.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index 6f46a73..e94bc20 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -530,11 +530,20 @@ lto_symtab_resolve_symbols (void **slot) return; found: - if (TREE_CODE (prevailing->decl) == VAR_DECL - && TREE_READONLY (prevailing->decl)) + /* If current lto files represent the whole program, + it is correct to use LDPR_PREVALING_DEF_IRONLY. + If current lto files are part of whole program, internal + resolver doesn't know if it is LDPR_PREVAILING_DEF + or LDPR_PREVAILING_DEF_IRONLY. Use IRONLY conforms to + using -fwhole-program. Otherwise, it doesn't + matter using either LDPR_PREVAILING_DEF or + LDPR_PREVAILING_DEF_IRONLY + + FIXME: above workaround due to gold plugin makes some + variables IRONLY, which are indeed PREVAILING_DEF in + resolution file. These variables still need manual + externally_visible attribute. */ prevailing->resolution = LDPR_PREVAILING_DEF_IRONLY; - else - prevailing->resolution = LDPR_PREVAILING_DEF; } /* Merge all decls in the symbol table chain to the prevailing decl and @@ -698,6 +707,24 @@ lto_symtab_merge_decls_1 (void **slot, void *data ATTRIBUTE_UNUSED) && TREE_CODE (prevailing->decl) != VAR_DECL) prevailing->next = NULL; + /* Set externally_visible flags for declaration of LDPR_PREVAILING_DEF */ + if (flag_whole_program) + { + if (prevailing->resolution == LDPR_PREVAILING_DEF) + { + if (TREE_CODE (prevailing->decl) == FUNCTION_DECL) + prevailing->node->local.used_from_object_file = true; + else + prevailing->vnode->used_from_object_file = true; + } + else if (prevailing->resolution == LDPR_PREVAILING_DEF_IRONLY) + { + if (TREE_CODE (prevailing->decl) == FUNCTION_DECL) + prevailing->node->local.used_from_object_file = false; + else + prevailing->vnode->used_from_object_file = false; + } + } return 1; } |