[cfe-dev] strange behavior when compile with -fvisibility-inlines-hidden flag

Weitian Leung via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 2 19:00:14 PST 2015


> https://gcc.gnu.org/wiki/Visibility says "However, 
> -fvisibility-inlines-hidden can be used with no source alterations, 
> unless you need to override it for inlines where address identity is 
> important either for the function itself *or any function local static 
> data.*" (Clearly this is somewhat bogus: if the addresses of function 
> local statics are different, their contents may also be different.)
> The behavior of this switch is not quite the same as marking the 
> methods as hidden directly, because it *does not affect static 
> variables local to the function* or cause the compiler to deduce that 
> the function is defined in only one shared object.

Thanks for your detailed explanation.

One more strange thing, remove the -fvisibility-inlines-hidden flag not 
works with some codes of our project.
I can't reproduce for a simple demo for now. Another flag we use is 
-fvisibility-ms-compat, before adding it for gcc, all works fine.
Now both gcc and clang are broken. (Since the counter code enables in 
debug build only, it's not so important for now)

I will remove -fvisibility-ms-compat rebuild with clang and test again.

-- 
/Regards/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151203/5371b553/attachment.html>


More information about the cfe-dev mailing list