diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-08-11 20:26:56 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-08-12 06:09:49 +0200 |
commit | a42eefab8629c998ec0f1351075888b95b039ec1 (patch) | |
tree | acec91db57a20ef2606df20a0928f6ea5ce680e7 /external | |
parent | 986bd8b93b35ad7f2760dfe0576860532daa0e42 (diff) |
Enable --enable-lto --enable-skia when building with GCC+Clang on Linux
...where all the Library_skia objects are built with Clang, so contain
intermediate LLVM bytecode, but were then linked via GCC and ld or gold, which
do not understand such object files and thus failed. So in
gb_LinkTarget__command_dynamiclink use T_CC/T_CXX also for the linker command
line. But then Clang would still be used for linking with the
-fuse-ld=(ld or gold)
$(USE_LD) suitable for GCC, and would still fail. So break T_USE_LD out of
T_LDFLAGS and let gb_LinkTarget_use_clang override T_USE_LD with CLANG_USE_LD.
At least for now, that CLANG_USE_LD (containing something like
-fuse-ld=lld
or
-fuse-ld=lld --ld-path=...
for the latter see d668c9a04d04d256fcbbd2165fe226f1db88256b "Adapt --enable-ld
to Clang 12 trunk --ld-path") needs to manually be passed into autogen.sh, it is
not computed in configure.ac.
Then building Library_skia would still fail to link against
StaticLibrary_libpng, as that only contains intermediate GCC object code, so
make sure to build it with -ffat-lto-objects in this specific case.
Change-Id: I0a104e53a8898cd9c2eb3b643e21954e853608cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100556
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/libpng/StaticLibrary_libpng.mk | 15 |
1 files changed, 15 insertions, 0 deletions
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: |