A new user interface for you! Read more...

File reproducible.patch of Package gcc8

Sort input file list
so that gcc builds in a reproducible way
in spite of indeterministic filesystem readdir order

See https://reproducible-builds.org/ for why this is good.

While working on the reproducible builds effort, I found that
when building the gcc8 package for openSUSE, there were differences
between each build in resulting binaries like gccgo, cc1obj and cpp
because the order of objects in libstdc++.a varied based on
the order of entries returned by the filesystem.

Two remaining issues are with timestamps in the ada build
and with profiledbootstrap that only is reproducible if all inputs
in the profiling run remain constant

Testcases:
  none included because patch is trivial and it would need to compare builds on 2 filesystems.

ChangeLog:
  ltmain.sh: sort list of object files to make build reproducible

Bootstrapping and testing:
  tested successfully with gcc8 on x86_64

Index: gcc-8.0.1+r259636/ltmain.sh
===================================================================
--- gcc-8.0.1+r259636.orig/ltmain.sh
+++ gcc-8.0.1+r259636/ltmain.sh
@@ -2932,7 +2932,7 @@ func_extract_archives ()
         func_extract_an_archive "$my_xdir" "$my_xabs"
 	;;
       esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | LC_ALL=C sort | $NL2SP`
     done
 
     func_extract_archives_result="$my_oldobjs"

Index: gcc-8.0.1+r259636/gcc/ada/gcc-interface/Makefile.in
===================================================================
--- gcc-8.0.1+r259636.orig/gcc/ada/gcc-interface/Makefile.in
+++ gcc-8.0.1+r259636/gcc/ada/gcc-interface/Makefile.in
@@ -2407,6 +2407,7 @@ $(RTSDIR)/s-oscons.ads: ../stamp-gnatlib
 	    $(OSCONS_CPP) ; \
 	    $(OSCONS_EXTRACT) ; \
 	    ../bldtools/oscons/xoscons s-oscons)
+	touch -d @1 $@
 
 gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR) $(RTSDIR)/s-oscons.ads
 	test -f $(RTSDIR)/s-oscons.ads || exit 1