summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config_host.mk.in1
-rw-r--r--configure.ac1
-rw-r--r--external/libpng/StaticLibrary_libpng.mk15
-rw-r--r--solenv/gbuild/LinkTarget.mk2
-rw-r--r--solenv/gbuild/platform/android.mk2
-rw-r--r--solenv/gbuild/platform/com_GCC_defs.mk4
-rw-r--r--solenv/gbuild/platform/com_MSC_class.mk2
-rw-r--r--solenv/gbuild/platform/iOS.mk2
-rw-r--r--solenv/gbuild/platform/macosx.mk2
-rw-r--r--solenv/gbuild/platform/solaris.mk2
-rw-r--r--solenv/gbuild/platform/unxgcc.mk4
11 files changed, 26 insertions, 11 deletions
diff --git a/config_host.mk.in b/config_host.mk.in
index 00288ccb6968..d62afe8e796f 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -76,6 +76,7 @@ export CLANG_CXXFLAGS_INTRINSICS_AVX=@CLANG_CXXFLAGS_INTRINSICS_AVX@
export CLANG_CXXFLAGS_INTRINSICS_AVX2=@CLANG_CXXFLAGS_INTRINSICS_AVX2@
export CLANG_CXXFLAGS_INTRINSICS_F16C=@CLANG_CXXFLAGS_INTRINSICS_F16C@
export CLANG_CXXFLAGS_INTRINSICS_FMA=@CLANG_CXXFLAGS_INTRINSICS_FMA@
+export CLANG_USE_LD=@CLANG_USE_LD@
export CLANGDIR=@CLANGDIR@
export CLANGLIBDIR=@CLANGLIBDIR@
export CLANGSYSINCLUDE=@CLANGSYSINCLUDE@
diff --git a/configure.ac b/configure.ac
index dbf13a875ab8..71c395b792e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11500,6 +11500,7 @@ AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX2)
AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_AVX512)
AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_F16C)
AC_SUBST(CLANG_CXXFLAGS_INTRINSICS_FMA)
+AC_SUBST(CLANG_USE_LD)
SYSTEM_GPGMEPP=
diff --git a/external/libpng/StaticLibrary_libpng.mk b/external/libpng/StaticLibrary_libpng.mk
index 2d56a276f6a7..8abfdec063db 100644
--- a/external/libpng/StaticLibrary_libpng.mk
+++ b/external/libpng/StaticLibrary_libpng.mk
@@ -44,4 +44,19 @@ $(eval $(call gb_StaticLibrary_add_generated_cobjects,libpng,\
) \
))
+# At least on Linux, with --enable-lto, when building both this external/libpng and external/skia,
+# and building with GCC but building skia with Clang (which should be the sole combination that
+# matches "CLANG_CC is non-empty"), build this as a fat archive (including both the intermediate GCC
+# object code for LTO and machine object code). Besides targets like Library_vcl (which benefit
+# from the intermediate GCC object code for LTO), also Library_skia (built with the Clang toolchain
+# lld, which does not understand intermediate GCC object code) includes this, so would otherwise
+# fail to link (but now does not benefit from LTO for this included StaticLibrary_libpng):
+ifeq ($(OS)-$(ENABLE_LTO),LINUX-TRUE)
+ifneq ($(filter SKIA,$(BUILD_TYPE)),)
+ifneq ($(CLANG_CC),)
+$(eval $(call gb_StaticLibrary_add_cflags,libpng,-ffat-lto-objects))
+endif
+endif
+endif
+
# vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index a18d0a67b1da..98c88a74616b 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -833,6 +833,7 @@ $(call gb_LinkTarget_get_target,$(1)) : COMPILER_TEST :=
$(call gb_LinkTarget_get_target,$(1)) : T_SYMBOLS := $(if $(call gb_LinkTarget__symbols_enabled,$(2)),$(true),$(false))
$(call gb_LinkTarget_get_target,$(1)) : T_CC :=
$(call gb_LinkTarget_get_target,$(1)) : T_CXX :=
+$(call gb_LinkTarget_get_target,$(1)) : T_USE_LD := $(USE_LD)
ifeq ($(gb_FULLDEPS),$(true))
ifeq (depcache:,$(filter depcache,$(.FEATURES)):$(gb_PARTIAL_BUILD))
@@ -1784,6 +1785,7 @@ endef
define gb_LinkTarget_use_clang
$(call gb_LinkTarget_get_target,$(1)) : T_CC := $(CLANG_CC)
$(call gb_LinkTarget_get_target,$(1)) : T_CXX := $(CLANG_CXX)
+$(call gb_LinkTarget_get_target,$(1)) : T_USE_LD := $(or $(CLANG_USE_LD),$(USE_LD))
endef
diff --git a/solenv/gbuild/platform/android.mk b/solenv/gbuild/platform/android.mk
index 9205e32885e1..d6f4ce42024b 100644
--- a/solenv/gbuild/platform/android.mk
+++ b/solenv/gbuild/platform/android.mk
@@ -32,7 +32,7 @@ $(call gb_Helper_abbreviate_dirs,\
-shared \
$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
$(subst \d,$$,$(RPATH)) \
- $(T_LDFLAGS) \
+ $(T_USE_LD) $(T_LDFLAGS) \
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 42d8eefff7fd..0480b0fc3fd5 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -37,10 +37,6 @@ endif
# shell setup (env.vars) for the compiler
gb_COMPILER_SETUP :=
-ifneq ($(USE_LD),)
-gb_LinkTarget_LDFLAGS += $(USE_LD)
-endif
-
ifeq ($(strip $(gb_COMPILEROPTFLAGS)),)
gb_COMPILEROPTFLAGS := -O2
endif
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index b9bde52cdc01..e184a656f0b4 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -228,7 +228,7 @@ $(call gb_Helper_abbreviate_dirs,\
-LIBPATH:$(WINDOWS_SDK_HOME)/lib/x86 \
-LIBPATH:$(UCRTSDKDIR)lib/$(UCRTVERSION)/ucrt/x86 \
$(if $(filter 80 81 10,$(WINDOWS_SDK_VERSION)),-LIBPATH:$(WINDOWS_SDK_HOME)/lib/$(WINDOWS_SDK_LIB_SUBDIR)/um/x86)) \
- $(T_LDFLAGS) \
+ $(T_USE_LD) $(T_LDFLAGS) \
$(if $(filter Library CppunitTest Executable,$(TARGETTYPE)),/NATVIS:$(SRCDIR)/solenv/vs/LibreOffice.natvis) \
@$${RESPONSEFILE} \
$(foreach lib,$(sort $(LINKED_LIBS)),$(call gb_Library_get_ilibfilename,$(lib))) \
diff --git a/solenv/gbuild/platform/iOS.mk b/solenv/gbuild/platform/iOS.mk
index dc7d2a8c25d8..6ef7994202e0 100644
--- a/solenv/gbuild/platform/iOS.mk
+++ b/solenv/gbuild/platform/iOS.mk
@@ -88,7 +88,7 @@ define gb_LinkTarget__command_dynamiclink
$(if $(CXXOBJECTS)$(OBJCXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS),$(gb_CXX),$(gb_CC)) \
$(gb_Executable_TARGETTYPEFLAGS) \
$(subst \d,$$,$(RPATH)) \
- $(T_LDFLAGS) \
+ $(T_USE_LD) $(T_LDFLAGS) \
-dead_strip \
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index c743511207ce..431f8e4b45fc 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -115,7 +115,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(if $(filter Bundle,$(TARGETTYPE)),$(gb_Bundle_TARGETTYPEFLAGS)) \
$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
$(subst \d,$$,$(RPATH)) \
- $(T_LDFLAGS) \
+ $(T_USE_LD) $(T_LDFLAGS) \
$(patsubst lib%.dylib,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib))))) \
-Wl$(COMMA)-filelist$(COMMA)$${FILELIST} \
$(T_LIBS) \
diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk
index d1d068c8fd22..686b082a5cf5 100644
--- a/solenv/gbuild/platform/solaris.mk
+++ b/solenv/gbuild/platform/solaris.mk
@@ -116,7 +116,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(if $(SOVERSIONSCRIPT),-Wl$(COMMA)-soname=$(notdir $(1)) \
) \
$(subst \d,$$,$(RPATH)) \
- $(T_LDFLAGS) \
+ $(T_USE_LD) $(T_LDFLAGS) \
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 6abfb75da4b7..ac6252636fd8 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -115,13 +115,13 @@ gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS)
# contains .c sources:
define gb_LinkTarget__command_dynamiclink
$(call gb_Helper_abbreviate_dirs,\
- $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)),$(gb_CXX) $(gb_CXX_LINKFLAGS),$(gb_CC)) \
+ $(if $(CXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS)$(filter-out XTRUE,X$(ENABLE_RUNTIME_OPTIMIZATIONS)),$(or $(T_CXX),$(gb_CXX)) $(gb_CXX_LINKFLAGS),$(or $(T_CC),$(gb_CC))) \
$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
$(gb_LTOFLAGS) \
$(if $(SOVERSIONSCRIPT),-Wl$(COMMA)--soname=$(notdir $(1)) \
-Wl$(COMMA)--version-script=$(SOVERSIONSCRIPT)) \
$(subst \d,$$,$(RPATH)) \
- $(T_LDFLAGS) \
+ $(T_USE_LD) $(T_LDFLAGS) \
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \