[Libreoffice-commits] core.git: compilerplugins/Makefile-clang.mk

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 20 21:18:15 UTC 2021


 compilerplugins/Makefile-clang.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit db1561f0510a179045ccea857f9386af83af729f
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Jan 20 14:24:19 2021 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Jan 20 22:17:35 2021 +0100

    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 at redhat.com>

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


More information about the Libreoffice-commits mailing list