168349Sobrien# This option enables LTO for stage2 and stage3 in slim mode
268349Sobrien
3226048SobrienSTAGE2_CFLAGS += -flto=jobserver -frandom-seed=1
468349SobrienSTAGE3_CFLAGS += -flto=jobserver -frandom-seed=1
568349SobrienSTAGEprofile_CFLAGS += -flto=jobserver -frandom-seed=1
668349SobrienSTAGEtrain_CFLAGS += -flto=jobserver -frandom-seed=1
768349SobrienSTAGEfeedback_CFLAGS += -flto=jobserver -frandom-seed=1
868349Sobrien
968349Sobrien# assumes the host supports the linker plugin
1068349SobrienLTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/
1168349SobrienLTO_RANLIB = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ranlib$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/
1268349Sobrien
1368349SobrienLTO_EXPORTS = AR="$(LTO_AR)"; export AR; \
1468349Sobrien	      RANLIB="$(LTO_RANLIB)"; export RANLIB;
1568349SobrienLTO_FLAGS_TO_PASS = AR="$(LTO_AR)" RANLIB="$(LTO_RANLIB)"
1668349Sobrien
1768349Sobriendo-compare = $(SHELL) $(srcdir)/contrib/compare-lto $$f1 $$f2
18extra-compare = gcc/lto1$(exeext)
19