janneke pushed a commit to branch wip-bootstrap in repository guix. commit eeacb03f8979df84fb5bed51a0ec780d44dd71ea Author: Jan Nieuwenhuizen <jann...@gnu.org> Date: Wed Jun 20 17:42:39 2018 +0200
gnu: gcc-boot: build with %cheat-binutils? * gnu/packages/mes.scm (gcc-boot): WIP --- gnu/packages/mes.scm | 80 ++++++++++--- gnu/packages/patches/gcc-boot-2.95.3.patch | 179 +++++++++++++++++++++++------ 2 files changed, 205 insertions(+), 54 deletions(-) diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm index 2a78445..9405d29 100644 --- a/gnu/packages/mes.scm +++ b/gnu/packages/mes.scm @@ -1035,10 +1035,23 @@ ac_cv_c_float_format='IEEE (little-endian)' (package (inherit gcc-core-boot) (name "gcc-boot") + (version "2.95.3") + (source (origin + (method url-fetch) + (uri (string-append "mirror://gnu/gcc/gcc-2.95.3/gcc-core-" + version + ".tar.gz")) + (patches (search-patches ;;"gcc-core-boot-2.95.3.patch" + "gcc-boot-2.95.3.patch" + )) + (sha256 + (base32 + "1xvfy4pqhrd5v2cv8lzf63iqg92k09g6z9n2ah6ndd4h17k1x0an")))) (supported-systems '("i686-linux")) (native-inputs `(("binutils" ,binutils-boot0) ("gcc" ,gcc-core-boot) - ("glibc" ,glibc-boot))) + ("glibc" ,glibc-boot) + ("kernel-headers" ,(linux-libre-headers-boot0)))) (outputs '("out")) (arguments `(#:tests? #f ; runtest: command not found @@ -1056,30 +1069,62 @@ ac_cv_c_float_format='IEEE (little-endian)' (modify-phases %standard-phases (replace 'configure (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out")) - (binutils (assoc-ref %build-inputs "binutils")) - (cppflags (string-append - " -D __STDC__=1" - " -D __GLIBC_MINOR__=6" - ))) + (let* ((out (assoc-ref outputs "out")) + (binutils (assoc-ref %build-inputs "binutils")) + (gcc (assoc-ref %build-inputs "gcc")) + (glibc (assoc-ref %build-inputs "glibc")) + (headers (assoc-ref %build-inputs "kernel-headers"))) (when #t ;; no info (delete-file-recursively "texinfo") (system "touch gcc/cpp.info gcc/gcc.info")) - ;; MORTAL SIN: use pre-built binary seed - (setenv "PATH" (string-append - binutils "/i686-unknown-linux-gnu/bin" - ":" (getenv "PATH"))) + (setenv "PATH" + (string-append + ;;(assoc-ref %build-inputs "flex") "/bin" + ;;":" + (assoc-ref %build-inputs "binutils") "/bin" + ":" (assoc-ref %build-inputs "gcc") "/bin" + + ;; REMOVE NEW glibc/bin from path + ;; we suddenly get this error: linux/errno.h + ;; via a glibc-2.25 errno.h + + ":" (assoc-ref %build-inputs "bash") "/bin" + ;; ":" (assoc-ref %build-inputs "bzip2") "/bin" + ":" (assoc-ref %build-inputs "coreutils") "/bin" + ;; ":" (assoc-ref %build-inputs "diffutils") "/bin" + ;; ":" (assoc-ref %build-inputs "file") "/bin" + ;; ":" (assoc-ref %build-inputs "findutils") "/bin" + ;; ":" (assoc-ref %build-inputs "gawk") "/bin" + ":" (assoc-ref %build-inputs "grep") "/bin" + ":" (assoc-ref %build-inputs "gzip") "/bin" + ;; ":" (assoc-ref %build-inputs "m4") "/bin" + ":" (assoc-ref %build-inputs "make") "/bin" + ;; ":" (assoc-ref %build-inputs "patch") "/bin" + ":" (assoc-ref %build-inputs "sed") "/bin" + ":" (assoc-ref %build-inputs "tar") "/bin")) + + (format (current-error-port) "PATH=~a\n" (getenv "PATH")) (setenv "CONFIG_SHELL" (string-append (assoc-ref %build-inputs "bash") "/bin/sh")) - (unsetenv "C_INCLUDE_PATH") ; flex - (unsetenv "LIBRARY_PATH") - (setenv "CPPFLAGS" cppflags) - (setenv "CC" (string-append "gcc" cppflags)) - (setenv "CPP" (string-append "gcc -E" cppflags)) + (setenv "C_INCLUDE_PATH" (string-append + ;;gcc "/include" this is MES + ;;":/" + gcc "/lib/gcc-lib/i386-unknown-linux/2.95.3/include" + ":" headers "/include" + ":" glibc "/include")) + (setenv "LIBRARY_PATH" (string-append glibc "/lib" + ":" gcc "/lib")) + (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv "C_INCLUDE_PATH")) + (format (current-error-port) "LIBRARY_PATH=~a\n" (getenv "LIBRARY_PATH")) + + (setenv "CC" "gcc") + (setenv "LD" "gcc") + (setenv "CPP" "gcc -E") (setenv "RANLIB" "true") + ;;(setenv "LIBS" "-lgcc2 -ltcc1") (with-output-to-file "config.cache" (lambda _ (display " @@ -1088,8 +1133,7 @@ ac_cv_c_float_format='IEEE (little-endian)' (and (zero? (system* "./configure" - ;;"--disable-shared" - ;;"--enable-static" + "--disable-shared" "--host=i386-unknown-linux" "--target=i386-unknown-linux" (string-append "--prefix=" out)))))))))))) diff --git a/gnu/packages/patches/gcc-boot-2.95.3.patch b/gnu/packages/patches/gcc-boot-2.95.3.patch index 27a39ed..36d1f18 100644 --- a/gnu/packages/patches/gcc-boot-2.95.3.patch +++ b/gnu/packages/patches/gcc-boot-2.95.3.patch @@ -1,19 +1,19 @@ -diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/cccp.c gcc-2.95.3/gcc/cccp.c +diff -purN -x foo.c -x BOOT -x BOOT-2 -x BOOT-strict -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/cccp.c gcc-2.95.3/gcc/cccp.c --- ../gcc-2.95.3/gcc/cccp.c 2001-01-25 15:03:00.000000000 +0100 -+++ gcc-2.95.3/gcc/cccp.c 2018-06-07 23:58:30.485287991 +0200 ++++ gcc-2.95.3/gcc/cccp.c 2018-06-23 09:14:39.617293047 +0200 @@ -4448,7 +4448,9 @@ get_filename: if (*fin == '>' && fin + 1 == limit) { angle_brackets = 1; /* If -I-, start with the first -I dir after the -I-. */ -+#if 0 ++#if 1 search_start = first_bracket_include; +#endif break; } goto fail; -diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/crtstuff.c gcc-2.95.3/gcc/crtstuff.c +diff -purN -x foo.c -x BOOT -x BOOT-2 -x BOOT-strict -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/crtstuff.c gcc-2.95.3/gcc/crtstuff.c --- ../gcc-2.95.3/gcc/crtstuff.c 1999-03-23 01:43:51.000000000 +0100 -+++ gcc-2.95.3/gcc/crtstuff.c 2018-06-07 23:16:09.671415411 +0200 ++++ gcc-2.95.3/gcc/crtstuff.c 2018-06-19 19:52:06.151175995 +0200 @@ -54,8 +54,12 @@ Boston, MA 02111-1307, USA. */ #include "tm.h" #include "defaults.h" @@ -27,12 +27,73 @@ diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC /* We do not want to add the weak attribute to the declarations of these routines in frame.h because that will cause the definition of these symbols to be weak as well. -Binary files ../gcc-2.95.3/gcc/fixinc/crt1.o and gcc-2.95.3/gcc/fixinc/crt1.o differ -Binary files ../gcc-2.95.3/gcc/fixinc/crti.o and gcc-2.95.3/gcc/fixinc/crti.o differ -Binary files ../gcc-2.95.3/gcc/fixinc/crtn.o and gcc-2.95.3/gcc/fixinc/crtn.o differ -diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/libgcc2.c gcc-2.95.3/gcc/libgcc2.c +diff -purN -x foo.c -x BOOT -x BOOT-2 -x BOOT-strict -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/genattr.c gcc-2.95.3/gcc/genattr.c +--- ../gcc-2.95.3/gcc/genattr.c 1999-04-16 21:52:20.000000000 +0200 ++++ gcc-2.95.3/gcc/genattr.c 2018-06-23 11:56:48.291382356 +0200 +@@ -439,8 +439,12 @@ from the machine description file `md'. + printf("#define ATTR_FLAG_unlikely\t0x10\n"); + printf("#define ATTR_FLAG_very_unlikely\t0x20\n"); + ++#if 0 + fflush (stdout); + exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); ++#else ++ puts (""); ++#endif + /* NOTREACHED */ + return 0; + } +diff -purN -x foo.c -x BOOT -x BOOT-2 -x BOOT-strict -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/gencodes.c gcc-2.95.3/gcc/gencodes.c +--- ../gcc-2.95.3/gcc/gencodes.c 1999-04-16 21:52:23.000000000 +0200 ++++ gcc-2.95.3/gcc/gencodes.c 2018-06-23 12:01:29.899854058 +0200 +@@ -171,8 +171,12 @@ from the machine description file `md'. + + printf ("#endif /* MAX_INSN_CODE */\n"); + ++#if 0 + fflush (stdout); + exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); ++#else ++ puts (""); ++#endif + /* NOTREACHED */ + return 0; + } +diff -purN -x foo.c -x BOOT -x BOOT-2 -x BOOT-strict -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/genconfig.c gcc-2.95.3/gcc/genconfig.c +--- ../gcc-2.95.3/gcc/genconfig.c 1999-04-16 21:52:24.000000000 +0200 ++++ gcc-2.95.3/gcc/genconfig.c 2018-06-23 12:12:28.434253092 +0200 +@@ -372,8 +372,12 @@ from the machine description file `md'. + if (have_lo_sum_flag) + printf ("#define HAVE_lo_sum\n"); + ++#if 0 + fflush (stdout); + exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); ++#else ++ puts (""); ++#endif + /* NOTREACHED */ + return 0; + } +diff -purN -x foo.c -x BOOT -x BOOT-2 -x BOOT-strict -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/genflags.c gcc-2.95.3/gcc/genflags.c +--- ../gcc-2.95.3/gcc/genflags.c 1999-04-16 21:52:29.000000000 +0200 ++++ gcc-2.95.3/gcc/genflags.c 2018-06-23 12:14:44.576400818 +0200 +@@ -308,8 +308,12 @@ from the machine description file `md'. + + printf ("#endif /* NO_MD_PROTOTYPES */\n"); + ++#if 0 + fflush (stdout); + exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); ++#else ++ puts (""); ++#endif + /* NOTREACHED */ + return 0; + } +diff -purN -x foo.c -x BOOT -x BOOT-2 -x BOOT-strict -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/libgcc2.c gcc-2.95.3/gcc/libgcc2.c --- ../gcc-2.95.3/gcc/libgcc2.c 1999-06-11 05:11:43.000000000 +0200 -+++ gcc-2.95.3/gcc/libgcc2.c 2018-06-07 23:16:09.671415411 +0200 ++++ gcc-2.95.3/gcc/libgcc2.c 2018-06-19 19:52:06.151175995 +0200 @@ -48,6 +48,43 @@ Boston, MA 02111-1307, USA. */ #include <stddef.h> #endif @@ -77,9 +138,9 @@ diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC /* Don't use `fancy_abort' here even if config.h says to use it. */ #ifdef abort #undef abort -diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/machmode.h gcc-2.95.3/gcc/machmode.h +diff -purN -x foo.c -x BOOT -x BOOT-2 -x BOOT-strict -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/machmode.h gcc-2.95.3/gcc/machmode.h --- ../gcc-2.95.3/gcc/machmode.h 1999-04-08 09:27:26.000000000 +0200 -+++ gcc-2.95.3/gcc/machmode.h 2018-06-07 23:16:09.671415411 +0200 ++++ gcc-2.95.3/gcc/machmode.h 2018-06-19 19:52:06.151175995 +0200 @@ -21,6 +21,9 @@ Boston, MA 02111-1307, USA. */ #ifndef HAVE_MACHINE_MODES #define HAVE_MACHINE_MODES @@ -90,9 +151,9 @@ diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC /* Strictly speaking, this isn't the proper place to include these definitions, but this file is included by every GCC file. */ -diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/Makefile.in gcc-2.95.3/gcc/Makefile.in +diff -purN -x foo.c -x BOOT -x BOOT-2 -x BOOT-strict -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/gcc/Makefile.in gcc-2.95.3/gcc/Makefile.in --- ../gcc-2.95.3/gcc/Makefile.in 2001-01-25 15:02:58.000000000 +0100 -+++ gcc-2.95.3/gcc/Makefile.in 2018-06-07 23:16:09.671415411 +0200 ++++ gcc-2.95.3/gcc/Makefile.in 2018-06-23 11:46:03.525159181 +0200 @@ -221,7 +221,7 @@ RANLIB_TEST_FOR_TARGET = \ SYSTEM_HEADER_DIR = /usr/include @@ -102,7 +163,73 @@ diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC # Test to see whether <limits.h> exists in the system header files. LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ] -@@ -2093,14 +2093,18 @@ gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS) +@@ -958,6 +958,7 @@ libgcc1.cross: + # fragments. + libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status + -rm -f tmplibgcc1.a ++ mkdir -p libgcc1-o + # Actually build it in tmplibgcc1.a, then rename at end, + # so that libgcc1.a itself remains nonexistent if compilation is aborted. + # -e causes any failing command to make this rule fail. +@@ -974,6 +975,7 @@ libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1F + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + mv libgcc1$(objext) $${name}$(objext); \ + $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \ ++ mv $${name}$(objext) libgcc1-o; \ + rm -f $${name}$(objext); \ + done + # Some shells crash when a loop has no items. +@@ -994,6 +996,7 @@ libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1F + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ ++ mv $${name}$(objext) libgcc1-o; \ + rm -f $${name}.s $${name}$(objext); \ + else true; \ + fi; \ +@@ -1024,6 +1027,7 @@ libgcc1-asm.a: libgcc2.ready config.stat + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + mv libgcc1$(objext) $${name}$(objext); \ + $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc1.a $${name}$(objext); \ ++ mv $${name}$(objext) libgcc1-o; \ + rm -f $${name}$(objext); \ + done + -rm -f libgcc1.S +@@ -1062,6 +1066,7 @@ libgcc2.a: libgcc2.c libgcc2.ready $(CON + # Actually build it in tmplibgcc2.a, then rename at end, + # so that libgcc2.a itself remains nonexistent if compilation is aborted. + -rm -f tmplibgcc2.a ++ mkdir -p libgcc2-o + # -e causes any failing command to make this rule fail. + # -e doesn't work in certain shells, so we test $$? as well. + # lynx has a broken ar, it always complains when the initial library is +@@ -1139,6 +1144,7 @@ libgcc2.a: libgcc2.c libgcc2.ready $(CON + $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \ + if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ + $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${oname}$(objext); \ ++ mv $${oname}$(objext) libgcc2-o;\ + rm -f $${name}.s $${oname}$(objext); \ + fi; \ + done +@@ -1156,7 +1162,7 @@ libgcc.a: $(LIBGCC1) $(LIBGCC2) + -rm -rf tmplibgcc.a libgcc.a tmpcopy + mkdir tmpcopy + -if [ x$(LIBGCC1) != x ]; \ +- then (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC1)); \ ++ then cp -v libgcc1-o/*.o tmpcopy; \ + else true; \ + fi + # Some versions of ar (specifically the one in RISC/os 5.x), create an +@@ -1164,7 +1170,7 @@ libgcc.a: $(LIBGCC1) $(LIBGCC2) + # the second ar command tries to overwrite this file. To avoid the error + # message from ar, we make sure all files are writable. + -(cd tmpcopy; chmod +w * > /dev/null 2>&1) +- (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2)) ++ cp -v libgcc2-o/*.o tmpcopy + (cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a *$(objext)) + rm -rf tmpcopy + -if $(RANLIB_TEST_FOR_TARGET) ; then \ +@@ -2093,14 +2099,18 @@ gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS) # s-* so that mostlyclean does not force the include directory to # be rebuilt. @@ -122,7 +249,7 @@ diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC for file in .. $(USER_H); do \ if [ X$$file != X.. ]; then \ realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \ -@@ -2265,16 +2269,17 @@ stmp-fixproto: fixhdr.ready fixproto stm +@@ -2265,16 +2275,17 @@ stmp-fixproto: fixhdr.ready fixproto stm # # Remake the info files. @@ -150,23 +277,3 @@ diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC dvi: gcc.dvi cpp.dvi lang.dvi -Binary files ../gcc-2.95.3/intl and gcc-2.95.3/intl differ -diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/test2.h gcc-2.95.3/test2.h ---- ../gcc-2.95.3/test2.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-2.95.3/test2.h 2018-06-07 23:54:57.461766900 +0200 -@@ -0,0 +1 @@ -+#warning test2.h -diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/test3.h gcc-2.95.3/test3.h ---- ../gcc-2.95.3/test3.h 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-2.95.3/test3.h 2018-06-07 23:54:57.461766900 +0200 -@@ -0,0 +1 @@ -+#warning test3.h -diff -purN -x .git -x Makefile -x config.status -x config.h -x BOOT -x BOOT-GCC ../gcc-2.95.3/test.c gcc-2.95.3/test.c ---- ../gcc-2.95.3/test.c 1970-01-01 01:00:00.000000000 +0100 -+++ gcc-2.95.3/test.c 2018-06-07 23:54:57.461766900 +0200 -@@ -0,0 +1,4 @@ -+#warning 1:test.c -+#include "test2.h" -+#warning 3:test.c -+#include "test3.h" -Binary files ../gcc-2.95.3/texinfo and gcc-2.95.3/texinfo differ