Unverified Commit 5631b327 authored by boklm's avatar boklm
Browse files

Bug 26148: Update binutils to 2.31.1

With older versions of binutils, the order in which .o files were
included in an .a archive did not affect the output when linking a
program or library, which is no longer the case with recent versions of
binutils. To avoid reproducibility issues we patch the libtool version
included in gcc to make the creation `libstdc++.a` reproducible.
parent 358b3b15
No preview for this file type
......@@ -16,18 +16,12 @@ distdir=/var/tmp/dist/binutils
ln -s /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++_pic.a libstdc++.a
export LDFLAGS="-L$rootdir -lstdc++"
[% END %]
tar xf [% project %]-[% c("version") %].tar.bz2
tar xf [% project %]-[% c("version") %].tar.xz
cd [% project %]-[% c("version") %]
[% IF c('var/windows') -%]
# XXX: This is needed due to bug 10102.
sed 's/= extern_rt_rel_d;/= extern_rt_rel_d;\n memset (extern_rt_rel_d, 0, PE_IDATA5_SIZE);/' -i ld/pe-dll.c
# Zeroing timestamps in PE headers reliably, see bug 12753.
patch -p1 < ../peXXigen.patch
# Needed for the hardening...
# Needed for the hardening... The upstream ticket is:
# https://sourceware.org/bugzilla/show_bug.cgi?id=17321
patch -p1 < ../enable-reloc-section-ld.patch
# fix build reproducibility of Windows builds by reverting commit 13e570f80c.
# See bug 16472.
patch -p1 < ../fix-windows-reproducibility.patch
[% END -%]
[% IF c('var/windows-x86_64') -%]
patch -p1 < ../64bit-fixups.patch
......
# vim: filetype=yaml sw=2
version: 2.26.1
version: 2.31.1
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
var:
configure_opt: '--disable-multilib --enable-gold --enable-deterministic-archives --enable-plugins'
......@@ -10,12 +10,9 @@ targets:
windows:
var:
configure_opt: '--target=[% c("arch") %]-w64-mingw32 --disable-multilib --enable-deterministic-archives'
arch_deps:
# texinfo required for fix-windows-reproducibility.patch
- texinfo
input_files:
- URL: https://ftp.gnu.org/gnu/binutils/binutils-[% c("version") %].tar.bz2
- URL: https://ftp.gnu.org/gnu/binutils/binutils-[% c("version") %].tar.xz
sig_ext: sig
file_gpg_id: 1
gpg_keyring: binutils.gpg
......@@ -24,7 +21,3 @@ input_files:
enable: '[% c("var/windows") %]'
- filename: 64bit-fixups.patch
enable: '[% c("var/windows-x86_64") %]'
- filename: peXXigen.patch
enable: '[% c("var/windows") %]'
- filename: fix-windows-reproducibility.patch
enable: '[% c("var/windows") %]'
This diff is collapsed.
From f8e8f1daf12e30d3197b25d6bd10c03d1f932e20 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Tue, 27 Sep 2016 12:08:19 +0100
Subject: [PATCH] Ensure that the timestamp in PE/COFF headers is always
initialised.
PR ld/20634
* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Put 0 in the
timestamp field if real time values are not being stored.
---
bfd/peXXigen.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index c92c1ea..d713d96 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -879,6 +879,8 @@ _bfd_XXi_only_swap_filehdr_out (bfd * abfd, void * in, void * out)
/* Only use a real timestamp if the option was chosen. */
if ((pe_data (abfd)->insert_timestamp))
H_PUT_32 (abfd, time (0), filehdr_out->f_timdat);
+ else
+ H_PUT_32 (abfd, 0, filehdr_out->f_timdat);
PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr,
filehdr_out->f_symptr);
--
2.1.4
......@@ -22,6 +22,10 @@ cd /var/tmp/build
mkdir gcc
cd gcc
tar xJf $rootdir/gcc-[% c("var/gcc_version") %].tar.xz
# https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01115.html
# From gcc commit 494c17dc2bf45b8155fb9a14178ab48f01bc12a8
# libtool: Sort output of 'find' to enable deterministic builds.
patch -p1 -d gcc-[% c("var/gcc_version") %] < $rootdir/libtool-sort.patch
# We don't want to link against msvcrt.dll due to bug 9084 and want to use
# pthreads, too, as this is needed for ESR60, at least due to bug 1406542.
[% c("arch") %]-w64-mingw32-g++ -dumpspecs > $distdir/msvcr100.spec
......
......@@ -34,3 +34,4 @@ input_files:
sha256sum: 850bf21eafdfe5cd5f6827148184c08c4a0852a37ccf36ce69855334d2c914d4
- name: binutils
project: binutils
- filename: libtool-sort.patch
From 494c17dc2bf45b8155fb9a14178ab48f01bc12a8 Mon Sep 17 00:00:00 2001
From: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 5 Jul 2018 19:13:45 +0000
Subject: [PATCH 1/1] * libtool.m4: Sort output of 'find' to enable
deterministic builds. * ltmain.sh: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262451 138bc75d-0d04-0410-961f-82ee72b054a4
---
ChangeLog | 5 +++++
libtool.m4 | 8 ++++----
ltmain.sh | 4 ++--
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/libtool.m4 b/libtool.m4
index 24d13f3..940faaa 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -6005,20 +6005,20 @@ if test "$_lt_caught_CXX_error" != yes; then
_LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
- compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
_LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
- $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
$RANLIB $oldlib'
_LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
;;
*) # Version 6 and above use weak symbols
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
diff --git a/ltmain.sh b/ltmain.sh
index 9503ec8..79f9ba8 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -2917,7 +2917,7 @@ func_extract_archives ()
darwin_file=
darwin_files=
for darwin_file in $darwin_filelist; do
- darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+ darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
$LIPO -create -output "$darwin_file" $darwin_files
done # $darwin_filelist
$RM -rf unfat-$$
@@ -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 | sort | $NL2SP`
done
func_extract_archives_result="$my_oldobjs"
--
2.9.3
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment