summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@centrum.cz>2021-09-20 10:31:40 +0000
committerLuboš Luňák <l.lunak@collabora.com>2021-09-20 22:50:59 +0200
commitc7c9f3f57a2feae5d3bc3c47104786883ed09e44 (patch)
treeafd53d5339e7266b1f3399094354566c64f34b0d
parent36f76223193fb96df7b8cbc1a1ff30f739857189 (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>
-rw-r--r--config_host.mk.in1
-rw-r--r--configure.ac15
-rw-r--r--cppu/Library_cppu.mk2
-rw-r--r--cppu/Library_purpenvhelper.mk2
-rw-r--r--cppuhelper/Library_cppuhelper.mk2
-rw-r--r--sal/Library_sal.mk2
-rw-r--r--salhelper/Library_salhelper.mk2
-rw-r--r--solenv/gbuild/Library.mk1
-rw-r--r--solenv/gbuild/LinkTarget.mk11
-rw-r--r--solenv/gbuild/platform/com_MSC_class.mk5
-rw-r--r--solenv/gbuild/platform/com_MSC_defs.mk4
11 files changed, 45 insertions, 2 deletions
diff --git a/config_host.mk.in b/config_host.mk.in
index 3aa51a3d638f..6ee6ad45f00f 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -266,6 +266,7 @@ export HAMCREST_JAR=@HAMCREST_JAR@
export HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=@HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED@
export HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=@HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW@
export HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=@HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR@
+export HAVE_DLLEXPORTINLINES=@HAVE_DLLEXPORTINLINES@
export HAVE_LO_CLANG_DLLEXPORTINLINES=@HAVE_LO_CLANG_DLLEXPORTINLINES@
export HAVE_GCC_AVX=@HAVE_GCC_AVX@
export HAVE_GCC_BUILTIN_ATOMIC=@HAVE_GCC_BUILTIN_ATOMIC@
diff --git a/configure.ac b/configure.ac
index fde9600bab27..e592f6da8ce5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7599,6 +7599,21 @@ if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
fi
AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
+HAVE_DLLEXPORTINLINES=
+if test "$_os" = "WINNT"; then
+ AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
+ AC_LANG_PUSH([C++])
+ save_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
+ HAVE_DLLEXPORTINLINES=TRUE
+ AC_MSG_RESULT([yes])
+ ], [AC_MSG_RESULT([no])])
+ CXXFLAGS=$save_CXXFLAGS
+ AC_LANG_POP([C++])
+fi
+AC_SUBST([HAVE_DLLEXPORTINLINES])
+
dnl ===================================================================
dnl CPU Intrinsics support - SSE, AVX
dnl ===================================================================
diff --git a/cppu/Library_cppu.mk b/cppu/Library_cppu.mk
index 8031487af373..7158c2bb80e0 100644
--- a/cppu/Library_cppu.mk
+++ b/cppu/Library_cppu.mk
@@ -14,6 +14,8 @@ $(eval $(call gb_Library_set_soversion_script,cppu,$(SRCDIR)/cppu/util/cppu.map)
$(eval $(call gb_Library_use_udk_api,cppu))
+$(eval $(call gb_Library_set_is_ure_library,cppu))
+
$(eval $(call gb_Library_add_defs,cppu,\
-DCPPU_DLLIMPLEMENTATION \
))
diff --git a/cppu/Library_purpenvhelper.mk b/cppu/Library_purpenvhelper.mk
index 42c03749a4b7..404a8dc23d74 100644
--- a/cppu/Library_purpenvhelper.mk
+++ b/cppu/Library_purpenvhelper.mk
@@ -16,6 +16,8 @@ $(eval $(call gb_Library_add_defs,purpenvhelper,\
-DPURPENV_DLLIMPLEMENTATION \
))
+$(eval $(call gb_Library_set_is_ure_library,purpenvhelper))
+
$(eval $(call gb_Library_use_udk_api,purpenvhelper))
$(eval $(call gb_Library_use_libraries,purpenvhelper,\
diff --git a/cppuhelper/Library_cppuhelper.mk b/cppuhelper/Library_cppuhelper.mk
index 5741eea6476f..3c87054b45ab 100644
--- a/cppuhelper/Library_cppuhelper.mk
+++ b/cppuhelper/Library_cppuhelper.mk
@@ -18,6 +18,8 @@ $(eval $(call gb_Library_use_internal_comprehensive_api,cppuhelper,\
offapi \
))
+$(eval $(call gb_Library_set_is_ure_library,cppuhelper))
+
$(eval $(call gb_Library_add_defs,cppuhelper,\
-DCPPUHELPER_DLLIMPLEMENTATION \
))
diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk
index d783c84e39e9..f7c7b3ab1764 100644
--- a/sal/Library_sal.mk
+++ b/sal/Library_sal.mk
@@ -14,6 +14,8 @@ $(eval $(call gb_Library_set_soversion_script,sal,$(SRCDIR)/sal/util/sal.map))
$(eval $(call gb_Library_set_precompiled_header,sal,sal/inc/pch/precompiled_sal))
+$(eval $(call gb_Library_set_is_ure_library,sal))
+
$(eval $(call gb_Library_set_include,sal,\
$$(INCLUDE) \
-I$(SRCDIR)/sal/inc \
diff --git a/salhelper/Library_salhelper.mk b/salhelper/Library_salhelper.mk
index a97666dafe2f..287c215158b5 100644
--- a/salhelper/Library_salhelper.mk
+++ b/salhelper/Library_salhelper.mk
@@ -14,6 +14,8 @@ $(eval $(call gb_Library_add_defs,salhelper,\
-DSALHELPER_DLLIMPLEMENTATION \
))
+$(eval $(call gb_Library_set_is_ure_library,salhelper))
+
$(eval $(call gb_Library_use_libraries,salhelper,\
sal \
))
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