anonymous namespaces and local versus global symbol

Tom Kacvinsky tkacvins@gmail.com
Tue Nov 24 14:18:46 GMT 2020


I have a C++ method wrapped in a namespace.  What I have noticed is if
there is an anonymous namespace wrapped around the function, the mangled
name of the function
show as a local symbol when running nm on the shared library I produced.
If I get rid of
the anonymous namespace, the function shows as global.  I did try a
--verion-script to
make the symbol global, as well as use __attribute__((visibility("default")))
around the
function, but again the symbol showed as local, not global.

I can provide sample code if necessary.

Is this a binutils thing or a GCC thing?

If it's GCC related, sorry for mailing to the wrong list and I'll take it
up on the GCC list.

Thanks,

Tom


More information about the Binutils mailing list