This makes sure we do not regress PR85574 and thus that when doing LTO bootstrap the generated binaries do not differ from stage2 to stage3. Note we indepenently verify the object files which contain just LTO bytecode do not differ (besides differences in the LTO options sections).
This has the chance of breaking on some targets given we've never compared binaries before but just object files. Still it's an invariant we'd like to hold, so hopefully it works out. Bootstrapped on x86_64-unknown-linux-gnu, LTO bootstrapped on x86_64-unknown-linux-gnu. OK for trunk? Note I picked just gcc/lto1 as a binary that will surely be available when doing LTO bootstrap rather than also compare all $(exeext) found in stageN-gcc/ (build/gen* are for example also LTO compiled). The explicit list could also be amended of course. Thanks, Richard. 2019-01-03 Richard Biener <rguent...@suse.de> PR bootstrap/85574 * Makefile.tpl (compare target): Also compare extra-compare files. * Makefile.in: Regenerate. config/ * bootstrap-lto.mk (extra-compare): Set to gcc/lto1$(exeext). Index: Makefile.in =================================================================== --- Makefile.in (revision 267551) +++ Makefile.in (working copy) @@ -53850,7 +53850,7 @@ compare: sed=`echo stage3 | sed 's,^stage,,;s,.,.,g'`; \ files=`find stage3-* -name "*$(objext)" -print | \ sed -n s,^stage$$sed-,,p`; \ - for file in $${files}; do \ + for file in $${files} ${extra-compare}; do \ f1=$$r/stage2-$$file; f2=$$r/stage3-$$file; \ if test ! -f $$f1; then continue; fi; \ $(do-compare) > /dev/null 2>&1; \ @@ -54248,7 +54248,7 @@ compare3: sed=`echo stage4 | sed 's,^stage,,;s,.,.,g'`; \ files=`find stage4-* -name "*$(objext)" -print | \ sed -n s,^stage$$sed-,,p`; \ - for file in $${files}; do \ + for file in $${files} ${extra-compare}; do \ f1=$$r/stage3-$$file; f2=$$r/stage4-$$file; \ if test ! -f $$f1; then continue; fi; \ $(do-compare3) > /dev/null 2>&1; \ Index: Makefile.tpl =================================================================== --- Makefile.tpl (revision 267551) +++ Makefile.tpl (working copy) @@ -1675,7 +1675,7 @@ do-clean: clean-stage[+id+] sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \ files=`find stage[+id+]-* -name "*$(objext)" -print | \ sed -n s,^stage$$sed-,,p`; \ - for file in $${files}; do \ + for file in $${files} ${extra-compare}; do \ f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \ if test ! -f $$f1; then continue; fi; \ $(do-[+compare-target+]) > /dev/null 2>&1; \ Index: config/bootstrap-lto.mk =================================================================== --- config/bootstrap-lto.mk (revision 267551) +++ config/bootstrap-lto.mk (working copy) @@ -15,3 +15,4 @@ LTO_EXPORTS = AR="$(LTO_AR)"; export AR; LTO_FLAGS_TO_PASS = AR="$(LTO_AR)" RANLIB="$(LTO_RANLIB)" do-compare = $(SHELL) $(srcdir)/contrib/compare-lto $$f1 $$f2 +extra-compare = gcc/lto1$(exeext)