This is the mail archive of the
mailing list for the GCC project.
[PATCH] ltmain.sh: Sort input file list
- From: "Bernhard M. Wiedemann" <bwiedemann at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: "Bernhard M. Wiedemann" <bwiedemann at suse dot de>
- Date: Sat, 9 Jun 2018 21:20:28 +0200
- Subject: [PATCH] ltmain.sh: 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 (which is not the case)
none included because patch is trivial and it would need to compare builds on 2 filesystems.
ltmain.sh: sort list of object files to make build reproducible
Bootstrapping and testing:
tested successfully with gcc8 on x86_64
ltmain.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ltmain.sh b/ltmain.sh
index 9503ec85d..96311a12c 100644
@@ -2932,7 +2932,7 @@ func_extract_archives ()
func_extract_an_archive "$my_xdir" "$my_xabs"
- 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`