--- gcc/c-decl.c~ 2006-01-19 23:48:07.000000000 +0000 +++ gcc/c-decl.c 2006-08-15 21:43:43.000000000 +0100 @@ -1660,6 +1660,25 @@ merge_decls (tree newdecl, tree olddecl, if (TREE_DEPRECATED (newdecl)) TREE_DEPRECATED (olddecl) = 1; + if (TREE_CODE (newdecl) == FUNCTION_DECL) + { + struct cgraph_node *n = cgraph_node (newdecl); + if (n->local.externally_visible) + { + struct cgraph_node *o = cgraph_node (olddecl); + o->local.externally_visible = 1; + } + } + else if (TREE_CODE (newdecl) == VAR_DECL) + { + struct cgraph_varpool_node *n = cgraph_varpool_node (newdecl); + if (n->externally_visible) + { + struct cgraph_varpool_node *o = cgraph_varpool_node (olddecl); + o->externally_visible = true; + } + } + /* Keep source location of definition rather than declaration and of prototype rather than non-prototype unless that prototype is built-in. */