janneke pushed a commit to branch wip-bootstrap in repository guix. commit bbc9a35e905b98bf56b226a27b70917aab0ace86 Author: Jan Nieuwenhuizen <jann...@gnu.org> Date: Sun Jun 17 20:51:19 2018 +0200
gnu: gcc-core-boot: Install libgcc2.a too. * gnu/packages/mes.scm (gcc-core-boot): Install libgcc2.a too. --- gnu/packages/mes.scm | 93 +++++++---- gnu/packages/patches/gcc-core-boot-2.95.3.patch | 202 ++++++++++++++++++++++++ 2 files changed, 265 insertions(+), 30 deletions(-) diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm index ff9ec3d..cf7edc7 100644 --- a/gnu/packages/mes.scm +++ b/gnu/packages/mes.scm @@ -601,7 +601,7 @@ standard.") (uri (string-append "mirror://gnu/gcc/gcc-2.95.3/gcc-core-" version ".tar.gz")) - (patches (search-patches "gcc-boot-2.95.3.patch")) + (patches (search-patches "gcc-core-boot-2.95.3.patch")) (sha256 (base32 "1xvfy4pqhrd5v2cv8lzf63iqg92k09g6z9n2ah6ndd4h17k1x0an")))) @@ -610,16 +610,22 @@ standard.") ("tcc" ,tcc-boot))) (outputs '("out")) (arguments - `(#:tests? #f ; runtest: command not found + `(#:tests? #f #:parallel-build? #f #:strip-binaries? #f - #:make-flags (list "CC=tcc -static" - "OLDCC=tcc -static" - "RANLIB=true" - (string-append "LIBGCC2_INCLUDES=-I " - (assoc-ref %build-inputs "tcc") - "/include") - "LANGUAGES=c") + #:make-flags (list + "CC=tcc -static -D __GLIBC_MINOR__=6" + "OLDCC=tcc -static -D __GLIBC_MINOR__=6" + "CC_FOR_BUILD=tcc -static -D __GLIBC_MINOR__=6" + "AR=ar" + "RANLIB=ranlib" + (string-append "LIBGCC2_INCLUDES=-I " + (assoc-ref %build-inputs "tcc") + "/include") + "LANGUAGES=c" + (string-append "BOOT_LDFLAGS=" + " -B" (assoc-ref %build-inputs "tcc") + "/lib/")) #:modules ((guix build gnu-build-system) (guix build utils) (srfi srfi-1)) @@ -628,21 +634,46 @@ standard.") (replace 'configure (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")) + (tcc (assoc-ref %build-inputs "tcc")) (cppflags (string-append - "-D __STDC__=1" + " -D __STDC__=1" " -D __GLIBC_MINOR__=6"))) - (when #t ;; no info - (delete-file-recursively "texinfo") - (system "touch gcc/cpp.info gcc/gcc.info")) + (setenv "PATH" + (string-append + (assoc-ref %build-inputs "binutils") "/bin" + ":" (assoc-ref %build-inputs "tcc") "/bin" + + ;; more bootstrap cheats + ":" (assoc-ref %build-inputs "bash") "/bin" + ":" (assoc-ref %build-inputs "coreutils") "/bin" + ":" (assoc-ref %build-inputs "diffutils") "/bin" + ":" (assoc-ref %build-inputs "file") "/bin" + ":" (assoc-ref %build-inputs "grep") "/bin" + ":" (assoc-ref %build-inputs "gzip") "/bin" + ":" (assoc-ref %build-inputs "make") "/bin" + ":" (assoc-ref %build-inputs "sed") "/bin" + ":" (assoc-ref %build-inputs "tar") "/bin")) + + ;; no info at this stage + (delete-file-recursively "texinfo") + (system "touch gcc/cpp.info gcc/gcc.info") + (setenv "CONFIG_SHELL" (string-append (assoc-ref %build-inputs "bash") "/bin/sh")) + (unsetenv "LANG") (unsetenv "C_INCLUDE_PATH") ; flex (unsetenv "LIBRARY_PATH") (setenv "CPPFLAGS" cppflags) + (setenv "C_INCLUDE_PATH" (string-append tcc "/include")) (setenv "CC" (string-append "tcc -static" " " cppflags)) + (setenv "CC_FOR_BUILD" (string-append "tcc -static" " " cppflags)) (setenv "CPP" (string-append "tcc -E" " " cppflags)) - (setenv "RANLIB" "true") + + (format (current-error-port) "PATH=~a\n" (getenv "PATH")) + (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv "C_INCLUDE_PATH")) + (format (current-error-port) "LIBRARY_PATH=~a\n" (getenv "LIBRARY_PATH")) + (with-output-to-file "config.cache" (lambda _ (display " @@ -661,22 +692,24 @@ ac_cv_c_float_format='IEEE (little-endian)' (let* ((tcc (assoc-ref %build-inputs "tcc")) (tcc-lib (string-append tcc "/lib/x86-mes-gcc")) (out (assoc-ref outputs "out")) - (gcc-dir (string-append out "/lib/gcc-lib/i386-unknown-linux/2.95.3"))) - (copy-file (string-append tcc-lib "/crt1.o") - (string-append gcc-dir "/crt1.o")) - (with-output-to-file "crti.c" (lambda _ (display ""))) - (system* "tcc" "-static" "-c" "crti.c") - (copy-file "crti.o" (string-append gcc-dir "/crti.o")) - (with-output-to-file "crtn.c" (lambda _ (display ""))) - (system* "tcc" "-static" "-c" "crtn.c") - (copy-file "crtn.o" (string-append gcc-dir "/crtn.o")) - (system* "ar" "r" (string-append gcc-dir "/libc.a") - (string-append tcc "/lib/x86-mes-gcc/libc+gnu.o")) - (system* "ar" "r" (string-append out "/lib/libc.a") - (string-append tcc "/lib/x86-mes-gcc/libc+gnu.o")) - (system* "ls" "-ltrF" gcc-dir) - (copy-recursively (string-append tcc "/include") - (string-append out "/include")))))))))) + (gcc-dir (string-append + out "/lib/gcc-lib/i386-unknown-linux/2.95.3"))) + (and + (mkdir-p "tmp") + (zero? (system (string-append "set -x; cd tmp && ar x ../gcc/libgcc2.a"))) + (zero? (system (string-append "set -x; cd tmp && ar r " gcc-dir "/libgcc.a *.o"))) + (copy-file "gcc/libgcc2.a" (string-append out "/lib/libgcc2.a")) + (copy-file (string-append tcc "/lib/libtcc1.a") + (string-append out "/lib/libtcc1.a")) + (zero? (system* "ar" "r" (string-append gcc-dir "/libc.a") + (string-append tcc-lib "/libc+gnu.o") + (string-append tcc-lib "/libtcc1.o"))) + (zero? (system* "ar" "r" (string-append out "/lib/libc.a") + (string-append tcc-lib "/libc+gnu.o") + (string-append tcc-lib "/libtcc1.o"))) + (system* "ls" "-ltrF" gcc-dir) + (copy-recursively (string-append tcc "/include") + (string-append out "/include"))))))))))) (define-public glibc-boot (package diff --git a/gnu/packages/patches/gcc-core-boot-2.95.3.patch b/gnu/packages/patches/gcc-core-boot-2.95.3.patch new file mode 100644 index 0000000..1cb8340 --- /dev/null +++ b/gnu/packages/patches/gcc-core-boot-2.95.3.patch @@ -0,0 +1,202 @@ +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-19 19:52:06.151175995 +0200 +@@ -54,8 +54,12 @@ Boston, MA 02111-1307, USA. */ + #include "tm.h" + #include "defaults.h" + #include <stddef.h> ++ ++#define FIRST_PSEUDO_REGISTER 17 ++ + #include "frame.h" + ++ + /* 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. +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-19 19:52:06.151175995 +0200 +@@ -48,6 +48,43 @@ Boston, MA 02111-1307, USA. */ + #include <stddef.h> + #endif + ++/* ++ mysteriously missing decls ++*/ ++ ++#ifndef stderr ++#define stderr 2 ++#endif ++ ++#ifndef BITS_PER_UNIT ++#define BITS_PER_UNIT 8 ++#endif ++ ++#ifndef LONG_MIN ++#define LONG_MIN -2147483648 ++#endif ++ ++#ifndef EOF ++#define EOF -1 ++#endif ++ ++#if __GNUC__ ++// typedef unsigned short word_type; ++ ++#if !defined (SIZE_T) && !defined (_SIZE_T) && !defined (__MES_SIZE_T) ++#define SIZE_T ++#define _SIZE_T ++typedef long unsigned int size_t; ++#endif ++ ++#endif // __GNUC__ ++ ++#if !defined (_FILE_T) && !defined (__MES_FILE_T) ++#define FILE_T ++#define _FILE_T ++typedef int *FILE; ++#endif ++ + /* Don't use `fancy_abort' here even if config.h says to use it. */ + #ifdef abort + #undef abort +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-19 19:52:06.151175995 +0200 +@@ -21,6 +21,9 @@ Boston, MA 02111-1307, USA. */ + #ifndef HAVE_MACHINE_MODES + #define HAVE_MACHINE_MODES + ++#undef PROTO ++#define PROTO(args) args ++ + /* Strictly speaking, this isn't the proper place to include these definitions, + but this file is included by every GCC file. */ + +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-23 11:46:03.525159181 +0200 +@@ -221,7 +221,7 @@ RANLIB_TEST_FOR_TARGET = \ + SYSTEM_HEADER_DIR = /usr/include + + # Control whether to run fixproto. +-STMP_FIXPROTO = stmp-fixproto ++# STMP_FIXPROTO = stmp-fixproto + + # Test to see whether <limits.h> exists in the system header files. + LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ] +@@ -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. + ++# STMP_FIXINC = @STMP_FIXINC@ ++STMP_FIXINC = stmp-fixinc ++ + # Build the include directory including float.h (which no longer depends upon + # enquire). +-stmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h ++stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) xlimits.h + # Copy in the headers provided with gcc. + # The sed command gets just the last file name component; + # this is necessary because VPATH could add a dirname. + # Using basename would be simpler, but some systems don't have it. + # The touch command is here to workaround an AIX/Linux NFS bug. ++ -if [ -d include ] ; then true; else mkdir include; chmod a+rx include; fi + for file in .. $(USER_H); do \ + if [ X$$file != X.. ]; then \ + realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \ +@@ -2265,16 +2275,17 @@ stmp-fixproto: fixhdr.ready fixproto stm + # + # Remake the info files. + +-doc: info +-info: cpp.info gcc.info lang.info +- +-cpp.info: $(srcdir)/cpp.texi +- $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o cpp.info $(srcdir)/cpp.texi +- +-gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \ +- $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \ +- $(srcdir)/tm.texi $(srcdir)/gcov.texi +- $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o gcc.info $(srcdir)/gcc.texi ++doc: ++# doc: info ++# info: cpp.info gcc.info lang.info ++ ++# cpp.info: $(srcdir)/cpp.texi ++# $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o cpp.info $(srcdir)/cpp.texi ++ ++# gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \ ++# $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \ ++# $(srcdir)/tm.texi $(srcdir)/gcov.texi ++# $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o gcc.info $(srcdir)/gcc.texi + + dvi: gcc.dvi cpp.dvi lang.dvi +