@@ -670,6 +670,7 @@ subdirs
slibdir
dollar
gcc_tooldir
+LTOPLUGINSONAME
enable_lto
MAINT
zlibinc
@@ -17286,7 +17287,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 17289 "configure"
+#line 17290 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -17392,7 +17393,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 17395 "configure"
+#line 17396 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -25691,6 +25692,14 @@ $as_echo "#define ENABLE_LTO 1" >>confdefs.h
enable_lto=yes
+ LTOPLUGINSONAME="${host_lto_plugin_soname}"
+
+ ac_config_files="$ac_config_files lto/gcc-ar:lto/lto-tools.in"
+
+ ac_config_files="$ac_config_files lto/gcc-nm:lto/lto-tools.in"
+
+ ac_config_files="$ac_config_files lto/gcc-ranlib:lto/lto-tools.in"
+
;;
*) ;;
esac
@@ -26769,6 +26778,9 @@ do
"as") CONFIG_FILES="$CONFIG_FILES as:exec-tool.in" ;;
"collect-ld") CONFIG_FILES="$CONFIG_FILES collect-ld:exec-tool.in" ;;
"nm") CONFIG_FILES="$CONFIG_FILES nm:exec-tool.in" ;;
+ "lto/gcc-ar") CONFIG_FILES="$CONFIG_FILES lto/gcc-ar:lto/lto-tools.in" ;;
+ "lto/gcc-nm") CONFIG_FILES="$CONFIG_FILES lto/gcc-nm:lto/lto-tools.in" ;;
+ "lto/gcc-ranlib") CONFIG_FILES="$CONFIG_FILES lto/gcc-ranlib:lto/lto-tools.in" ;;
"$all_outputs") CONFIG_FILES="$CONFIG_FILES $all_outputs" ;;
"default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
@@ -27352,6 +27364,9 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
"as":F) chmod +x as ;;
"collect-ld":F) chmod +x collect-ld ;;
"nm":F) chmod +x nm ;;
+ "lto/gcc-ar":F) chmod +x lto/gcc-ar ;;
+ "lto/gcc-nm":F) chmod +x lto/gcc-nm ;;
+ "lto/gcc-ranlib":F) chmod +x lto/gcc-ranlib ;;
"default":C)
case ${CONFIG_HEADERS} in
*auto-host.h:config.in*)
@@ -4474,6 +4474,11 @@ changequote([,])dnl
AC_DEFINE(ENABLE_LTO, 1, [Define to enable LTO support.])
enable_lto=yes
AC_SUBST(enable_lto)
+ LTOPLUGINSONAME="${host_lto_plugin_soname}"
+ AC_SUBST(LTOPLUGINSONAME)
+ AC_CONFIG_FILES(lto/gcc-ar:lto/lto-tools.in, [chmod +x lto/gcc-ar])
+ AC_CONFIG_FILES(lto/gcc-nm:lto/lto-tools.in, [chmod +x lto/gcc-nm])
+ AC_CONFIG_FILES(lto/gcc-ranlib:lto/lto-tools.in, [chmod +x lto/gcc-ranlib])
;;
*) ;;
esac
@@ -7610,6 +7610,10 @@ lead to improved optimization opportunities.
Use of @option{-fwhole-program} is not needed when linker plugin is
active (see @option{-fuse-linker-plugin}).
+In some cases, you may need to use the @command{gcc-ar},
+@command{gcc-nm} and @command{gcc-ranlib} commands to manage LTO
+object files.
+
Regarding portability: the current implementation of LTO makes no
attempt at generating bytecode that can be ported between different
types of hosts. The bytecode files are versioned and there is a
@@ -28,16 +28,32 @@ LTO_H = lto/lto.h $(HASHTAB_H)
LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
LTO_TREE_H = lto/lto-tree.h $(LINKER_PLUGIN_API_H)
+AR_INSTALL_NAME := $(shell echo gcc-ar|sed '$(program_transform_name)')
+NM_INSTALL_NAME := $(shell echo gcc-nm|sed '$(program_transform_name)')
+RANLIB_INSTALL_NAME := $(shell echo gcc-ranlib|sed '$(program_transform_name)')
+
+ifeq ($(enable_plugin),yes)
+LTO_WRAPPERS = lto/gcc-ar lto/gcc-nm lto/gcc-ranlib
+else
+LTO_WRAPPERS =
+endif
# Rules
# These hooks are used by the main GCC Makefile. Consult that
# Makefile for documentation.
-lto.all.cross: $(LTO_EXE)
-lto.start.encap: $(LTO_EXE)
+lto.all.cross: $(LTO_EXE) $(LTO_WRAPPERS)
+lto.start.encap: $(LTO_EXE) $(LTO_WRAPPERS)
lto.rest.encap:
lto.tags:
lto.install-common:
+ifeq ($(enable_plugin),yes)
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ $(INSTALL_SCRIPT) lto/gcc-ar $(DESTDIR)$(bindir)/$(AR_INSTALL_NAME)
+ $(INSTALL_SCRIPT) lto/gcc-nm $(DESTDIR)$(bindir)/$(NM_INSTALL_NAME)
+ $(INSTALL_SCRIPT) lto/gcc-ranlib $(DESTDIR)$(bindir)/$(RANLIB_INSTALL_NAME)
+endif
+
lto.install-man:
lto.install-info:
lto.dvi:
new file mode 100644
@@ -0,0 +1,38 @@
+#!/bin/sh
+# binutils wrapper with GCC LTO support
+# requires binutils 2.21+
+
+invoked=`basename "$0"`
+BINDIR=`dirname "$0"`
+
+if [ -x "$BINDIR/../xgcc" ] ; then
+ GCC=$BINDIR/../xgcc
+ ARG=-B$BINDIR/../
+else
+ ARG=
+ if [ -x "$BINDIR/gcc" ] ; then
+ GCC=$BINDIR/gcc
+ else
+ GCC=gcc
+ fi
+fi
+
+case "$invoked" in
+ gcc-ar)
+ PROG=ar
+ PROG_ENV=AR
+ ;;
+ gcc-nm)
+ PROG=nm
+ PROG_ENV=NM
+ ;;
+ gcc-ranlib)
+ PROG=ranlib
+ PROG_ENV=RANLIB
+ ;;
+esac
+
+eval prog="\${$PROG_ENV}"
+PROG=${prog:-`"$GCC" -print-prog-name=$PROG`}
+
+exec "$PROG" --plugin `"$GCC" $ARG -print-prog-name="@LTOPLUGINSONAME@"` "$@"