summaryrefslogtreecommitdiffstats
path: root/external
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@centrum.cz>2021-09-20 00:53:33 +0000
committerMichael Stahl <michael.stahl@allotropia.de>2021-09-21 10:24:53 +0200
commitafc221abb6e1895aa62abeca96c8b5043ddae63e (patch)
treea6393fd80b37d179265e619a0bb54daa0796bb21 /external
parentRevert "tdf#99492 sw layout: always paint merged cell grids" (diff)
downloadcore-afc221abb6e1895aa62abeca96c8b5043ddae63e.tar.gz
core-afc221abb6e1895aa62abeca96c8b5043ddae63e.zip
use clang-cl's -Zc:dllexportInlines- for Skia (tdf#144598)
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. As an additional effect, this disables emitting copies of inlines functions in every .o file where the function is called (even if inlined), which means that it hopefully avoids the problem of SkOpts_avx.cpp generating a copy of SkRect::round() which would include AVX code, and the linker might select this as the instance of SkRect::round() to keep, thus making SSE2 code call AVX code without checking for AVX availability first. Change-Id: I97541ae11d05f489894bc9233271eb21fd520f43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122335 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com> (cherry picked from commit 36f76223193fb96df7b8cbc1a1ff30f739857189) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122284 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'external')
-rw-r--r--external/skia/Library_skia.mk17
1 files changed, 17 insertions, 0 deletions
diff --git a/external/skia/Library_skia.mk b/external/skia/Library_skia.mk
index a1f1f1c30ef6..fbacc37b41fd 100644
--- a/external/skia/Library_skia.mk
+++ b/external/skia/Library_skia.mk
@@ -59,6 +59,17 @@ $(eval $(call gb_Library_use_system_win32_libs,skia,\
usp10 \
gdi32 \
))
+
+# cl.exe (and thus clang-cl) likes to emit copies of inline functions even when not needed,
+# which means that for e.g. AVX-compiled sources the .o may contain a copy of an inline
+# function built using AVX, and the linker may select that copy as the one to keep, thus
+# introducing AVX code into generic code. Avoid generating such inlines. The flag currently
+# cannot be used for the whole Skia, because code built without the flag cannot use
+# libraries built with the flag, so cl.exe-built VCL would have undefined references.
+ifeq ($(HAVE_LO_CLANG_DLLEXPORTINLINES),TRUE)
+LO_SKIA_AVOID_INLINE_COPIES := -Zc:dllexportInlines-
+endif
+
else
$(eval $(call gb_Library_use_externals,skia,\
freetype \
@@ -824,20 +835,25 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/opts/SkOpts_avx, $(CXXFLAGS_INTRINSICS_AVX) $(LO_CLANG_CXXFLAGS_INTRINSICS_AVX) \
+ $(LO_SKIA_AVOID_INLINE_COPIES) \
))
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/opts/SkOpts_hsw, \
$(CXXFLAGS_INTRINSICS_AVX2) $(CXXFLAGS_INTRINSICS_F16C) $(CXXFLAGS_INTRINSICS_FMA) \
$(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2) $(LO_CLANG_CXXFLAGS_INTRINSICS_F16C) $(LO_CLANG_CXXFLAGS_INTRINSICS_FMA) \
+ $(LO_SKIA_AVOID_INLINE_COPIES) \
))
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/opts/SkOpts_sse41, $(CXXFLAGS_INTRINSICS_SSE41) $(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41) \
+ $(LO_SKIA_AVOID_INLINE_COPIES) \
))
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/opts/SkOpts_sse42, $(CXXFLAGS_INTRINSICS_SSE42) $(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42) \
+ $(LO_SKIA_AVOID_INLINE_COPIES) \
))
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/opts/SkOpts_ssse3, $(CXXFLAGS_INTRINSICS_SSSE3) $(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3) \
+ $(LO_SKIA_AVOID_INLINE_COPIES) \
))
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/opts/SkOpts_crc32 \
@@ -845,6 +861,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,skia,\
$(eval $(call gb_Library_add_generated_exception_objects,skia,\
UnpackedTarball/skia/src/opts/SkOpts_skx, $(CXXFLAGS_INTRINSICS_AVX512) $(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)\
+ $(LO_SKIA_AVOID_INLINE_COPIES) \
))
$(eval $(call gb_Library_add_generated_exception_objects,skia,\