Even though `llvm-config --cxxflags` does not reflect it, LLVM generally uses-fvisibility-inlines-hidden on Unix-like platforms at least since
At least with my build on macOS 11.1 ARM64 against recent LLVM 12 trunk, that caused a mismatch between
> $ nm -m compilerplugins/clang/sharedvisitor/analyzer.o | grep __ZGVZNK5clang24TemplateTemplateParmDecl18getDefaultArgumentEvE7NoneLoc > 0000000000028038 (__DATA,__data) weak external __ZGVZNK5clang24TemplateTemplateParmDecl18getDefaultArgumentEvE7NoneLoc
and
> $ nm -m ~/llvm/inst/lib/libclangAST.a\(JSONNodeDumper.cpp.o\) | grep __ZGVZNK5clang24TemplateTemplateParmDecl18getDefaultArgumentEvE7NoneLoc > 000000000001ccf0 (__DATA,__data) weak private external __ZGVZNK5clang24TemplateTemplateParmDecl18getDefaultArgumentEvE7NoneLoc
etc., causing (albeit harmless) warnings
> [GEN] compilerplugins/clang/sharedvisitor/analyzer > ld: warning: direct access in function 'clang::JSONNodeDumper::VisitTemplateTemplateParmDecl(clang::TemplateTemplateParmDecl const*)' from file '~/llvm/inst/lib/libclangAST.a(JSONNodeDumper.cpp.o)' to global weak symbol 'guard variable for clang::TemplateTemplateParmDecl::getDefaultArgument() const::NoneLoc' from file 'compilerplugins/clang/sharedvisitor/analyzer.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. [...]
-fvisibility-inline-hidden is presumably supported by all $(COMPILER_PLUGINS_CXX) used on non-Windows platforms in the wild, so lets be bold and add it unconditionally.
Change-Id: I0d405b4f57066baa098977e65e5ba4a3a47575c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109712
db1561f0510a Build compilerplugings code with -fvisibility-inlines-hidden
compilerplugins/Makefile-clang.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Upstream: cgit.freedesktop.org