[Libreoffice-commits] core.git: configure.ac solenv/gbuild

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 24 20:37:06 UTC 2020


 configure.ac                           |   17 ++++-------------
 solenv/gbuild/platform/com_GCC_defs.mk |    4 ++++
 2 files changed, 8 insertions(+), 13 deletions(-)

New commits:
commit 03d5167455a5cbadfad9a2d5989574b1d1929857
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Sep 24 19:42:14 2020 +0100
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Sep 24 22:36:22 2020 +0200

    Use -flto=thin in gb_LTOFLAGS for Apple's Clang (for macOS and iOS)
    
    Don't add any LTO flags into $CC and $CXX as we don't do that for
    other platforms either. But maybe we should? Currently, with the
    separate gb_LTOFLAGS, we have to handle each external project
    separately to make it build with LTO.
    
    Change-Id: I9761426585ebdfd976c74168218bd26bcc0e8517
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103351
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/configure.ac b/configure.ac
index 11f1bc87e4ae..1ea6b255bb23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3001,9 +3001,6 @@ if test $_os = Darwin; then
     INSTALL_NAME_TOOL=install_name_tool
     if test -z "$save_CC"; then
         stdlib=-stdlib=libc++
-        if test "$ENABLE_LTO" = TRUE; then
-            lto=-flto
-        fi
 
         AC_MSG_CHECKING([what C compiler to use])
         CC="`xcrun -find clang`"
@@ -3013,7 +3010,7 @@ if test $_os = Darwin; then
         else
             CC+=" -target arm64-apple-macos"
         fi
-        CC+=" $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
+        CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
         AC_MSG_RESULT([$CC])
 
         AC_MSG_CHECKING([what C++ compiler to use])
@@ -3024,7 +3021,7 @@ if test $_os = Darwin; then
         else
             CXX+=" -target arm64-apple-macos"
         fi
-        CXX+=" $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
+        CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
         AC_MSG_RESULT([$CXX])
 
         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
@@ -3193,24 +3190,18 @@ if test $_os = iOS; then
 
     AC_MSG_RESULT($sysroot)
 
-    # LTO is not really recommended for iOS builds,
-    # the link time will be astronomical
-    if test "$ENABLE_LTO" = TRUE; then
-        lto=-flto
-    fi
-
     stdlib="-stdlib=libc++"
 
     AC_MSG_CHECKING([what C compiler to use])
     CC="`xcrun -find clang`"
     CC_BASE=`first_arg_basename "$CC"`
-    CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $lto $versionmin"
+    CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
     AC_MSG_RESULT([$CC])
 
     AC_MSG_CHECKING([what C++ compiler to use])
     CXX="`xcrun -find clang++`"
     CXX_BASE=`first_arg_basename "$CXX"`
-    CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $lto $versionmin"
+    CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
     AC_MSG_RESULT([$CXX])
 
     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 0480b0fc3fd5..047f121106de 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -177,8 +177,12 @@ gb_CFLAGS_COMMON += -std=gnu89
 
 ifeq ($(ENABLE_LTO),TRUE)
 ifeq ($(COM_IS_CLANG),TRUE)
+ifneq (,$(index,iOS MACOSX,$(OS)))
+gb_LTOFLAGS := -flto=thin
+else
 gb_LTOFLAGS := -flto
 gb_LTOPLUGINFLAGS := --plugin LLVMgold.so
+endif
 else
 gb_LTOFLAGS := -flto$(if $(filter-out 0,$(PARALLELISM)),=$(PARALLELISM)) -fuse-linker-plugin -O2
 endif


More information about the Libreoffice-commits mailing list