diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2018-06-25 22:42:56 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2018-07-04 15:36:18 +0200 |
commit | d0cb2967aa288852561497537327ebea838ebc9a (patch) | |
tree | 8b7465799031b0db8ef25dfb69f57514a48bed65 | |
parent | 0654030f98355f105ddc741147fc0ff03ab0d906 (diff) |
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@collabora.com>
-rw-r--r-- | config_host.mk.in | 1 | ||||
-rw-r--r-- | configure.ac | 28 | ||||
-rw-r--r-- | solenv/gbuild/platform/com_GCC_defs.mk | 4 |
3 files changed, 33 insertions, 0 deletions
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 |