fix PR 31775, name mangling conflict between static and extern

Mark Mitchell
Fri May 4 03:36:00 GMT 2007

Geoffrey Keating wrote:
> There's discussion of the problem in <>.
> Basically, mangled names of objects and functions with internal
> linkage need to be different to mangled names of those with external
> linkage, because it's possible to refer to both within the same
> translation unit.

> Mark, Ian, you had comments about a previous version of the libiberty
> part of this patch.  Mark, do you still object?

No, I do not object to the patch in principle.  Thank you for asking.

I do think that it would be better to use decl_linkage than TREE_PUBLIC
in code like:

-	   /* The names of global variables aren't mangled.  */
+	   && TREE_PUBLIC (decl)

That's clearer, because TREE_PUBLIC is an implementation detail, whereas
decl_linkage is a property of the declaration specified by the standard.
  Here, you want to mangle things with internal linkage differently, but
you wouldn't want to mangle something with external linkage that ended
up not being TREE_PUBLIC, like an extern inline function whose address
was not taken, if we decided to give that internal linkage.

Mark Mitchell
(650) 331-3385 x713

More information about the Gcc-patches mailing list