diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 29 |
2 files changed, 22 insertions, 13 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5275eca..47f5308 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2010-05-22 Jan Hubicka <jh@suse.cz> + + * decl2.c (maybe_emit_vtables): Produce same comdat group when outputting + comdat vtables. + (cxx_callgraph_analyze_expr): Remove code marking vtables needed. + 2010-05-21 Joseph Myers <joseph@codesourcery.com> * cxx-pretty-print.c: Correct merge error. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 25c1175..2fd6305 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1808,6 +1808,7 @@ maybe_emit_vtables (tree ctype) tree vtbl; tree primary_vtbl; int needed = 0; + struct varpool_node *current = NULL, *last = NULL, *first = NULL; /* If the vtables for this class have already been emitted there is nothing more to do. */ @@ -1865,8 +1866,20 @@ maybe_emit_vtables (tree ctype) actually marking the variable as written. */ if (flag_syntax_only) TREE_ASM_WRITTEN (vtbl) = 1; + else if (DECL_COMDAT (vtbl)) + { + current = varpool_node (vtbl); + if (last) + last->same_comdat_group = current; + last = current; + if (!first) + first = current; + } } + if (first != last) + last->same_comdat_group = first; + /* Since we're writing out the vtable here, also write the debug info. */ note_debug_info_needed (ctype); @@ -3358,19 +3371,9 @@ cxx_callgraph_analyze_expr (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED) cgraph_mark_address_taken_node (cgraph_node (BASELINK_FUNCTIONS (t))); break; case VAR_DECL: - if (DECL_VTABLE_OR_VTT_P (t)) - { - /* The ABI requires that all virtual tables be emitted - whenever one of them is. */ - tree vtbl; - for (vtbl = CLASSTYPE_VTABLES (DECL_CONTEXT (t)); - vtbl; - vtbl = TREE_CHAIN (vtbl)) - mark_decl_referenced (vtbl); - } - else if (DECL_CONTEXT (t) - && flag_use_repository - && TREE_CODE (DECL_CONTEXT (t)) == FUNCTION_DECL) + if (DECL_CONTEXT (t) + && flag_use_repository + && TREE_CODE (DECL_CONTEXT (t)) == FUNCTION_DECL) /* If we need a static variable in a function, then we need the containing function. */ mark_decl_referenced (DECL_CONTEXT (t)); |