===================================================================
@@ -2487,7 +2487,7 @@ cgraph_make_decl_local (tree decl)
DECL_COMMON (decl) = 0;
else gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
- if (DECL_COMDAT (decl))
+ if (DECL_ONE_ONLY (decl) || DECL_COMDAT (decl))
{
/* It is possible that we are linking against library defining same COMDAT
function. To avoid conflict we need to rename our local name of the
===================================================================
@@ -830,9 +830,9 @@ cgraph_analyze_function (struct cgraph_n
if (TREE_PUBLIC (node->decl) && node->same_body_alias)
{
DECL_EXTERNAL (node->decl) = DECL_EXTERNAL (node->thunk.alias);
- if (DECL_COMDAT (node->thunk.alias))
+ if (DECL_ONE_ONLY (node->thunk.alias))
{
- DECL_COMDAT (node->decl) = 1;
+ DECL_COMDAT (node->decl) = DECL_COMDAT (node->thunk.alias);
DECL_COMDAT_GROUP (node->decl) = DECL_COMDAT_GROUP (node->thunk.alias);
if (DECL_ONE_ONLY (node->thunk.alias) && !node->same_comdat_group)
{
===================================================================
@@ -904,9 +904,9 @@ function_and_variable_visibility (bool w
We also need to arrange the thunk into the same comdat group as
the function it reffers to. */
- if (DECL_COMDAT (decl_node->decl))
+ if (DECL_ONE_ONLY (decl_node->decl))
{
- DECL_COMDAT (node->decl) = 1;
+ DECL_COMDAT (node->decl) = DECL_COMDAT (decl_node->decl);
DECL_COMDAT_GROUP (node->decl) = DECL_COMDAT_GROUP (decl_node->decl);
if (DECL_ONE_ONLY (decl_node->decl) && !node->same_comdat_group)
{