summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-01-20 14:24:19 +0100
committerStephan Bergmann <sbergman@redhat.com>2021-01-20 22:17:35 +0100
commitdb1561f0510a179045ccea857f9386af83af729f (patch)
treede3b53461091f473dfbcf218bc21042c20cc4529
parent45dbc3023595edf50685776b1d803cdc2e5b0316 (diff)
Build compilerplugings code with -fvisibility-inlines-hidden
Even though `llvm-config --cxxflags` does not reflect it, LLVM generally uses -fvisibility-inlines-hidden on Unix-like platforms at least since <https: //github.com/llvm/llvm-project/commit/6b43f1f40f644b896f44078872c0b93ec3afef67> "[CMake] Support -fvisibility-inlines-hidden when LLVM_ENABLE_PIC=Off" debuting in release/3.8.x. 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 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--compilerplugins/Makefile-clang.mk2
1 files changed, 1 insertions, 1 deletions
diff --git a/compilerplugins/Makefile-clang.mk b/compilerplugins/Makefile-clang.mk
index 9d6b46019344..7d993433c030 100644
--- a/compilerplugins/Makefile-clang.mk
+++ b/compilerplugins/Makefile-clang.mk
@@ -26,7 +26,7 @@ else
CLANGCXXFLAGS+=/DEBUG /Od
endif
else # WNT
-CLANGCXXFLAGS=-Wall -Wextra -Wundef
+CLANGCXXFLAGS=-Wall -Wextra -Wundef -fvisibility-inlines-hidden
ifeq ($(CLANGDEBUG),)
CLANGCXXFLAGS+=-O2
else