summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config_host.mk.in1
-rw-r--r--configure.ac5
-rw-r--r--solenv/gbuild/platform/unxgcc.mk1
3 files changed, 7 insertions, 0 deletions
diff --git a/config_host.mk.in b/config_host.mk.in
index 2e81fecc2d45..697d788b510c 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -299,6 +299,7 @@ export KDE_LIBS=$(gb_SPACE)@KDE_LIBS@
export KRB5_LIBS=@KRB5_LIBS@
export LCMS2_CFLAGS=$(gb_SPACE)@LCMS2_CFLAGS@
export LCMS2_LIBS=$(gb_SPACE)@LCMS2_LIBS@
+export LD_PLUGIN=@LD_PLUGIN@
@x_LDFLAGS@ export LDFLAGS=@LDFLAGS@
export LFS_CFLAGS=@LFS_CFLAGS@
export LIBBASE_JAR=@LIBBASE_JAR@
diff --git a/configure.ac b/configure.ac
index cf9a3a7a6ce6..4e5715681c9b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5690,6 +5690,11 @@ AC_SUBST(COMPILER_PLUGINS)
AC_SUBST(CLANGDIR)
AC_SUBST(CLANGBUILD)
+# Plugin to help linker.
+# Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
+# This makes --enable-lto build with clang work.
+AC_SUBST(LD_PLUGIN)
+
dnl ===================================================================
dnl Set the MinGW sys-root
dnl ===================================================================
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 20a84e467775..86be4061ae7a 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -198,6 +198,7 @@ define gb_LinkTarget__command_staticlink
$(call gb_Helper_abbreviate_dirs,\
rm -f $(1) && \
$(gb_AR) -rsu $(1) \
+ $(if $(LD_PLUGIN),--plugin $(LD_PLUGIN)) \
$(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))) \