From: Andi Kleen <a...@linux.intel.com> Add a new bootstrap-lto-slim config file that enables slim (non-fat) LTO bootstrap. This improves the performance of the LTO bootstrap.
Speeds up the LTO bootstrap by ~18% on a 4 core system. This requires using gcc-ar/ranlib in post stage 1 builds, so these are passed to all sub builds. I made it a new config file for now because it requires the host to support linker plugins, which I believe is not supported everywhere yet? config/: 2014-08-04 Andi Kleen <a...@linux.intel.com> * bootstrap-lto-slim.mk: New file. /: 2014-08-04 Andi Kleen <a...@linux.intel.com> * Makefile.tpl (POSTSTAGE1_HOST_EXPORTS): Add LTO_EXPORTS. POSTSTAGE1_FLAGS_TO_PASS): Add LTO_FLAGS_TO_PASS. * Makefile.in: Regenerate. gcc/: 2014-08-04 Andi Kleen <a...@linux.intel.com> * doc/install.texi: Documentation bootstrap-lto-slim --- Makefile.in | 2 ++ Makefile.tpl | 2 ++ config/bootstrap-lto-slim.mk | 13 +++++++++++++ gcc/doc/install.texi | 5 +++++ 4 files changed, 22 insertions(+) create mode 100644 config/bootstrap-lto-slim.mk diff --git a/Makefile.in b/Makefile.in index 329af7f..af59823 100644 --- a/Makefile.in +++ b/Makefile.in @@ -256,6 +256,7 @@ POSTSTAGE1_HOST_EXPORTS = \ $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \ CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \ $(POSTSTAGE1_CXX_EXPORT) \ + $(LTO_EXPORTS) \ GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \ LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \ HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS; @@ -826,6 +827,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \ GNATBIND="$${GNATBIND}" \ LDFLAGS="$${LDFLAGS}" \ HOST_LIBS="$${HOST_LIBS}" \ + $(LTO_FLAGS_TO_PASS) \ "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" # Flags to pass down to makes which are built with the target environment. diff --git a/Makefile.tpl b/Makefile.tpl index 4822c32..261461a 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -259,6 +259,7 @@ POSTSTAGE1_HOST_EXPORTS = \ $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \ CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \ $(POSTSTAGE1_CXX_EXPORT) \ + $(LTO_EXPORTS) \ GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \ LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \ HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS; @@ -631,6 +632,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \ GNATBIND="$${GNATBIND}" \ LDFLAGS="$${LDFLAGS}" \ HOST_LIBS="$${HOST_LIBS}" \ + $(LTO_FLAGS_TO_PASS) \ "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" # Flags to pass down to makes which are built with the target environment. diff --git a/config/bootstrap-lto-slim.mk b/config/bootstrap-lto-slim.mk new file mode 100644 index 0000000..9e065e1 --- /dev/null +++ b/config/bootstrap-lto-slim.mk @@ -0,0 +1,13 @@ +# This option enables LTO for stage2 and stage3 in slim mode + +STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 +STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 +STAGEprofile_CFLAGS += -fno-lto + +# assumes the host supports the linker plugin +LTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ +LTO_RANLIB = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ranlib$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ + +LTO_EXPORTS = AR="$(LTO_AR)"; export AR; \ + RANLIB="$(LTO_RANLIB)"; export RANLIB; +LTO_FLAGS_TO_PASS = AR="$(LTO_AR)" RANLIB="$(LTO_RANLIB)" diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 31b8c8b..cac2915 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -2377,6 +2377,11 @@ Enables Link-Time Optimization for host tools during bootstrapping. @samp{BUILD_CONFIG=bootstrap-lto} is equivalent to adding @option{-flto} to @samp{BOOT_CFLAGS}. +@item @samp{bootstrap-lto-slim} +Enable slim Link-Time-Optimization for host tools during bootstrapping. +This is a faster version of @code{bootstrap-lto}, but requires +the host to support the linker plugin. + @item @samp{bootstrap-debug} Verifies that the compiler generates the same executable code, whether or not it is asked to emit debug information. To this end, this -- 2.0.1