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

Peter Foley pefoley2 at pefoley.com
Mon Jan 18 00:31:36 PST 2016


 configure.ac                           |   13 ++++++++++---
 solenv/gbuild/platform/com_GCC_defs.mk |    1 +
 solenv/gbuild/platform/unxgcc.mk       |    4 ++--
 3 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 0533b155354f086aa8dc1de06c7db92d3f3be4f5
Author: Peter Foley <pefoley2 at pefoley.com>
Date:   Fri Jan 15 11:34:20 2016 -0500

    Wrappers for LTO
    
    When building with GCC, the gcc-ar, gcc-ranlib, and gcc-nm wrappers
    must be used for the linker to properly resolve symbols from static
    libraries containing LTO objects.
    Likewise, clang requires the llvm-ar, llvm-ranlib, and llvm-nm
    wrappers.
    
    Change-Id: I539017b6da7732f998a49820dc01d0e6b302952a
    Reviewed-on: https://gerrit.libreoffice.org/21502
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/configure.ac b/configure.ac
index 39f61c1..3750beb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5163,10 +5163,17 @@ if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
     # explicitly. Or put /path/to/compiler in PATH yourself.
 
-    AC_CHECK_TOOL(AR,ar)
-    AC_CHECK_TOOL(NM,nm)
+    # Use wrappers for LTO
+    if test "$ENABLE_LTO" == "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
+        AC_CHECK_TOOL(AR,gcc-ar)
+        AC_CHECK_TOOL(NM,gcc-nm)
+        AC_CHECK_TOOL(RANLIB,gcc-ranlib)
+    else
+        AC_CHECK_TOOL(AR,ar)
+        AC_CHECK_TOOL(NM,nm)
+        AC_CHECK_TOOL(RANLIB,ranlib)
+    fi
     AC_CHECK_TOOL(OBJDUMP,objdump)
-    AC_CHECK_TOOL(RANLIB,ranlib)
     AC_CHECK_TOOL(READELF,readelf)
     AC_CHECK_TOOL(STRIP,strip)
     if test "$_os" = "WINNT"; then
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 3f79605..877f502 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -130,6 +130,7 @@ gb_CFLAGS_COMMON += -std=gnu89
 ifeq ($(ENABLE_LTO),TRUE)
 ifeq ($(COM_IS_CLANG),TRUE)
 gb_LTOFLAGS := -flto
+gb_LTOPLUGINFLAGS := --plugin LLVMgold.so
 else
 gb_LTOFLAGS := -flto=$(PARALLELISM) -fuse-linker-plugin -O2
 endif
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 6cd206c..7e43ce3 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -145,7 +145,7 @@ $(call gb_Helper_abbreviate_dirs,\
 	$(if $(SOVERSIONSCRIPT),&& ln -sf ../../program/$(notdir $(1)) $(ILIBTARGET)))
 	$(if $(filter Library,$(TARGETTYPE)), $(call gb_Helper_abbreviate_dirs,\
 		$(READELF) -d $(1) | grep SONAME > $(WORKDIR)/LinkTarget/$(2).exports.tmp; \
-		$(NM) --dynamic --extern-only --defined-only --format=posix $(1) \
+		$(NM) $(gb_LTOPLUGINFLAGS) --dynamic --extern-only --defined-only --format=posix $(1) \
 			| cut -d' ' -f1-2 \
 			>> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
 		$(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp, \
@@ -155,7 +155,7 @@ endef
 define gb_LinkTarget__command_staticlink
 $(call gb_Helper_abbreviate_dirs,\
 	rm -f $(1) && \
-	$(gb_AR) -rsu $(1) \
+	$(gb_AR) $(gb_LTOPLUGINFLAGS) -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))) \


More information about the Libreoffice-commits mailing list