Patch binutils to produce more deterministic output

This commit is contained in:
Evgeny Egorochkin 2013-06-25 10:53:37 +03:00
parent f22880408e
commit 0889bbe88f
3 changed files with 20 additions and 3 deletions

View file

@ -1,4 +1,6 @@
{ stdenv, fetchurl, noSysDirs, zlib, cross ? null, gold ? false, bison ? null, flex2535 ? null, bc ? null, dejagnu ? null }:
{ stdenv, fetchurl, noSysDirs, zlib
, cross ? null, gold ? false, bison ? null, flex2535 ? null, bc ? null, dejagnu ? null
, deterministic ? false }:
let basename = "binutils-2.23.1"; in
stdenv.mkDerivation rec {
@ -19,7 +21,7 @@ stdenv.mkDerivation rec {
# That requires upstream changes for things to work. So we can patch it to
# get the old behaviour by now.
./dtneeded.patch
];
] ++ (stdenv.lib.optional deterministic ./deterministic.patch);
buildInputs =
[ zlib ]
@ -48,7 +50,8 @@ stdenv.mkDerivation rec {
+ stdenv.lib.optionalString (stdenv.system == "mips64el-linux")
" --enable-fix-loongson2f-nop"
+ stdenv.lib.optionalString (cross != null) " --target=${cross.config}"
+ stdenv.lib.optionalString gold " --enable-gold";
+ stdenv.lib.optionalString gold " --enable-gold"
+ stdenv.lib.optionalString deterministic " --enable-deterministic-archives";
enableParallelBuilding = true;

View file

@ -0,0 +1,12 @@
diff -ur orig/binutils-2.23.1/ld/ldlang.c binutils-2.23.1/ld/ldlang.c
--- orig/ld/ldlang.c
+++ new/ld/ldlang.c
@@ -3095,6 +3095,8 @@
ldfile_output_machine))
einfo (_("%P%F:%s: can not set architecture: %E\n"), name);
+ link_info.output_bfd->flags |= BFD_DETERMINISTIC_OUTPUT;
+
link_info.hash = bfd_link_hash_table_create (link_info.output_bfd);
if (link_info.hash == NULL)
einfo (_("%P%F: can not create hash table: %E\n"));

View file

@ -3206,6 +3206,8 @@ let
inherit noSysDirs;
};
binutils_deterministic = binutils.override { deterministic = true; };
binutils_gold = lowPrio (callPackage ../development/tools/misc/binutils {
inherit noSysDirs;
gold = true;