This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: fix PR 31775, name mangling conflict between static and extern
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Geoffrey Keating <gkeating at apple dot com>
- Cc: gcc-patches at gcc dot gnu dot org, binutils at sourceware dot org, ian at airs dot com
- Date: Thu, 03 May 2007 20:37:01 -0700
- Subject: Re: fix PR 31775, name mangling conflict between static and extern
- References: <20070503010656.34D295FCBF86@geoffk5.apple.com>
Geoffrey Keating wrote:
> There's discussion of the problem in <http://gcc.gnu.org/PR31775>.
> 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
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713