[Libreoffice-commits] core.git: config_host.mk.in configure.ac solenv/gbuild
Luboš Luňák
l.lunak at collabora.com
Wed Jul 4 13:36:47 UTC 2018
config_host.mk.in | 1 +
configure.ac | 28 ++++++++++++++++++++++++++++
solenv/gbuild/platform/com_GCC_defs.mk | 4 ++++
3 files changed, 33 insertions(+)
New commits:
commit d0cb2967aa288852561497537327ebea838ebc9a
Author: Luboš Luňák <l.lunak at collabora.com>
Date: Mon Jun 25 22:42:56 2018 +0200
add configure option --enable-ld to use GNU gold or LLVM lld
https://lists.freedesktop.org/archives/libreoffice/2018-June/080437.html
Change-Id: I06214459fcebe5cc58fd7979f3cbe5ac3d97db7d
Reviewed-on: https://gerrit.libreoffice.org/56417
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/config_host.mk.in b/config_host.mk.in
index acca001c0bcd..0bc686e916da 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -601,6 +601,7 @@ export UCRTSDKDIR=@UCRTSDKDIR@
export UCRTVERSION=@UCRTVERSION@
export UCRT_REDISTDIR=@UCRT_REDISTDIR@
export UNOWINREG_DLL=@UNOWINREG_DLL@
+export USE_LD=@USE_LD@
export USE_LIBRARY_BIN_TAR=@USE_LIBRARY_BIN_TAR@
export USE_XINERAMA=@USE_XINERAMA@
export UPDATE_CONFIG=@UPDATE_CONFIG@
diff --git a/configure.ac b/configure.ac
index 12516d80219b..ebe5d0c5be9b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1341,6 +1341,11 @@ AC_ARG_ENABLE(icecream,
wrappers, you can override that using --with-gcc-home=/the/path switch.]),
,)
+AC_ARG_ENABLE(ld,
+ AS_HELP_STRING([--enable-ld=<linker>],
+ [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.]),
+,)
+
libo_FUZZ_ARG_ENABLE(cups,
AS_HELP_STRING([--disable-cups],
[Do not build cups support.])
@@ -3152,6 +3157,29 @@ else
fi
AC_SUBST(CROSS_COMPILING)
+USE_LD=
+if test -n "$enable_ld" -a "$enable_ld" != "no"; then
+ AC_MSG_CHECKING([for -fuse-ld=$enable_ld linker support])
+ if test "$GCC" = "yes"; then
+ ldflags_save=$LDFLAGS
+ LDFLAGS="$LDFLAGS -fuse-ld=$enable_ld"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
+#include <stdio.h>
+ ],[
+printf ("hello world\n");
+ ])], USE_LD=$enable_ld, [])
+ if test -n "$USE_LD"; then
+ AC_MSG_RESULT( yes )
+ LDFLAGS="$ldflags_save -fuse-ld=$enable_ld"
+ else
+ AC_MSG_ERROR( no )
+ fi
+ else
+ AC_MSG_ERROR( not supported )
+ fi
+fi
+AC_SUBST(USE_LD)
+
HAVE_LD_BSYMBOLIC_FUNCTIONS=
if test "$GCC" = "yes"; then
AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index da9440cfeb3d..c9cbe0d96a54 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -35,6 +35,10 @@ else
gb_AR := $(shell $(CC) -print-prog-name=ar)
endif
+ifneq ($(USE_LD),)
+gb_LinkTarget_LDFLAGS += -fuse-ld=$(USE_LD)
+endif
+
ifeq ($(strip $(gb_COMPILEROPTFLAGS)),)
gb_COMPILEROPTFLAGS := -O2
endif
More information about the Libreoffice-commits
mailing list