diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-05 10:20:38 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-05-05 10:20:38 +0000 |
commit | 9269f553b79686bf43ac51b8e77a6700c3b95740 (patch) | |
tree | 23be9470e7d518f344bb998e7a7e5dfa9aaf2fb8 /gcc | |
parent | e3b362c85fbe31877b2a1bb59c422145998128b6 (diff) | |
download | gcc-9269f553b79686bf43ac51b8e77a6700c3b95740.tar.gz |
* lto-symtab.c (lto_symtab_resolve_can_prevail_p): Alias of variable
with body can prevail.
* lto-symtab.c (lto_symtab_merge_decls_1): Prefer declarations with
size.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159061 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/lto-symtab.c | 26 |
2 files changed, 32 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 12bc380fa40..7f2f32a074b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2010-05-05 Jan Hubicka <jh@suse.cz> + + * lto-symtab.c (lto_symtab_resolve_can_prevail_p): Alias of variable + with body can prevail. + +2010-05-05 Jan Hubicka <jh@suse.cz> + + * lto-symtab.c (lto_symtab_merge_decls_1): Prefer declarations with + size. + 2010-05-05 Laurynas Biveinis <laurynas.biveinis@gmail.com> * Makefile.in (build/gengtype.o): Add $(HASHTAB_H) to diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index bd7022b31fd..c9ec62e45fa 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -416,7 +416,13 @@ lto_symtab_resolve_can_prevail_p (lto_symtab_entry_t e) /* A variable should have a size. */ else if (TREE_CODE (e->decl) == VAR_DECL) - return (e->vnode && e->vnode->finalized); + { + if (!e->vnode) + return false; + if (e->vnode->finalized) + return true; + return e->vnode->alias && e->vnode->extra_name->finalized; + } gcc_unreachable (); } @@ -590,10 +596,22 @@ lto_symtab_merge_decls_1 (void **slot, void *data ATTRIBUTE_UNUSED) while (!prevailing->node && prevailing->next) prevailing = prevailing->next; + /* For variables chose with a priority variant with vnode + attached (i.e. from unit where external declaration of + variable is actually used). + When there are multiple variants, chose one with size. + This is needed for C++ typeinfos, for example in + lto/20081204-1 there are typeifos in both units, just + one of them do have size. */ if (TREE_CODE (prevailing->decl) == VAR_DECL) - while (!prevailing->vnode - && prevailing->next) - prevailing = prevailing->next; + { + for (e = prevailing->next; e; e = e->next) + if ((!prevailing->vnode && e->vnode) + || ((prevailing->vnode != NULL) == (e->vnode != NULL) + && !COMPLETE_TYPE_P (TREE_TYPE (prevailing->decl)) + && COMPLETE_TYPE_P (TREE_TYPE (e->decl)))) + prevailing = e; + } } /* Move it first in the list. */ |