From f4fa6a753c97dcb278c8ce0ba8b19fbb479976bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= Date: Wed, 22 Nov 2017 15:30:21 +0100 Subject: [PATCH] Added changes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squashed commit of the following: commit 1c0ec69b1f1e019d0be050a7d1094f1768b7e2e4 Author: Gábor Boskovits Date: Wed Nov 22 14:40:16 2017 +0100 Update documentation and test. commit 8d0b55cb59e5c78799096fa9c49c6505a813f49a Author: Gábor Boskovits Date: Wed Nov 22 09:20:20 2017 +0100 Update gcc-4-reproducibility-wrapper.patch. commit f75b44b642dbf7c53c5a9745533ec2be2cb981fa Author: Gábor Boskovits Date: Tue Nov 21 18:30:20 2017 +0100 Add new environment variable definition to handle gcc/prefix.c. commit 0f494164aae2ad44d31fa7b21abf6bf8813b0990 Author: Gábor Boskovits Date: Tue Nov 21 18:27:58 2017 +0100 Update wrapper patch to include handling of gcc/prefix.c. commit 9615bee65f62dbbbe58d3bd83353fe45c435aa05 Author: Gábor Boskovits Date: Tue Nov 21 17:37:56 2017 +0100 Add wrapped versions. commit 51d5a41f55decbdb8440d1a32f24de6aae8994a9 Author: Gábor Boskovits Date: Tue Nov 21 09:11:10 2017 +0100 Add copyright notice. commit 82c84eb18d07c542c92459e4ed0b82da289e54f8 Author: Gábor Boskovits Date: Tue Nov 21 09:08:59 2017 +0100 Add gcc-4-reproducibility-wrapper-patch to gnu/local.mk. commit dcbba610ede784ebef9a201b0f3affb7b3721326 Author: Gábor Boskovits Date: Tue Nov 21 09:06:11 2017 +0100 Add gcc-4-reproducibility-wrapper patch. commit 5ca720f49181296b8abb51799d6b7818152a75b4 Author: Gábor Boskovits Date: Tue Nov 21 09:00:19 2017 +0100 Gnu add repro-gcc-wrapped. commit ade9b48e23a8bd63712e41a0cd7cba91587aa628 Author: Gábor Boskovits Date: Tue Nov 21 03:00:11 2017 +0100 Setup environment variables for gcc wrapper. commit 3eb37f455e399a477df856e7725c04cb47f597bd Author: Gábor Boskovits Date: Tue Nov 21 02:18:18 2017 +0100 Add nostrip gcc. commit 22ac376df1e81a98ba7eed07fd0d92dd67f284a9 Author: Gábor Boskovits Date: Sun Nov 19 14:15:55 2017 +0100 Debuggable build trial 1. commit 5073e1e096496f7a7587c43f0e95e471cec3e0fb Author: Gábor Boskovits Date: Sat Nov 18 19:22:15 2017 +0100 Fix versions in gcc-ddc description. --- gnu/local.mk | 1 + gnu/packages/bootstrappable.scm | 134 ++++++++++++++- .../patches/gcc-4-reproducibility-wrapper.patch | 190 +++++++++++++++++++++ 3 files changed, 321 insertions(+), 4 deletions(-) create mode 100644 gnu/packages/patches/gcc-4-reproducibility-wrapper.patch diff --git a/gnu/local.mk b/gnu/local.mk index 72f8fa8e1..d9ce72e18 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -647,6 +647,7 @@ dist_patch_DATA = \ %D%/packages/patches/gcc-libvtv-runpath.patch \ %D%/packages/patches/gcc-strmov-store-file-names.patch \ %D%/packages/patches/gcc-4-compile-with-gcc-5.patch \ + %D%/packages/patches/gcc-4-reproducibility-wrapper.patch \ %D%/packages/patches/gcc-4.6-gnu-inline.patch \ %D%/packages/patches/gcc-4.9.3-mingw-gthr-default.patch \ %D%/packages/patches/gcc-5.0-libvtv-runpath.patch \ diff --git a/gnu/packages/bootstrappable.scm b/gnu/packages/bootstrappable.scm index cbd7592db..66577ff8d 100644 --- a/gnu/packages/bootstrappable.scm +++ b/gnu/packages/bootstrappable.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Jan Nieuwenhuizen +;;; Copyright © 2017 Gábor Boskovits ;;; ;;; This file is part of GNU Guix. ;;; @@ -225,7 +226,6 @@ (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest) "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")))))))))) - (define-public repro-gcc-4.7 (package (inherit gcc-4.7-$ORIGIN) @@ -250,11 +250,82 @@ "BUILD_PATH_PREFIX_MAP=~s\n" (getenv "BUILD_PATH_PREFIX_MAP")))))))))) +(define-public repro-gcc-wrapped-4.7 + (package + (inherit gcc-4.7-$ORIGIN) + (source + (origin + (inherit (package-source gcc-4.7-$ORIGIN)) + (patches (append ((compose origin-patches package-source) gcc-4.7) + (search-patches "gcc-5-reproducibility-drop-profile.patch" + ;;"gcc-4-compile-with-gcc-5.patch" + "gcc-4-build-path-prefix-map.patch" + "gcc-4-reproducibility-wrapper.patch"))))) + (name "repro-gcc-wrapped") + (version "4.7.4") + (arguments + (substitute-keyword-arguments (package-arguments gcc-4.7-$ORIGIN) + ((#:phases original-phases) + `(modify-phases ,original-phases + (add-before 'configure 'build-prefix-path + (lambda* (#:key inputs #:allow-other-keys) + (let ((out (assoc-ref %outputs "out"))) + (setenv "PREFIX" out) + (setenv "STANDARD_EXEC_PREFIX" (string-append out "/lib/gcc")) + (setenv "STANDARD_LIBEXEC_PREFIX" (string-append out "/libexec/gcc")) + (setenv "STANDARD_BINDIR_PREFIX" (string-append out "/bin"))) + (setenv "BUILD_PATH_PREFIX_MAP" + (string-append "gcc" "-" ,version "=" (getcwd))) + (format (current-error-port) + "BUILD_PATH_PREFIX_MAP=~s\n" + (getenv "BUILD_PATH_PREFIX_MAP")))))))))) + +(define-public repro-gcc-debuggable-4.7 + (package + (inherit repro-gcc-4.7) + (name "repro-gcc-debuggable") + (arguments + (substitute-keyword-arguments (package-arguments repro-gcc-4.7) + ((#:make-flags original-flags) + `(cons* "BOOT_CFLAGS=-O0 -g3" + (delete "BOOT_CFLAGS=-O2 -g0" ,original-flags))))))) + +(define-public repro-gcc-wrapped-debuggable-4.7 + (package + (inherit repro-gcc-wrapped-4.7) + (name "repro-gcc-wrapped-debuggable") + (arguments + (substitute-keyword-arguments (package-arguments repro-gcc-wrapped-4.7) + ((#:make-flags original-flags) + `(cons* "BOOT_CFLAGS=-O0 -g3" + (delete "BOOT_CFLAGS=-O2 -g0" ,original-flags))))))) + +(define-public repro-gcc-debuggable-nostrip-4.7 + (package + (inherit repro-gcc-debuggable-4.7) + (name "repro-gcc-debuggable-nostrip") + (arguments + (substitute-keyword-arguments (package-arguments repro-gcc-debuggable-4.7) + ((#:strip-binaries? _ #f) #f))))) + +(define-public repro-gcc-wrapped-debuggable-nostrip-4.7 + (package + (inherit repro-gcc-wrapped-debuggable-4.7) + (name "repro-gcc-wrapped-debuggable-nostrip") + (arguments + (substitute-keyword-arguments (package-arguments repro-gcc-wrapped-debuggable-4.7) + ((#:strip-binaries? _ #f) #f))))) + (define-public repr2-gcc-4.7 (package (inherit repro-gcc-4.7) (name "repr2-gcc"))) +(define-public repr2-gcc-wrapped-4.7 + (package + (inherit repro-gcc-wrapped-4.7) + (name "repr2-gcc-wrapped"))) + (define-public repro-gcc-7 (package (inherit gcc-4.7-$ORIGIN) @@ -348,9 +419,64 @@ (zero? (system* "diffoscope" gcc/bin/gcc clang-gcc/bin/gcc)) ;;(zero? (system* "diffoscope" gcc clang-gcc)) )))) - (synopsis "test gcc+clang DDC property for gcc-7.2.0") - (description "gcc-dcc is a meta-package that depends on repro-gcc-7.2.0 -and on clang-gcc-7.2.0 (the same GCC built with clang). The builder checks if + (synopsis "test gcc+clang DDC property for gcc-4.7.4") + (description "gcc-dcc is a meta-package that depends on repro-gcc-4.7.4 +and on clang-gcc-4.7.4 (the same GCC built with clang). The builder checks if +both gcc's are bit-for-bit identical and fails if they differ.") + (home-page "http://bootstrappable.org") + (license gpl3+))) + +(define-public gcc-wrapped-ddc-gcc+clang + (package + (name "gcc-wrapped-ddc") + (version "4.7.4") + (source #f) + (native-inputs `(("clang-gcc" ,repr2-gcc-wrapped-4.7) + ("gcc" ,repro-gcc-wrapped-4.7) + + ("diffoscope" ,diffoscope) + ("acl" ,acl) ; For diffoscope + ("binutils" ,binutils) + ("coreutils" ,coreutils) + ("diffutils" ,diffutils) + ("xxd" ,xxd))) + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let* ((diffoscope (assoc-ref %build-inputs "diffoscope")) + (acl (assoc-ref %build-inputs "acl")) + (binutils (assoc-ref %build-inputs "binutils")) + (coreutils (assoc-ref %build-inputs "coreutils")) + (diffutils (assoc-ref %build-inputs "diffutils")) + (xxd (assoc-ref %build-inputs "xxd")) + (gcc (assoc-ref %build-inputs "gcc")) + (gcc/bin/gcc (string-append gcc "/bin/gcc")) + (clang-gcc (assoc-ref %build-inputs "clang-gcc")) + (clang-gcc/bin/gcc (string-append clang-gcc "/bin/gcc"))) + ;; diffoscope.exc.RequiredToolNotFound: cmp + ;; diffoscope.comparators.directory: 'stat' not found! Is PATH wrong? + ;; FileNotFoundError: [Errno 2] No such file or directory: 'readelf' + ;; diffoscope.comparators.directory: Unable to find 'getfacl' + (setenv "PATH" (string-append diffoscope "/bin:" + + acl "/acl:" + binutils "/bin:" + coreutils "/bin:" + diffutils "/bin:" + xxd "/bin:")) + ;; ?? xxd not available in path. Falling back to Python hexlify. + ;; diffoscope.presenters.formats: Console is unable to print Unicode characters. Set e.g. PYTHONIOENCODING=utf-8 + (setenv "PYTHONIOENCODING" "utf-8") + ;; for starters, only check the gcc binary + (zero? (system* "diffoscope" gcc clang-gcc)) + ;;(zero? (system* "diffoscope" gcc clang-gcc)) + )))) + (synopsis "test gcc+clang DDC property for gcc-4.7.4") + (description "gcc-dcc is a meta-package that depends on repro-gcc-wrapped-4.7.4 +and on repr2-gcc-wrapped-4.7.4. The builder checks if both gcc's are bit-for-bit identical and fails if they differ.") (home-page "http://bootstrappable.org") (license gpl3+))) diff --git a/gnu/packages/patches/gcc-4-reproducibility-wrapper.patch b/gnu/packages/patches/gcc-4-reproducibility-wrapper.patch new file mode 100644 index 000000000..5eaba0e25 --- /dev/null +++ b/gnu/packages/patches/gcc-4-reproducibility-wrapper.patch @@ -0,0 +1,190 @@ +From 8646998bf1ced61c4fe212eae68a3fb43772d2b9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= +Date: Wed, 22 Nov 2017 09:18:47 +0100 +Subject: [PATCH] Prepare gcc for wrapper. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Squashed commit of the following: + +commit b1d80031fed7f094789fd83b02d089376bb4374f +Author: Gábor Boskovits +Date: Wed Nov 22 09:16:57 2017 +0100 + + Prepare gcc/prefix.c for wrapper, eliminate remaining PREFIX references. + +commit e3749ab19f7a660f9f47abd1e0959c3773df937f +Merge: 685201b4d 4d2c62dc0 +Author: Gábor Boskovits +Date: Tue Nov 21 18:21:13 2017 +0100 + + Merge branch 'tmp_squash' + +commit 4d2c62dc015407a14175a58d33b5c3a27e0a0755 +Author: Gábor Boskovits +Date: Tue Nov 21 18:19:47 2017 +0100 + + Prepare gcc/prefix.c for wrapper. + +commit 17878706e414e6cccc9400cd324bed5c97a70c64 +Author: Gábor Boskovits +Date: Tue Nov 21 09:02:36 2017 +0100 + + Add wrapper support. + + Squashed commit of the following: + + commit 685201b4db65a6a32e1b0bb9964d405af99e4f48 + Author: Gábor Boskovits + Date: Tue Nov 21 02:58:37 2017 +0100 + + Prepare gcc-ar.c for the wrapper. + + commit 2dd79c5b79182c2aa500de7a469b21b48dc1995f + Author: Gábor Boskovits + Date: Tue Nov 21 02:45:20 2017 +0100 + + Prepare source code for the wrapper. + +commit 685201b4db65a6a32e1b0bb9964d405af99e4f48 +Author: Gábor Boskovits +Date: Tue Nov 21 02:58:37 2017 +0100 + + Prepare gcc-ar.c for the wrapper. + +commit 2dd79c5b79182c2aa500de7a469b21b48dc1995f +Author: Gábor Boskovits +Date: Tue Nov 21 02:45:20 2017 +0100 + + Prepare source code for the wrapper. +--- + gcc/gcc-ar.c | 7 +++++-- + gcc/gcc.c | 10 +++++++--- + gcc/prefix.c | 23 +++++++++++++++++------ + 3 files changed, 29 insertions(+), 11 deletions(-) + +diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c +index 5f78378de..4b0352a72 100644 +--- a/gcc/gcc-ar.c ++++ b/gcc/gcc-ar.c +@@ -26,8 +26,8 @@ along with GCC; see the file COPYING3. If not see + #error "Please set personality" + #endif + +-static const char standard_libexec_prefix[] = STANDARD_LIBEXEC_PREFIX; +-static const char standard_bin_prefix[] = STANDARD_BINDIR_PREFIX; ++static const char *standard_libexec_prefix; ++static const char *standard_bin_prefix; + static const char *const target_machine = TARGET_MACHINE; + + static const char dir_separator[] = { DIR_SEPARATOR, 0 }; +@@ -44,6 +44,9 @@ main(int ac, char **av) + bool is_ar = !strcmp (PERSONALITY, "ar"); + int exit_code = FATAL_EXIT_CODE; + ++ standard_libexec_prefix=getenv("STANDARD_LIBEXEC_PREFIX"); ++ standard_bin_prefix=getenv("STANDARD_BINDIR_PREFIX"); ++ + exe_name = PERSONALITY; + #ifdef CROSS_DIRECTORY_STRUCTURE + exe_name = concat (target_machine, "-", exe_name, NULL); +diff --git a/gcc/gcc.c b/gcc/gcc.c +index 939dcc873..f75f88eec 100644 +--- a/gcc/gcc.c ++++ b/gcc/gcc.c +@@ -1125,9 +1125,9 @@ static const char *gcc_libexec_prefix; + gcc_exec_prefix is set because, in that case, we know where the + compiler has been installed, and use paths relative to that + location instead. */ +-static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX; +-static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX; +-static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX; ++static const char *standard_exec_prefix; ++static const char *standard_libexec_prefix; ++static const char *standard_bindir_prefix; + static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; + + /* For native compilers, these are well-known paths containing +@@ -6154,6 +6154,10 @@ main (int argc, char **argv) + on ?: in file-scope variable initializations. */ + asm_debug = ASM_DEBUG_SPEC; + ++ standard_exec_prefix=getenv("STANDARD_EXEC_PREFIX"); ++ standard_libexec_prefix=getenv("STANDARD_LIBEXEC_PREFIX"); ++ standard_bindir_prefix=getenv("STANDARD_BINDIR_PREFIX"); ++ + p = argv[0] + strlen (argv[0]); + while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1])) + --p; +diff --git a/gcc/prefix.c b/gcc/prefix.c +index c7003f8c6..01408e2e5 100644 +--- a/gcc/prefix.c ++++ b/gcc/prefix.c +@@ -73,7 +73,7 @@ License along with GCC; see the file COPYING3. If not see + #include "prefix.h" + #include "common/common-target.h" + +-static const char *std_prefix = PREFIX; ++static const char *std_prefix; + + static const char *get_key_value (char *); + static char *translate_name (char *); +@@ -85,6 +85,17 @@ static char *lookup_key (char *); + static HKEY reg_key = (HKEY) INVALID_HANDLE_VALUE; + #endif + ++/* Return std_prefix, factory method. */ ++ ++static const char * ++get_std_prefix (void) ++{ ++ if (std_prefix == 0) ++ std_prefix = getenv ("PREFIX"); ++ ++ return std_prefix; ++} ++ + /* Given KEY, as above, return its value. */ + + static const char * +@@ -101,7 +112,7 @@ get_key_value (char *key) + prefix = getenv (temp = concat (key, "_ROOT", NULL)); + + if (prefix == 0) +- prefix = std_prefix; ++ prefix = get_std_prefix(); + + free (temp); + +@@ -207,13 +218,13 @@ translate_name (char *name) + { + prefix = get_key_value (key); + if (prefix == 0) +- prefix = std_prefix; ++ prefix = get_std_prefix(); + } + else + prefix = getenv (key); + + if (prefix == 0) +- prefix = PREFIX; ++ prefix = getenv("PREFIX"); + + /* We used to strip trailing DIR_SEPARATORs here, but that can + sometimes yield a result with no separator when one was coded +@@ -248,9 +259,9 @@ char * + update_path (const char *path, const char *key) + { + char *result, *p; +- const int len = strlen (std_prefix); ++ const int len = strlen (get_std_prefix()); + +- if (! filename_ncmp (path, std_prefix, len) ++ if (! filename_ncmp (path, get_std_prefix(), len) + && (IS_DIR_SEPARATOR(path[len]) + || path[len] == '\0') + && key != 0) +-- +2.15.0 + -- 2.15.0