diff options
author | Luboš Luňák <l.lunak@centrum.cz> | 2021-09-20 10:31:40 +0000 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-09-20 22:50:59 +0200 |
commit | c7c9f3f57a2feae5d3bc3c47104786883ed09e44 (patch) | |
tree | afd53d5339e7266b1f3399094354566c64f34b0d /solenv | |
parent | 36f76223193fb96df7b8cbc1a1ff30f739857189 (diff) |
use clang-cl's -Zc:dllexportInlines- for clang-cl builds
This is clang-cl's equivalent of -fvisibility-inlines-hidden,
and it seems to be also sort of the equivalent of MSVC's
-Zc:inline. So it saves build time and disk space.
Clang docs say that this is binary compatible in only one
direction, so our public C++ code shouldn't be using this,
as external C++ code could try to use exported inlines
that are no longer there.
Change-Id: Ie6217808f8ee4a15344183abfc65038e1558d1b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122352
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/gbuild/Library.mk | 1 | ||||
-rw-r--r-- | solenv/gbuild/LinkTarget.mk | 11 | ||||
-rw-r--r-- | solenv/gbuild/platform/com_MSC_class.mk | 5 | ||||
-rw-r--r-- | solenv/gbuild/platform/com_MSC_defs.mk | 4 |
4 files changed, 19 insertions, 2 deletions
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk index a4f1fe7b376a..6562cbf41d34 100644 --- a/solenv/gbuild/Library.mk +++ b/solenv/gbuild/Library.mk @@ -252,5 +252,6 @@ gb_Library_use_clang = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$ gb_Library_set_clang_precompiled_header = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_Library_use_glxtest = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3)) gb_Library_use_vclmain = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3)) +gb_Library_set_is_ure_library = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3)) # vim: set noet sw=4: diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk index 9c7e9e3bceaf..29924c9897e0 100644 --- a/solenv/gbuild/LinkTarget.mk +++ b/solenv/gbuild/LinkTarget.mk @@ -2010,4 +2010,15 @@ $(call gb_LinkTarget_use_static_libraries,$(1),vclmain) endef # gb_LinkTarget_use_vclmain +# Used by URE libraries that need to keep binary compatibility. +# Reset some flags that make sense for our internal libraries but might +# break public ABI. +# call gb_LinkTarget_set_is_ure_library,linktarget,,linktargetmakefilename +define gb_LinkTarget_set_is_ure_library +ifeq ($(HAVE_DLLEXPORTINLINES),TRUE) +$(call gb_LinkTarget_add_cxxflags,$(1),-Zc:dllexportInlines) +endif + +endef + # vim: set noet sw=4: diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk index 0d35b7915999..80944fe70ba4 100644 --- a/solenv/gbuild/platform/com_MSC_class.mk +++ b/solenv/gbuild/platform/com_MSC_class.mk @@ -48,9 +48,10 @@ endef # Avoid annoying warning D9025 about overriding command-line arguments. gb_Helper_remove_overridden_flags = \ $(lastword $(filter -W4 -w,$(1))) \ - $(filter-out -W4 -w -arch:SSE -arch:SSE2 -arch:AVX -arch:AVX2 -Od -O2,$(1)) \ + $(filter-out -W4 -w -arch:SSE -arch:SSE2 -arch:AVX -arch:AVX2 -Od -O2 -Zc:dllexportInlines -Zc:dllexportInlines-,$(1)) \ $(lastword $(filter -Od -O2,$(1))) \ - $(lastword $(filter -arch:SSE -arch:SSE2 -arch:AVX -arch:AVX2,$(1))) + $(lastword $(filter -arch:SSE -arch:SSE2 -arch:AVX -arch:AVX2,$(1))) \ + $(lastword $(filter -Zc:dllexportInlines -Zc:dllexportInlines-,$(1))) # $(call gb_CObject__command_pattern,object,flags,source,dep-file,compiler-plugins,symbols,compiler) define gb_CObject__command_pattern diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk index 07720dc2e2f1..273e17ea71f0 100644 --- a/solenv/gbuild/platform/com_MSC_defs.mk +++ b/solenv/gbuild/platform/com_MSC_defs.mk @@ -158,6 +158,10 @@ gb_CFLAGS += \ endif +ifeq ($(HAVE_DLLEXPORTINLINES),TRUE) +gb_CXXFLAGS += -Zc:dllexportInlines- +endif + ifneq ($(COM_IS_CLANG),TRUE) # clang-cl doesn't support -Wv:18 for now |