From 060a0cf338d6024eee37cc344c224fe3bcb78e81 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Fri, 20 Oct 2023 16:07:58 +0200 Subject: Initial commit --- ...001-strip-build-directory-from-fixinclues.patch | 29 +++++++++++ .../0002-compute-reproducible-checksums.patch | 58 ++++++++++++++++++++++ etc/patches/gcc-4.7.4/reproducibility/series | 2 + 3 files changed, 89 insertions(+) create mode 100644 etc/patches/gcc-4.7.4/reproducibility/0001-strip-build-directory-from-fixinclues.patch create mode 100644 etc/patches/gcc-4.7.4/reproducibility/0002-compute-reproducible-checksums.patch create mode 100644 etc/patches/gcc-4.7.4/reproducibility/series (limited to 'etc/patches/gcc-4.7.4/reproducibility') diff --git a/etc/patches/gcc-4.7.4/reproducibility/0001-strip-build-directory-from-fixinclues.patch b/etc/patches/gcc-4.7.4/reproducibility/0001-strip-build-directory-from-fixinclues.patch new file mode 100644 index 0000000..885c7d0 --- /dev/null +++ b/etc/patches/gcc-4.7.4/reproducibility/0001-strip-build-directory-from-fixinclues.patch @@ -0,0 +1,29 @@ +From 95563f6ef2366acb57557c11b8301d468a87e04f Mon Sep 17 00:00:00 2001 +From: Oliver Reiche +Date: Fri, 18 Aug 2023 14:36:57 +0200 +Subject: [PATCH 1/2] Strip build directory from fixinclues + +... to achieve a reproducible binary, which contains the +configure string. For this to work, the user needs to set +"BUILD_ROOT_DIR" before building. +--- + fixincludes/configure | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/fixincludes/configure b/fixincludes/configure +index 4a28cd1f3..45fdab2be 100755 +--- a/fixincludes/configure ++++ b/fixincludes/configure +@@ -6236,6 +6236,9 @@ cat >"$tmp/defines.awk" <<\_ACAWK || + BEGIN { + _ACEOF + ++# Remove host machine's build path from confdefs.h ++sed -i 's|'${BUILD_ROOT_DIR:-/nonexistent}'|/build|g' confdefs.h ++ + # Transform confdefs.h into an awk script `defines.awk', embedded as + # here-document in config.status, that substitutes the proper values into + # config.h.in to produce config.h. +-- +2.30.2 + diff --git a/etc/patches/gcc-4.7.4/reproducibility/0002-compute-reproducible-checksums.patch b/etc/patches/gcc-4.7.4/reproducibility/0002-compute-reproducible-checksums.patch new file mode 100644 index 0000000..7db6c92 --- /dev/null +++ b/etc/patches/gcc-4.7.4/reproducibility/0002-compute-reproducible-checksums.patch @@ -0,0 +1,58 @@ +From 617a9fc8ad3711fedea305881286bdc00b80a6e1 Mon Sep 17 00:00:00 2001 +From: Oliver Reiche +Date: Mon, 21 Aug 2023 18:03:56 +0200 +Subject: [PATCH 2/2] Compute reproducible checksums + +... for variable toolchain paths: +* remove linker path from gcc's checksum-options +* strip debug info before computing checksums +For removing the linker path, the user needs to set +"BUILD_ROOT_DIR" before building. +--- + gcc/Makefile.in | 7 ++++++- + gcc/cp/Make-lang.in | 6 +++++- + 2 files changed, 11 insertions(+), 2 deletions(-) + +diff --git a/gcc/Makefile.in b/gcc/Makefile.in +index f3cc49fdb..7fb30a13f 100644 +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -1804,12 +1804,17 @@ gcc-cross$(exeext): xgcc$(exeext) + + checksum-options: + echo "$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS)" > checksum-options.tmp \ ++ && sed -i 's|'$${BUILD_ROOT_DIR:-/nonexistent}'|/build|g' checksum-options.tmp \ + && $(srcdir)/../move-if-change checksum-options.tmp checksum-options + + # compute checksum over all object files and the options + cc1-checksum.c : build/genchecksum$(build_exeext) checksum-options \ + $(C_OBJS) $(BACKEND) $(LIBDEPS) +- build/genchecksum$(build_exeext) $(C_OBJS) $(BACKEND) $(LIBDEPS) \ ++ rm -rf stripped_c_checksum_inputs; \ ++ mkdir stripped_c_checksum_inputs; \ ++ cp $(C_OBJS) $(BACKEND) $(LIBDEPS) stripped_c_checksum_inputs/; \ ++ strip -g stripped_c_checksum_inputs/*; \ ++ build/genchecksum$(build_exeext) $$(ls stripped_c_checksum_inputs/* | LC_ALL=C sort) \ + checksum-options > cc1-checksum.c.tmp && \ + $(srcdir)/../move-if-change cc1-checksum.c.tmp cc1-checksum.c + +diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in +index 0ce01ac49..0fc43d305 100644 +--- a/gcc/cp/Make-lang.in ++++ b/gcc/cp/Make-lang.in +@@ -95,7 +95,11 @@ cp-warn = $(STRICT_WARN) + # compute checksum over all object files and the options + cc1plus-checksum.c : build/genchecksum$(build_exeext) checksum-options \ + $(CXX_OBJS) $(BACKEND) $(LIBDEPS) +- build/genchecksum$(build_exeext) $(CXX_OBJS) $(BACKEND) $(LIBDEPS) \ ++ rm -rf stripped_cp_checksum_inputs; \ ++ mkdir stripped_cp_checksum_inputs; \ ++ cp $(CXX_OBJS) $(BACKEND) $(CODYLIB) $(LIBDEPS) stripped_cp_checksum_inputs; \ ++ strip -g stripped_cp_checksum_inputs/*; \ ++ build/genchecksum$(build_exeext) $$(ls stripped_cp_checksum_inputs/* | LC_ALL=C sort) \ + checksum-options > cc1plus-checksum.c.tmp && \ + $(srcdir)/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c + +-- +2.30.2 + diff --git a/etc/patches/gcc-4.7.4/reproducibility/series b/etc/patches/gcc-4.7.4/reproducibility/series new file mode 100644 index 0000000..1ec9fe3 --- /dev/null +++ b/etc/patches/gcc-4.7.4/reproducibility/series @@ -0,0 +1,2 @@ +0001-strip-build-directory-from-fixinclues.patch +0002-compute-reproducible-checksums.patch -- cgit v1.2.3