From c656bab1fd11dfcee889efc8b996d7700a9254a3 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Mon, 13 Feb 2023 12:11:01 +0100 Subject: [PATCH 001/118] doc: Post-release update. * build-aux/GNUmakefile.in (--previous-version): Update to 0.24.2. * doc/announce/ANNOUNCE-0.24.2: Run `make sum-announce'. --- build-aux/GNUmakefile.in | 2 +- doc/announce/ANNOUNCE-0.24.2 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build-aux/GNUmakefile.in b/build-aux/GNUmakefile.in index 419bc72f..a1214c4f 100644 --- a/build-aux/GNUmakefile.in +++ b/build-aux/GNUmakefile.in @@ -398,7 +398,7 @@ gen-announce: $(GEN_ANNOUNCE) \ --release-type=beta \ --package-name=mes \ - --previous-version='0.24.1' \ + --previous-version='0.24.2' \ --current-version=$(VERSION) \ --gpg-key-id=$(GPG_KEY_ID) \ --url-directory=https://ftp.gnu.org/gnu/mes \ diff --git a/doc/announce/ANNOUNCE-0.24.2 b/doc/announce/ANNOUNCE-0.24.2 index db866969..cf1d17d7 100644 --- a/doc/announce/ANNOUNCE-0.24.2 +++ b/doc/announce/ANNOUNCE-0.24.2 @@ -61,8 +61,8 @@ Enjoy! Here are the SHA1 and SHA256 checksums: - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.24.2.tar.gz - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.24.2.tar.gz + 30b0ce4cd37c87dca37b85a6c19646001881be46 mes-0.24.2.tar.gz + 7ddae0854e46ebfa18c13ab37e64839a7b86ea88aeed366a8d017efd11dae86e mes-0.24.2.tar.gz [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file From e428c17cc545300b1e9b69bec2a0b5fd90c56d64 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Mon, 13 Feb 2023 13:06:57 +0100 Subject: [PATCH 002/118] lib/m2: Update syscall includes. This is a follow-up to commit bc1fa57851d360abb161c54dce5339ad9d7af7aa lib: stat: Use SYS_stat64 for 32bit platforms. * lib/m2/chmod.c: Update to . * lib/m2/clock_gettime.c: Likewise. * lib/m2/read.c: Likewise. --- lib/m2/chmod.c | 4 ++-- lib/m2/clock_gettime.c | 4 ++-- lib/m2/read.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/m2/chmod.c b/lib/m2/chmod.c index f5a9a662..7a383014 100644 --- a/lib/m2/chmod.c +++ b/lib/m2/chmod.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2023 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -19,7 +19,7 @@ */ #include -#include +#include #include int diff --git a/lib/m2/clock_gettime.c b/lib/m2/clock_gettime.c index 3bcfdc37..9edaf5ef 100644 --- a/lib/m2/clock_gettime.c +++ b/lib/m2/clock_gettime.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2018,2019,2023 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -19,7 +19,7 @@ */ #include -#include +#include #include int diff --git a/lib/m2/read.c b/lib/m2/read.c index b1d911a1..515b0b80 100644 --- a/lib/m2/read.c +++ b/lib/m2/read.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2019,2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2019,2020,2023 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include From 29341f5783498cb037df045ebe99284cdb550f61 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Tue, 22 Nov 2022 12:30:46 +0100 Subject: [PATCH 003/118] build: Cater for colliding basename in C sources. This is a follow-up to commit f785f8d560a85121c9688f671a8a4921c49616f4 build: Fix --with-bootstrap build. * build-aux/cc.sh: Retain directory name in object file name. * build-aux/bootstrap.sh.in: Likewise. Compile crt1.c from local directory. * build-aux/build-lib.sh: Likewise. * build-aux/build.sh.in: Remove globals.o hack. --- build-aux/bootstrap.sh.in | 30 ++++++++++++++++++------------ build-aux/build-lib.sh | 5 +++-- build-aux/build.sh.in | 1 - build-aux/cc.sh | 12 ++++++++---- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/build-aux/bootstrap.sh.in b/build-aux/bootstrap.sh.in index a2451d02..53524b3a 100644 --- a/build-aux/bootstrap.sh.in +++ b/build-aux/bootstrap.sh.in @@ -1,7 +1,7 @@ #! @SHELL@ # GNU Mes --- Maxwell Equations of Software -# Copyright © 2019,2020 Jan (janneke) Nieuwenhuizen +# Copyright © 2019,2020,2022 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # @@ -54,16 +54,18 @@ AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ../include -I include" AM_CFLAGS="-L ${srcdest}lib" mkdir -p $mes_cpu-mes -$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c +cp ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c . +$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS crt1.c cp crt1.o $mes_cpu-mes cp crt1.s $mes_cpu-mes objects= for c in $libc_mini_SOURCES; do - o=$(basename $c .c).o + b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,) + o=$b.o if test ! -e $o -o ${srcdest}$c -nt $o; then echo " CC $c" - $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c + $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c fi objects="$objects $o" done @@ -72,10 +74,11 @@ $AR crD $mes_cpu-mes/libc-mini.a $objects objects= for c in $libmescc_SOURCES; do - o=$(basename $c .c).o + b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,) + o=$b.o if test ! -e $o -o ${srcdest}$c -nt $o; then echo " CC $c" - $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c + $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c fi objects="$objects $o" done @@ -84,10 +87,11 @@ $AR crD $mes_cpu-mes/libmescc.a $objects objects= for c in $libc_SOURCES; do - o=$(basename $c .c).o + b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,) + o=$b.o if test ! -e $o -o ${srcdest}$c -nt $o; then echo " CC $c" - $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c + $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c fi objects="$objects $o" done @@ -96,10 +100,11 @@ $AR crD $mes_cpu-mes/libc.a $objects objects= for c in $libc_tcc_SOURCES; do - o=$(basename $c .c).o + b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,) + o=$b.o if test ! -e $o -o ${srcdest}$c -nt $o; then echo " CC $c" - $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c + $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c fi objects="$objects $o" done @@ -113,10 +118,11 @@ AM_CFLAGS="-L ${srcdest}lib" objects= for c in $mes_SOURCES; do - o=$(basename $c .c).o + b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,) + o=$b.o if test ! -e $o -o ${srcdest}$c -nt $o; then echo " CC $c" - $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c + $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c fi objects="$objects $o" done diff --git a/build-aux/build-lib.sh b/build-aux/build-lib.sh index 4eaead50..b1caf80e 100755 --- a/build-aux/build-lib.sh +++ b/build-aux/build-lib.sh @@ -1,7 +1,7 @@ #! /bin/sh # GNU Mes --- Maxwell Equations of Software -# Copyright © 2019 Jan (janneke) Nieuwenhuizen +# Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # @@ -26,7 +26,8 @@ trap 'test -f .log && cat .log' EXIT mkdir -p $mes_cpu-mes -compile lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c +cp ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c . +compile crt1.c cp crt1.o $mes_cpu-mes if test -e crt1.s; then cp crt1.s $mes_cpu-mes diff --git a/build-aux/build.sh.in b/build-aux/build.sh.in index 3f356e10..b8900b1b 100644 --- a/build-aux/build.sh.in +++ b/build-aux/build.sh.in @@ -150,7 +150,6 @@ fi ${SHELL} ${srcdest}build-aux/build-lib.sh ${SHELL} ${srcdest}build-aux/build-source-lib.sh if $bootstrap; then - rm -f globals.* # FIXME: avoid name clash with globals from lib ${SHELL} ${srcdest}build-aux/build-mes.sh cp -f bin/mes-mescc ../bin cp -f bin/mes ../bin diff --git a/build-aux/cc.sh b/build-aux/cc.sh index 1a99e95f..edc93fba 100755 --- a/build-aux/cc.sh +++ b/build-aux/cc.sh @@ -1,5 +1,5 @@ # GNU Mes --- Maxwell Equations of Software -# Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen +# Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # @@ -18,8 +18,12 @@ objects= compile () { - c=${srcdest}$1 - b=$(basename $c .c) + if test $(dirname $1) = "."; then + c=$1 + else + c=${srcdest}$1 + fi + b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,) o=$b.o objects="$objects $o" if test ! -e $o -o $c -nt $o; then @@ -34,7 +38,7 @@ archive () { sources="$@" objects= for c in $sources; do - b=$(basename $c .c) + b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,) o=$b.o compile $c done From 402b024982af7c2fae3857b607f2988dc805baf6 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 4 Nov 2022 20:00:47 +0100 Subject: [PATCH 004/118] lib: mes/write: Rename from mes/mini-write.c * lib/mes/mini-write.c: Move to... * lib/mes/write.c: ...here. * build-aux/configure-lib.sh, kaem.run, scaffold/argv.kaem, scaffold/global-array.kaem, scaffold/hello.kaem, scaffold/local-array.kaem, scaffold/local-static-array.kaem, scaffold/read.kaem, simple.make, simple.sh: Update accordingly. --- build-aux/configure-lib.sh | 2 +- kaem.run | 2 +- lib/mes/{mini-write.c => write.c} | 0 scaffold/argv.kaem | 2 +- scaffold/global-array.kaem | 2 +- scaffold/hello.kaem | 2 +- scaffold/local-array.kaem | 2 +- scaffold/local-static-array.kaem | 2 +- scaffold/read.kaem | 2 +- simple.make | 2 +- simple.sh | 8 ++++---- 11 files changed, 13 insertions(+), 13 deletions(-) rename lib/mes/{mini-write.c => write.c} (100%) diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh index 609dcaff..7d1f9417 100644 --- a/build-aux/configure-lib.sh +++ b/build-aux/configure-lib.sh @@ -74,7 +74,7 @@ libc_mini_SOURCES="$libc_mini_shared_SOURCES" if test $mes_libc = mes; then libc_mini_SOURCES="$libc_mini_SOURCES -lib/mes/mini-write.c +lib/mes/write.c " fi diff --git a/kaem.run b/kaem.run index 1d8df90b..0b4a494a 100644 --- a/kaem.run +++ b/kaem.run @@ -35,7 +35,7 @@ M2-Planet \ -f lib/mes/globals.c \ -f lib/m2/cast.c \ -f lib/m2/exit.c \ - -f lib/mes/mini-write.c \ + -f lib/mes/write.c \ -f lib/linux/${mes_cpu}-mes-m2/syscall.c \ -f include/linux/${mes_cpu}/syscall.h \ -f lib/stub/__raise.c \ diff --git a/lib/mes/mini-write.c b/lib/mes/write.c similarity index 100% rename from lib/mes/mini-write.c rename to lib/mes/write.c diff --git a/scaffold/argv.kaem b/scaffold/argv.kaem index 6f29b008..8f3dfc51 100644 --- a/scaffold/argv.kaem +++ b/scaffold/argv.kaem @@ -32,7 +32,7 @@ M2-Planet \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \ -f lib/string/strlen.c \ - -f lib/mes/mini-write.c \ + -f lib/mes/write.c \ -f lib/mes/eputs.c \ -f lib/string/strcmp.c \ -f scaffold/argv.c \ diff --git a/scaffold/global-array.kaem b/scaffold/global-array.kaem index 121488df..0eee8336 100644 --- a/scaffold/global-array.kaem +++ b/scaffold/global-array.kaem @@ -30,7 +30,7 @@ M2-Planet \ -f lib/mes/globals.c \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \ - -f lib/mes/mini-write.c \ + -f lib/mes/write.c \ -f lib/string/strlen.c \ -f lib/string/strcpy.c \ -f lib/mes/eputs.c \ diff --git a/scaffold/hello.kaem b/scaffold/hello.kaem index a0eae1ff..24aff5e0 100644 --- a/scaffold/hello.kaem +++ b/scaffold/hello.kaem @@ -32,7 +32,7 @@ M2-Planet \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \ -f lib/string/strlen.c \ - -f lib/mes/mini-write.c \ + -f lib/mes/write.c \ -f lib/mes/eputs.c \ -f scaffold/hello.c \ -o scaffold/hello.M1 diff --git a/scaffold/local-array.kaem b/scaffold/local-array.kaem index 164877ba..dad4f917 100644 --- a/scaffold/local-array.kaem +++ b/scaffold/local-array.kaem @@ -30,7 +30,7 @@ M2-Planet \ -f lib/mes/globals.c \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \ - -f lib/mes/mini-write.c \ + -f lib/mes/write.c \ -f lib/string/strlen.c \ -f lib/string/strcpy.c \ -f lib/mes/eputs.c \ diff --git a/scaffold/local-static-array.kaem b/scaffold/local-static-array.kaem index 0878f41f..3b537d09 100644 --- a/scaffold/local-static-array.kaem +++ b/scaffold/local-static-array.kaem @@ -30,7 +30,7 @@ M2-Planet \ -f lib/mes/globals.c \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \ - -f lib/mes/mini-write.c \ + -f lib/mes/write.c \ -f lib/string/strlen.c \ -f lib/string/strcpy.c \ -f lib/mes/eputs.c \ diff --git a/scaffold/read.kaem b/scaffold/read.kaem index b29cf1f8..afddc146 100644 --- a/scaffold/read.kaem +++ b/scaffold/read.kaem @@ -35,7 +35,7 @@ M2-Planet \ -f include/linux/${mes_cpu}/syscall.h \ -f lib/m2/cast.c \ -f lib/string/strlen.c \ - -f lib/mes/mini-write.c \ + -f lib/mes/write.c \ -f lib/mes/eputs.c \ -f lib/linux/brk.c \ -f lib/m2/malloc.c \ diff --git a/simple.make b/simple.make index dcfcb1a8..8da48c3e 100644 --- a/simple.make +++ b/simple.make @@ -79,7 +79,7 @@ M2_SOURCES = \ lib/mes/globals.c \ lib/m2/cast.c \ lib/m2/exit.c \ - lib/mes/mini-write.c \ + lib/mes/write.c \ lib/linux/x86-mes-m2/syscall.c \ lib/stub/__raise.c \ lib/linux/brk.c \ diff --git a/simple.sh b/simple.sh index fc5ac371..70ddb211 100755 --- a/simple.sh +++ b/simple.sh @@ -109,7 +109,7 @@ MES_DEBUG=3 MES_ARENA=10000 MES_MAX_ARENA=10000 MES_BOOT=tests/gc.test out-syste # lib/linux/$mes_cpu-mes-mescc/_write.c\ # \ # lib/mes/globals.c\ -# lib/mes/mini-write.c\ +# lib/mes/write.c\ # lib/string/strlen.c\ # \ # scaffold/hello.c @@ -123,7 +123,7 @@ cat \ lib/linux/$mes_cpu-mes-mescc/_write.c \ \ lib/mes/globals.c \ - lib/mes/mini-write.c \ + lib/mes/write.c \ lib/string/strlen.c \ \ scaffold/hello.c \ @@ -313,7 +313,7 @@ MES_DEBUG=3 MES_ARENA=10000 MES_MAX_ARENA=10000 MES_BOOT=tests/gc.test out-mes/m # lib/linux/$mes_cpu-mes-mescc/_write.c\ # \ # lib/mes/globals.c\ -# lib/mes/mini-write.c\ +# lib/mes/write.c\ # lib/string/strlen.c\ # \ # scaffold/hello.c @@ -327,7 +327,7 @@ cat \ lib/linux/$mes_cpu-mes-mescc/_write.c \ \ lib/mes/globals.c \ - lib/mes/mini-write.c \ + lib/mes/write.c \ lib/string/strlen.c \ \ scaffold/hello.c \ From 37e8093bbb457ce323a42b9e746dedde1f3177c5 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 4 Nov 2022 06:44:23 +0100 Subject: [PATCH 005/118] guix: m2-planet: Update to 1.10.0. * guix/git/mes.scm (m2-planet): Update to 1.10.0. [supported-systems]: Add riscv32-linux, riscv64-linux. --- guix/git/mes.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/guix/git/mes.scm b/guix/git/mes.scm index eeb0786e..6a9f34fe 100644 --- a/guix/git/mes.scm +++ b/guix/git/mes.scm @@ -87,7 +87,7 @@ get_machine.") (define-public m2-planet (package (name "m2-planet") - (version "1.9.0") + (version "1.10.0") (source (origin (method git-fetch) (uri (git-reference @@ -97,9 +97,12 @@ get_machine.") (file-name (git-file-name name version)) (sha256 (base32 - "0cgvvq91cbxxm93k8ayyvhpaf3c2lv10qw4wyqwn3hc1qb1cfyvr")))) + "03ixvfdzhyy1d94iqpwl0p924pdvdp7yq4ggm05w3c013kzy2y12")))) (native-inputs (list mescc-tools)) (build-system gnu-build-system) + (supported-systems '("i686-linux" "x86_64-linux" + "armhf-linux" "aarch64-linux" + "riscv32-linux" "riscv64-linux")) (arguments `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")) (string-append "CC=" ,(cc-for-target))) From 468a9c7cd836d7df7fab1f10e6c01e7398bd385b Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 4 Nov 2022 10:01:59 +0100 Subject: [PATCH 006/118] kaem: main: Remove --bootstrap-mode. * scaffold/main.kaem: Remove --bootstrap-mode from M2-Planet call. --- scaffold/main.kaem | 1 - 1 file changed, 1 deletion(-) diff --git a/scaffold/main.kaem b/scaffold/main.kaem index 6fc079f0..23a077ab 100644 --- a/scaffold/main.kaem +++ b/scaffold/main.kaem @@ -24,7 +24,6 @@ mes_cpu=${mes_cpu:-x86} stage0_cpu=${stage0_cpu:-x86} M2-Planet \ - --bootstrap-mode \ --debug \ --architecture ${stage0_cpu} \ -f lib/linux/${mes_cpu}-mes-m2/crt1.c \ From fda2e4b9fc9b7a87995d092e5540a2d3effee6d3 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 4 Nov 2022 10:04:00 +0100 Subject: [PATCH 007/118] kaem: hello: Remove --bootstrap-mode. * include/mes/lib-mini.h: Remove M2 bootstrap constants. [__M2__](size_t): Fall-back to unsigned instead of unsigned long. * scaffold/hello.kaem: Use it instead of lib/m2/lib.h. Remove --bootstrap-mode from M2-Planet call. --- include/mes/lib-mini.h | 9 +++++---- scaffold/hello.kaem | 3 +-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/mes/lib-mini.h b/include/mes/lib-mini.h index 2874d527..b3f24316 100644 --- a/include/mes/lib-mini.h +++ b/include/mes/lib-mini.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2020,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -25,17 +25,14 @@ #include #endif -// CONSTANT STDIN 0 #ifndef STDIN #define STDIN 0 #endif -// CONSTANT STDOUT 1 #ifndef STDOUT #define STDOUT 1 #endif -// CONSTANT STDERR 2 #ifndef STDERR #define STDERR 2 #endif @@ -63,10 +60,14 @@ int oputs (char const *s); #ifndef __MES_SIZE_T #define __MES_SIZE_T #undef size_t +#if __M2__ +typedef unsigned size_t; +#else typedef unsigned long size_t; #endif #endif #endif +#endif #ifndef _SSIZE_T #define _SSIZE_T diff --git a/scaffold/hello.kaem b/scaffold/hello.kaem index 24aff5e0..f32a15b0 100644 --- a/scaffold/hello.kaem +++ b/scaffold/hello.kaem @@ -24,10 +24,9 @@ mes_cpu=${mes_cpu:-x86} stage0_cpu=${stage0_cpu:-x86} M2-Planet \ - --bootstrap-mode \ --debug \ --architecture ${stage0_cpu} \ - -f include/m2/lib.h \ + -f include/mes/lib-mini.h \ -f lib/linux/${mes_cpu}-mes-m2/crt1.c \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \ From 2a759f904d7f6ac2d59d20569aea9bf9e2fc6ad5 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 4 Nov 2022 10:13:35 +0100 Subject: [PATCH 008/118] kaem: argv: Remove --bootstrap-mode. * scaffold/argv.kaem: Use lib/mes/lib-mini.h instead of lib/m2/lib.h. Remove --bootstrap-mode from M2-Planet call. --- scaffold/argv.kaem | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scaffold/argv.kaem b/scaffold/argv.kaem index 8f3dfc51..1e2109db 100644 --- a/scaffold/argv.kaem +++ b/scaffold/argv.kaem @@ -24,10 +24,9 @@ mes_cpu=${mes_cpu:-x86} stage0_cpu=${stage0_cpu:-x86} M2-Planet \ - --bootstrap-mode \ --debug \ --architecture ${stage0_cpu} \ - -f include/m2/lib.h \ + -f include/mes/lib-mini.h \ -f lib/linux/${mes_cpu}-mes-m2/crt1.c \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \ From 4d4e6959e957f62d1d7df8bae0dc3ce3c088c1e6 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 4 Nov 2022 10:14:22 +0100 Subject: [PATCH 009/118] kaem: read: Remove --bootstrap-mode. * include/mes/lib.h[__M2__](__call_at_exit,abtod,dtoab,ultoa, * include/sys/types.h[__M2__]: Fall back to unsigned instead of using unsigned long. * include/stdio.h[__M2__](fprintf, fscanf, printf, snprintf, sprintf, sscanf): Hide prototypes. * lib/stdlib/exit.c (exit)[__M2__]: Hide call to __call_at_exit. * lib/linux/read.c (read)[__M2__]: Hide debugging. * lib/linux/malloc.c (malloc)[__M2__]: Hide alignment. __mesabi_umod, __mesabi_udiv, __mesabi_uldiv): Hide prototypes. * scaffold/argv.kaem: Use them together with lib/mes/lib-mini.h instead of lib/mes/* specializations. Remove --bootstrap-mode from M2-Planet call. --- include/mes/lib.h | 31 ++++++++++++++++--------------- include/stdio.h | 17 ++++++++++------- include/sys/types.h | 18 +++++++++++++++++- lib/linux/malloc.c | 4 +++- lib/linux/read.c | 5 ++++- lib/stdlib/exit.c | 6 +++++- scaffold/read.kaem | 15 ++++++++------- 7 files changed, 63 insertions(+), 33 deletions(-) diff --git a/include/mes/lib.h b/include/mes/lib.h index ceb2fb48..7f840006 100644 --- a/include/mes/lib.h +++ b/include/mes/lib.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -23,6 +23,9 @@ #include +#define __FILEDES_MAX 512 +extern char *__brk; + char *cast_intp_to_charp (int const *i); char *cast_long_to_charp (long i); long cast_charp_to_long (char const *); @@ -34,14 +37,11 @@ void __ungetc_init (); void __ungetc_clear (int filedes); void __ungetc_set (int filedes, int c); int __ungetc_p (int filedes); -double abtod (char const **p, int base); long abtol (char const **p, int base); -char *dtoab (double number, int base, int signed_p); char *itoa (int number); char *ltoa (long number); char *ltoab (long x, int base); char *ntoab (long number, unsigned base, int signed_p); -char *ultoa (unsigned long number); char *utoa (unsigned number); int eputc (int c); int fdgetc (int fd); @@ -61,10 +61,12 @@ char *search_path (char const *file_name); ssize_t _read (int fd, void *buffer, size_t size); void assert_msg (int check, char *msg); -extern char *__brk; -extern void (*__call_at_exit) (void); - -#define __FILEDES_MAX 512 +long __mesabi_imod (long a, long b); +long __mesabi_idiv (long a, long b); +void *__memcpy (void *dest, void const *src, size_t n); +void *__memmove (void *dest, void const *src, size_t n); +void *__memset (void *s, int c, size_t n); +int __raise (int signal); #if !SYSTEM_LIBC void __assert_fail (char const *s, char const *file, unsigned line, @@ -75,16 +77,15 @@ void _exit (int code); long brk (void *addr); #endif // !SYSTEM_LIBC -long __mesabi_imod (long a, long b); -long __mesabi_idiv (long a, long b); +#if !__M2__ +extern void (*__call_at_exit) (void); +double abtod (char const **p, int base); +char *dtoab (double number, int base, int signed_p); +char *ultoa (unsigned long number); unsigned long __mesabi_umod (unsigned long a, unsigned long b); unsigned long __mesabi_udiv (unsigned long a, unsigned long b); unsigned long __mesabi_uldiv (unsigned long a, unsigned long b, unsigned long *remainder); - -void *__memcpy (void *dest, void const *src, size_t n); -void *__memmove (void *dest, void const *src, size_t n); -void *__memset (void *s, int c, size_t n); -int __raise (int signal); +#endif #endif //__MES_LIB_H diff --git a/include/stdio.h b/include/stdio.h index c8684e0f..c68576e0 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -65,30 +65,33 @@ int ferror (FILE * stream); int fflush (FILE * stream); int fgetc (FILE * stream); char *fgets (char *s, int size, FILE * stream); -int fprintf (FILE * stream, char const *format, ...); int fpurge (FILE * stream); int fputc (int c, FILE * stream); int fputs (char const *s, FILE * stream); -int fscanf (FILE * stream, char const *template, ...); int fseek (FILE * stream, long offset, int whence); int getc (FILE * stream); int getchar (void); char *getlogin (void); -int printf (char const *format, ...); int putc (int c, FILE * stream); int putchar (int c); int puts (char const *s); int remove (char const *file_name); int setvbuf (FILE * stream, char *buf, int mode, size_t size); -int snprintf (char *str, size_t size, char const *format, ...); -int sprintf (char *str, char const *format, ...); -int sscanf (char const *str, char const *format, ...); int ungetc (int c, FILE * stream); long ftell (FILE * stream); size_t fread (void *ptr, size_t size, size_t count, FILE * stream); size_t freadahead (FILE * fp); size_t fwrite (void const *ptr, size_t size, size_t count, FILE * stream); +#if !__M2__ +int fprintf (FILE * stream, char const *format, ...); +int fscanf (FILE * stream, char const *template, ...); +int printf (char const *format, ...); +int snprintf (char *str, size_t size, char const *format, ...); +int sprintf (char *str, char const *format, ...); +int sscanf (char const *str, char const *format, ...); +#endif // !__M2__ + #endif // ! SYSTEM_LIBC #endif // __MES_STDIO_H diff --git a/include/sys/types.h b/include/sys/types.h index 7c2cc9be..24ea71c7 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -66,15 +66,23 @@ typedef unsigned gid_t; #ifndef __MES_INO_T #define __MES_INO_T #undef ino_t +#if __M2__ +typedef unsigned ino_t; +#else typedef unsigned long ino_t; #endif +#endif #if __SIZEOF_LONG_LONG__ == 8 #ifndef __MES_INO64_T #define __MES_INO64_T #undef ino64_t +#if __M2__ +typedef unsigned ino64_t; +#else typedef unsigned long long ino64_t; #endif +#endif #endif // __SIZEOF_LONG_LONG__ == 8 #if !defined (__MES_INTPTR_T) && !defined (__intptr_t_defined) @@ -83,8 +91,12 @@ typedef unsigned long long ino64_t; #undef intptr_t typedef long intptr_t; #undef uintptr_t +#if __M2__ +typedef unsigned uintptr_t; +#else typedef unsigned long uintptr_t; #endif +#endif #ifndef __MES_OFF_T #define __MES_OFF_T @@ -96,8 +108,12 @@ typedef long off_t; #ifndef __MES_OFF64_T #define __MES_OFF64_T #undef off64_t +#if __M2__ +typedef unsigned off64_t; +#else typedef unsigned long long off64_t; #endif +#endif #endif // __SIZEOF_LONG_LONG__ == 8 #ifndef __MES_PID_T diff --git a/lib/linux/malloc.c b/lib/linux/malloc.c index ea609d5d..e6f3c07e 100644 --- a/lib/linux/malloc.c +++ b/lib/linux/malloc.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2021 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2021,2022 Jan (janneke) Nieuwenhuizen * Copyright © 2021 Danny Milosavljevic * * This file is part of GNU Mes. @@ -31,9 +31,11 @@ malloc (size_t size) { if (!__brk) __brk = cast_long_to_charp (brk (0)); +#if !__M2__ /* align what we give back. */ __brk = (char*) (((uintptr_t) __brk + sizeof (max_align_t) - 1) & -sizeof (max_align_t)); +#endif if (brk (__brk + size) == -1) return 0; char *p = __brk; diff --git a/lib/linux/read.c b/lib/linux/read.c index a57cff4a..abe2b4f4 100644 --- a/lib/linux/read.c +++ b/lib/linux/read.c @@ -27,7 +27,9 @@ ssize_t read (int filedes, void *buffer, size_t size) { long long_filedes = filedes; - ssize_t bytes = _sys_call3 (SYS_read, long_filedes, (long) buffer, (long) size); + long long_buffer = cast_voidp_to_long (buffer); + ssize_t bytes = _sys_call3 (SYS_read, long_filedes, long_buffer, size); +#if !__M2__ if (__mes_debug () > 4) { if (bytes == 1) @@ -48,5 +50,6 @@ read (int filedes, void *buffer, size_t size) eputs ("\n"); } } +#endif return bytes; } diff --git a/lib/stdlib/exit.c b/lib/stdlib/exit.c index 252ecf92..10b06d40 100644 --- a/lib/stdlib/exit.c +++ b/lib/stdlib/exit.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -20,12 +20,16 @@ #include +#if !__M2__ void (*__call_at_exit) (void); +#endif void exit (int code) { +#if !__M2__ if (__call_at_exit) (*__call_at_exit) (); +#endif _exit (code); } diff --git a/scaffold/read.kaem b/scaffold/read.kaem index afddc146..f23e2dfb 100644 --- a/scaffold/read.kaem +++ b/scaffold/read.kaem @@ -24,28 +24,29 @@ mes_cpu=${mes_cpu:-x86} stage0_cpu=${stage0_cpu:-x86} M2-Planet \ - --bootstrap-mode \ --debug \ --architecture ${stage0_cpu} \ - -f include/m2/lib.h \ -f lib/linux/${mes_cpu}-mes-m2/crt1.c \ - -f lib/linux/${mes_cpu}-mes-m2/_exit.c \ + -f include/mes/lib-mini.h \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \ - -f lib/linux/${mes_cpu}-mes-m2/syscall.c \ + -f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f include/linux/${mes_cpu}/syscall.h \ + -f lib/linux/${mes_cpu}-mes-m2/syscall.c \ -f lib/m2/cast.c \ + -f include/mes/lib.h \ -f lib/string/strlen.c \ -f lib/mes/write.c \ -f lib/mes/eputs.c \ -f lib/linux/brk.c \ - -f lib/m2/malloc.c \ + -f lib/linux/malloc.c \ -f lib/string/memset.c \ - -f lib/m2/read.c \ + -f lib/linux/read.c \ -f lib/mes/fdgetc.c \ -f lib/stdio/getchar.c \ -f lib/stdio/putchar.c \ -f lib/m2/open.c \ - -f lib/m2/mes_open.c \ + -f include/sys/types.h \ + -f include/stdio.h \ -f scaffold/read.c \ -o scaffold/read.M1 From 6ec74a34c4f4fbdeec8d413e851304a3e5366814 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 4 Nov 2022 15:23:49 +0100 Subject: [PATCH 010/118] lib: linux/_open3: Support M2-Planet. * lib/linux/_open3.c (_open3): Use function casting. Also call __ungetc_init. * lib/stub/__buffered_read.c: New file. --- lib/linux/_open3.c | 6 ++++-- lib/stub/__buffered_read.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 lib/stub/__buffered_read.c diff --git a/lib/linux/_open3.c b/lib/linux/_open3.c index cfad689a..b67da57a 100644 --- a/lib/linux/_open3.c +++ b/lib/linux/_open3.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -26,7 +26,9 @@ int _open3 (char const *file_name, int flags, int mask) { - int r = _sys_call3 (SYS_open, (long) file_name, (int) flags, (int) mask); + long long_file_name = cast_charp_to_long (file_name); + int r = _sys_call3 (SYS_open, long_file_name, flags, mask); + __ungetc_init (); if (r > 2) { __ungetc_clear (r); diff --git a/lib/stub/__buffered_read.c b/lib/stub/__buffered_read.c new file mode 100644 index 00000000..aaa00247 --- /dev/null +++ b/lib/stub/__buffered_read.c @@ -0,0 +1,33 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include +#include +#include + +void +__buffered_read_init (int filedes) +{ +} + +size_t +__buffered_read_clear (int filedes) +{ +} From e354d912efe1e4b7147f880a948894897d65473d Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 4 Nov 2022 15:25:38 +0100 Subject: [PATCH 011/118] lib: posix/open: Support M2-Planet. * lib/posix/open.c (open)[__M2__]: New function. --- lib/posix/open.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/posix/open.c b/lib/posix/open.c index 490c3ec9..d99b91c6 100644 --- a/lib/posix/open.c +++ b/lib/posix/open.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -29,6 +29,13 @@ _open2 (char const *file_name, int flags) return _open3 (file_name, flags, mask); } +#if __M2__ +int +open (char const *file_name, int flags, int mask) +{ + return _open3 (file_name, flags, mask); +} +#else // !__M2__ int open (char const *file_name, int flags, ...) { @@ -44,3 +51,4 @@ open (char const *file_name, int flags, ...) else return _open2 (file_name, flags); } +#endif // !__M2__ From dad460189fa2c5a1300f3f495a0da694cb69d7c4 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Mon, 14 Nov 2022 05:25:55 +0100 Subject: [PATCH 012/118] kaem.run: Remove --bootstrap-mode. * include/linux/arm/syscall.h, include/linux/x86/syscall.h, include/mes/constants.h: Remove CONSTANTs. * lib/m2/open.c: Move to... * lib/linux/open.c: ...here. Update to make gcc-compatible. * scaffold/argv.kaem: Update accordingly. * lib/linux/lseek.c (_leek, lseek): Suport M2-Planet. * lib/linux/_open3.c (_open3): Fix cast. * lib/linux/waitpid.c (waitpid): Suport M2-Planet. * lib/m2/getcwd.c (PATH_MAX): Remove CONSTANT. * lib/m2/isatty.c (TCGETS): Remove CONSTANT. * lib/mes/ntoab.c: Support M2-Planet. * lib/posix/getcwd.c (__getcwd_buf): Remove. * lib/posix/getenv.c (M2_PTR_SIZE)[__M2__]: Update to #define. * lib/posix/setenv.c: Likewise. * lib/stub/__raise.c (SIGABRT): Remove CONSTANT. * src/core.c (error): Use __M2__ instead of __M2_PLANET__. * src/gc.c (M2_CELL_SIZE)[__M2__]: Update to #define. Support non-bootstrap-mode. * src/symbol.c: Likewise. * src/vector.c: Likewise. * src/posix.c: Likewise. (__raise): Move to... * include/mes/lib-cc.h (__raise): ...this new file to avoid M2-Planet crash. * include/sys/types.h: Include it. * lib/mes/div.c (__raise): Remove prototype. [__TINYC__ || SYSTEM_LIBC] (__raise): Remove macro. * include/mes/lib.h (__raise)[SYSTEM_LIBC]: Remove prototype. * kaem.run: Remove --botstrap-mode. Update source list accordingly. * simple.make (M2_PLANET_FLAGS): Remove --bootstrap-mode. * simple.make (M2_SOURCES, M2_PLANET_INCLUDES): Update source list accordingly. * include/sys/types.h (EOF): Move to... * include/mes/lib-cccc.h (EOF): ...here, and... * include/m2/types.h (EOF): ...here, to avoid M2-Planet crash. --- build-aux/pointer.sh | 1 - include/fcntl.h | 3 ++ include/linux/arm/syscall.h | 18 ------- include/linux/x86/syscall.h | 22 +-------- include/m2/lib.h | 70 --------------------------- include/m2/types.h | 7 +++ include/mes/constants.h | 46 +----------------- lib/m2/exit.c => include/mes/lib-cc.h | 16 +++--- include/mes/lib.h | 5 +- include/mes/symbols.h | 8 +-- include/signal.h | 9 +++- include/sys/ioctl.h | 5 ++ include/sys/types.h | 10 ++-- include/time.h | 6 +-- kaem.run | 33 ++++++++----- lib/linux/lseek.c | 12 ++--- lib/{m2 => linux}/open.c | 17 ++++++- lib/linux/waitpid.c | 9 ++-- lib/m2/chmod.c | 31 ------------ lib/m2/clock_gettime.c | 30 ------------ lib/m2/getcwd.c | 4 +- lib/m2/isatty.c | 3 +- lib/m2/malloc.c | 36 -------------- lib/m2/mes_open.c | 28 ----------- lib/m2/read.c | 31 ------------ lib/m2/waitpid.c | 39 --------------- lib/mes/div.c | 6 --- lib/mes/ntoab.c | 14 +++++- lib/posix/getcwd.c | 4 +- lib/posix/getenv.c | 7 ++- lib/posix/setenv.c | 7 ++- lib/stub/__raise.c | 4 +- scaffold/read.kaem | 3 +- simple.make | 46 ++++++++++-------- src/core.c | 2 +- src/gc.c | 17 +++++-- src/posix.c | 17 ++++--- src/symbol.c | 6 +-- src/test/gc.c | 7 ++- src/vector.c | 6 +-- 40 files changed, 182 insertions(+), 463 deletions(-) delete mode 100644 include/m2/lib.h rename lib/m2/exit.c => include/mes/lib-cc.h (78%) rename lib/{m2 => linux}/open.c (73%) delete mode 100644 lib/m2/chmod.c delete mode 100644 lib/m2/clock_gettime.c delete mode 100644 lib/m2/malloc.c delete mode 100644 lib/m2/mes_open.c delete mode 100644 lib/m2/read.c delete mode 100644 lib/m2/waitpid.c diff --git a/build-aux/pointer.sh b/build-aux/pointer.sh index 384b0689..51cea49f 100755 --- a/build-aux/pointer.sh +++ b/build-aux/pointer.sh @@ -48,7 +48,6 @@ sed -ri \ include/mes/mes.h \ include/mes/symbols.h \ include/mes/builtins.h \ - include/m2/lib.h \ src/builtins.c \ src/cc.c \ src/core.c \ diff --git a/include/fcntl.h b/include/fcntl.h index 2a8ece80..c5bc6951 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -69,8 +69,11 @@ #define creat(file_name, mode) open (file_name, O_WRONLY | O_CREAT | O_TRUNC, mode) int dup (int old); int dup2 (int old, int new); + +#if !__M2__ int fcntl (int filedes, int command, ...); int open (char const *s, int flags, ...); +#endif #endif // ! SYSTEM_LIBC diff --git a/include/linux/arm/syscall.h b/include/linux/arm/syscall.h index ca9f1f97..d25c78c0 100644 --- a/include/linux/arm/syscall.h +++ b/include/linux/arm/syscall.h @@ -25,47 +25,29 @@ /* libc-mini */ #ifndef SYS_exit -// CONSTANT SYS_exit 0x01 #define SYS_exit 0x01 #endif #ifndef SYS_write -// CONSTANT SYS_write 0x04 #define SYS_write 0x04 #endif /* libc */ -// CONSTANT SYS_fork 0x02 #define SYS_fork 0x02 -// CONSTANT SYS_read 0x03 #define SYS_read 0x03 -// CONSTANT SYS_open 0x05 #define SYS_open 0x05 //#define SYS_waitpid -// CONSTANT SYS_wait4 0x72 #define SYS_wait4 0x72 -// CONSTANT SYS_execve 0x0b #define SYS_execve 0x0b -// CONSTANT SYS_chmod 0x0f #define SYS_chmod 0x0f -// CONSTANT SYS_access 0x21 #define SYS_access 0x21 -// CONSTANT SYS_brk 0x2d #define SYS_brk 0x2d -// CONSTANT SYS_ioctl 0x36 #define SYS_ioctl 0x36 -// CONSTANT SYS_fsync 0x76 #define SYS_fsync 0x76 -// CONSTANT SYS_getcwd 0xb7 #define SYS_getcwd 0xb7 -// CONSTANT SYS_dup 0x29 #define SYS_dup 0x29 -// CONSTANT SYS_dup2 0x3f #define SYS_dup2 0x3f -// CONSTANT SYS_unlink 0x0a #define SYS_unlink 0x0a -// CONSTANT SYS_gettimeofday 0x4e #define SYS_gettimeofday 0x4e -// CONSTANT SYS_clock_gettime 0x107 #define SYS_clock_gettime 0x107 /* libc+tcc */ diff --git a/include/linux/x86/syscall.h b/include/linux/x86/syscall.h index d849c175..abf1759b 100644 --- a/include/linux/x86/syscall.h +++ b/include/linux/x86/syscall.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -22,50 +22,30 @@ /* libc-mini */ #ifndef SYS_exit -// CONSTANT SYS_exit 0x01 #define SYS_exit 0x01 #endif #ifndef SYS_write -// CONSTANT SYS_write 0x04 #define SYS_write 0x04 #endif /* libc */ -// CONSTANT SYS_fork 0x02 #define SYS_fork 0x02 -// CONSTANT SYS_read 0x03 #define SYS_read 0x03 -// CONSTANT SYS_open 0x05 #define SYS_open 0x05 -// CONSTANT SYS_waitpid 0x07 #define SYS_waitpid 0x07 -// CONSTANT SYS_wait4 0x72 #define SYS_wait4 0x72 -// CONSTANT SYS_execve 0x0b #define SYS_execve 0x0b -// CONSTANT SYS_chmod 0x0f #define SYS_chmod 0x0f -// CONSTANT SYS_access 0x21 #define SYS_access 0x21 -// CONSTANT SYS_brk 0x2d #define SYS_brk 0x2d -// CONSTANT SYS_ioctl 0x36 #define SYS_ioctl 0x36 -// CONSTANT SYS_fsync 0x76 #define SYS_fsync 0x76 -// CONSTANT SYS_getcwd 0xb7 #define SYS_getcwd 0xb7 -// CONSTANT SYS_dup 0x29 #define SYS_dup 0x29 -// CONSTANT SYS_dup2 0x3f #define SYS_dup2 0x3f -// CONSTANT SYS_unlink 0x0a #define SYS_unlink 0x0a -// CONSTANT SYS_gettimeofday 0x4e #define SYS_gettimeofday 0x4e -// CONSTANT SYS_clock_gettime 0x109 #define SYS_clock_gettime 0x109 -// CONSTANT SYS_time 0x0d #define SYS_time 0x0d /* libc+tcc */ diff --git a/include/m2/lib.h b/include/m2/lib.h deleted file mode 100644 index 93762931..00000000 --- a/include/m2/lib.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * GNU Mes --- Maxwell Equations of Software - * Copyright © 2019 Jan (janneke) Nieuwenhuizen - * - * This file is part of GNU Mes. - * - * GNU Mes is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * GNU Mes is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Mes. If not, see . - */ - -#ifndef __M2_LIB_H -#define __M2_LIB_H - -char **environ; -int __stdin; -int __stdout; -int __stderr; -int errno; - -// CONSTANT EOF 0xffffffff -// CONSTANT __FILEDES_MAX 512 - -char* cast_intp_to_charp (int *i); -char* cast_long_to_charp (long i); -long cast_charp_to_long (char const *); -long cast_int_to_long (int i); -long cast_voidp_to_long (void const *); - -char *itoa (int number); -char *ltoa (long number); -int __ungetc_p (int filedes); -int eputs (char *s); -int oputs (char *s); -int puts (char *s); -size_t strlen (char *s); -ssize_t _write (); -ssize_t write (int filedes, void *buffer, size_t size); -void __ungetc_clear (int filedes); -void __ungetc_init (); -void __ungetc_set (int filedes, int c); - -struct timezone -{ - int tz_minuteswest; - int tz_dsttime; -}; - -struct timespec -{ - long tv_sec; - long tv_nsec; -}; - -struct timeval -{ - long tv_sec; - long tv_usec; -}; - -#endif /* __M2_LIB_H */ diff --git a/include/m2/types.h b/include/m2/types.h index c5547f5c..91360223 100644 --- a/include/m2/types.h +++ b/include/m2/types.h @@ -20,6 +20,13 @@ #ifndef __M2_TYPES_H #define __M2_TYPES_H 1 +// FIXME M2_Planet chokes on -1, even inside #if ! __M2__ +#if __arm__ || __i386__ +#define EOF 0xffffffff +#else +#define EOF 0xffffffffffffffff +#endif + /* #ifndef __MES_CLOCK_T #define __MES_CLOCK_T diff --git a/include/mes/constants.h b/include/mes/constants.h index 42424390..ebf7787a 100644 --- a/include/mes/constants.h +++ b/include/mes/constants.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -23,76 +23,32 @@ /* Cell types */ -// CONSTANT TCHAR 0 #define TCHAR 0 -// CONSTANT TBYTES 1 #define TBYTES 1 -// CONSTANT TCLOSURE 2 #define TCLOSURE 2 -// CONSTANT TCONTINUATION 3 #define TCONTINUATION 3 -// CONSTANT TKEYWORD 4 #define TKEYWORD 4 -// CONSTANT TMACRO 5 #define TMACRO 5 -// CONSTANT TNUMBER 6 #define TNUMBER 6 -// CONSTANT TPAIR 7 #define TPAIR 7 -// CONSTANT TPORT 8 #define TPORT 8 -// CONSTANT TREF 9 #define TREF 9 -// CONSTANT TSPECIAL 10 #define TSPECIAL 10 -// CONSTANT TSTRING 11 #define TSTRING 11 -// CONSTANT TSTRUCT 12 #define TSTRUCT 12 -// CONSTANT TSYMBOL 13 #define TSYMBOL 13 -// CONSTANT TVALUES 14 #define TVALUES 14 -// CONSTANT TVARIABLE 15 #define TVARIABLE 15 -// CONSTANT TVECTOR 16 #define TVECTOR 16 -// CONSTANT TBROKEN_HEART 17 #define TBROKEN_HEART 17 /* Struct types */ -// CONSTANT STRUCT_TYPE 0 #define STRUCT_TYPE 0 -// CONSTANT STRUCT_PRINTER 1 #define STRUCT_PRINTER 1 -// CONSTANT GC_FRAME_SIZE 5 #define GC_FRAME_SIZE 5 -// CONSTANT GC_FRAME_PROCEDURE 4 #define GC_FRAME_PROCEDURE 4 -// CONSTANT STDIN 0 -// CONSTANT STDOUT 1 -// CONSTANT STDERR 2 - -/* Unknown type 1 -// CONSTANT EOF -1 -*/ - -// CONSTANT O_RDONLY 0 -// CONSTANT O_WRONLY 1 -// CONSTANT O_CREAT 0x40 -// CONSTANT O_TRUNC 0x200 - -// CONSTANT PATH_MAX 1024 -// CONSTANT __FILEDES_MAX 512 - -// CONSTANT S_IRUSR 00400 -// CONSTANT S_IWUSR 00200 - -// CONSTANT CLOCK_PROCESS_CPUTIME_ID 2 - - #endif /* __MES_CONSTANTS_H */ diff --git a/lib/m2/exit.c b/include/mes/lib-cc.h similarity index 78% rename from lib/m2/exit.c rename to include/mes/lib-cc.h index 2fa78612..55c4fb1d 100644 --- a/lib/m2/exit.c +++ b/include/mes/lib-cc.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -17,13 +17,13 @@ * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ +#ifndef __MES_LIB_CC_H +#define __MES_LIB_CC_H -#include +#define EOF -1 -void _exit (int code); +#if __TINYC__ || SYSTEM_LIBC +#define __raise(x) -1 +#endif -void -exit (int code) -{ - _exit (code); -} +#endif //__MES_LIB_CC_H diff --git a/include/mes/lib.h b/include/mes/lib.h index 7f840006..96a40f59 100644 --- a/include/mes/lib.h +++ b/include/mes/lib.h @@ -22,6 +22,7 @@ #define __MES_LIB_H #include +#include #define __FILEDES_MAX 512 extern char *__brk; @@ -66,7 +67,6 @@ long __mesabi_idiv (long a, long b); void *__memcpy (void *dest, void const *src, size_t n); void *__memmove (void *dest, void const *src, size_t n); void *__memset (void *s, int c, size_t n); -int __raise (int signal); #if !SYSTEM_LIBC void __assert_fail (char const *s, char const *file, unsigned line, @@ -75,6 +75,9 @@ ssize_t __buffered_read (int filedes, void *buffer, size_t size); size_t __buffered_read_clear (int filedes); void _exit (int code); long brk (void *addr); +#ifndef __raise +int __raise (int signal); +#endif #endif // !SYSTEM_LIBC #if !__M2__ diff --git a/include/mes/symbols.h b/include/mes/symbols.h index 490fa1e2..6e435720 100644 --- a/include/mes/symbols.h +++ b/include/mes/symbols.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2021 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2021,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -137,14 +137,8 @@ extern struct scm *cell_type_broken_heart; extern struct scm *cell_symbol_program; extern struct scm *cell_symbol_test; -// CONSTANT SYMBOL_MAX 114 #define SYMBOL_MAX 114 - -// CONSTANT CELL_UNSPECIFIED 7 #define CELL_UNSPECIFIED 7 - -// CONSTANT CELL_SYMBOL_RECORD_TYPE 82 #define CELL_SYMBOL_RECORD_TYPE 82 - #endif /* __MES_SYMBOLS_H */ diff --git a/include/signal.h b/include/signal.h index 07730b02..aef1da50 100644 --- a/include/signal.h +++ b/include/signal.h @@ -29,9 +29,12 @@ #define _SIGSET_NITEMS (_NSIG / (8 * sizeof(unsigned long))) -typedef struct { +#if !__M2__ +typedef struct +{ unsigned long items[_SIGSET_NITEMS]; } sigset_t; +#endif typedef long stack_t; #include @@ -91,6 +94,7 @@ typedef long stack_t; #define SA_NOMASK SA_NODEFER #define SA_ONESHOT SA_RESETHAND +#if !__M2__ // lacks short, casts typedef struct siginfo_t { int si_signo; @@ -120,7 +124,7 @@ typedef struct siginfo_t } siginfo_t; // *INDENT-ON* -#if __MESC__ +#if __M2__ || __MESC__ typedef long sighandler_t; #else typedef void (*sighandler_t) (int); @@ -255,6 +259,7 @@ int sigemptyset (sigset_t * set); #endif int sigprocmask (int how, sigset_t const *set, sigset_t * oldset); +#endif // !__M2__ #endif //! SYSTEM_LIBC #endif // __MES_SIGNAL_H diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h index 2650929e..c4bf13e5 100644 --- a/include/sys/ioctl.h +++ b/include/sys/ioctl.h @@ -28,8 +28,13 @@ #define TCGETS 0x5401 #define TCGETA 0x5405 +#if __M2__ +int ioctl (int fd, unsigned request, long data); +int ioctl3 (int fd, unsigned request, long data); +#else int ioctl (int fd, unsigned long request, ...); int ioctl3 (int fd, unsigned long request, long data); +#endif #endif // ! SYSTEM_LIBC diff --git a/include/sys/types.h b/include/sys/types.h index 24ea71c7..b9e0d553 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -20,6 +20,8 @@ #ifndef __MES_SYS_TYPES_H #define __MES_SYS_TYPES_H 1 +#include + #if SYSTEM_LIBC #undef __MES_SYS_TYPES_H #include_next @@ -31,10 +33,6 @@ #define __MESCCLIB__ 15 #endif -#ifndef EOF -#define EOF -1 -#endif - #ifndef NULL #define NULL 0 #endif @@ -142,9 +140,13 @@ typedef long sigval_t; #ifndef __MES_SIZE_T #define __MES_SIZE_T #undef size_t +#if __M2__ +typedef unsigned size_t; +#else typedef unsigned long size_t; #endif #endif +#endif #ifndef __MES_SSIZE_T #define __MES_SSIZE_T diff --git a/include/time.h b/include/time.h index 161d006f..189200a1 100644 --- a/include/time.h +++ b/include/time.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -27,8 +27,8 @@ #ifndef __MES_TIME_T #define __MES_TIME_T 1 -typedef long int clockid_t; -typedef long int time_t; +typedef long clockid_t; +typedef long time_t; #endif struct tm diff --git a/kaem.run b/kaem.run index 0b4a494a..024c268c 100644 --- a/kaem.run +++ b/kaem.run @@ -25,35 +25,42 @@ stage0_cpu=${stage0_cpu:-x86} mkdir -p m2 M2-Planet \ - --bootstrap-mode \ --debug \ --architecture ${stage0_cpu} \ - -f include/m2/lib.h \ + -D __linux__=1 \ + -f include/mes/config.h \ + -f include/mes/lib-mini.h \ + -f include/mes/lib.h \ -f lib/linux/${mes_cpu}-mes-m2/crt1.c \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \ -f lib/mes/globals.c \ -f lib/m2/cast.c \ - -f lib/m2/exit.c \ + -f lib/stdlib/exit.c \ -f lib/mes/write.c \ - -f lib/linux/${mes_cpu}-mes-m2/syscall.c \ -f include/linux/${mes_cpu}/syscall.h \ + -f lib/linux/${mes_cpu}-mes-m2/syscall.c \ -f lib/stub/__raise.c \ -f lib/linux/brk.c \ - -f lib/m2/malloc.c \ + -f lib/linux/malloc.c \ -f lib/string/memset.c \ - -f lib/m2/read.c \ + -f lib/linux/read.c \ -f lib/mes/fdgetc.c \ -f lib/stdio/getchar.c \ -f lib/stdio/putchar.c \ - -f lib/m2/open.c \ - -f lib/m2/mes_open.c \ + -f lib/stub/__buffered_read.c \ + -f lib/linux/_open3.c \ + -f lib/linux/open.c \ + -f lib/mes/mes_open.c \ -f lib/string/strlen.c \ -f lib/mes/eputs.c \ -f lib/mes/fdputc.c \ -f lib/mes/eputc.c \ \ + -f include/time.h \ + -f include/sys/time.h \ -f include/m2/types.h \ + -f include/sys/types.h \ -f include/mes/mes.h \ -f include/mes/builtins.h \ -f include/mes/constants.h \ @@ -84,17 +91,19 @@ M2-Planet \ -f lib/linux/access.c \ -f include/linux/m2/kernel-stat.h \ -f include/sys/stat.h \ - -f lib/m2/chmod.c \ + -f lib/linux/chmod.c \ -f lib/linux/ioctl3.c \ + -f include/sys/ioctl.h \ -f lib/m2/isatty.c \ -f lib/linux/fork.c \ -f lib/m2/execve.c \ -f lib/m2/execv.c \ - -f lib/m2/waitpid.c \ + -f lib/linux/waitpid.c \ -f lib/linux/gettimeofday.c \ - -f lib/m2/clock_gettime.c \ + -f lib/linux/clock_gettime.c \ -f lib/m2/time.c \ -f lib/linux/_getcwd.c \ + -f include/limits.h \ -f lib/m2/getcwd.c \ -f lib/linux/dup.c \ -f lib/linux/dup2.c \ @@ -105,6 +114,7 @@ M2-Planet \ -f src/core.c \ -f src/display.c \ -f src/eval-apply.c \ + -f include/fcntl.h \ -f src/gc.c \ -f src/hash.c \ -f src/lib.c \ @@ -112,6 +122,7 @@ M2-Planet \ -f src/math.c \ -f src/mes.c \ -f src/module.c \ + -f include/signal.h \ -f src/posix.c \ -f src/reader.c \ -f src/stack.c \ diff --git a/lib/linux/lseek.c b/lib/linux/lseek.c index c72a75cf..763adc62 100644 --- a/lib/linux/lseek.c +++ b/lib/linux/lseek.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -24,23 +24,23 @@ #include #include -#if !__MESC__ /* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same. */ off_t _lseek (int filedes, off_t offset, int whence) { - return _sys_call3 (SYS_lseek, (int) filedes, (long) offset, (int) whence); + long long_offset = offset; + return _sys_call3 (SYS_lseek, filedes, long_offset, whence); } -#endif off_t lseek (int filedes, off_t offset, int whence) { -#if !__MESC__ /* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same. */ +#if !__MESC__ && !__M2__ if (_lseek (filedes, 0, SEEK_CUR) == -1) return -1; #endif size_t skip = __buffered_read_clear (filedes); if (whence == SEEK_CUR) offset -= skip; - return _sys_call3 (SYS_lseek, (int) filedes, (long) offset, (int) whence); + long long_offset = offset; + return _sys_call3 (SYS_lseek, filedes, long_offset, whence); } diff --git a/lib/m2/open.c b/lib/linux/open.c similarity index 73% rename from lib/m2/open.c rename to lib/linux/open.c index ee5513e7..1806dfa6 100644 --- a/lib/m2/open.c +++ b/lib/linux/open.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -24,6 +24,7 @@ #include #include +#if __M2__ int open (char *file_name, int flags, int mask) { @@ -32,3 +33,17 @@ open (char *file_name, int flags, int mask) __ungetc_clear (r); return r; } +#else // !__M2__ +int +open (char const *file_name, int flags, ...) +{ + va_list ap; + va_start (ap, flags); + int mask = va_arg (ap, int); + int r = _sys_call3 (SYS_open, (long) file_name, flags, mask); + va_end (ap); + if (r > 2) + __ungetc_clear (r); + return r; +} +#endif // !__M2__ diff --git a/lib/linux/waitpid.c b/lib/linux/waitpid.c index bb89c692..426a6e72 100644 --- a/lib/linux/waitpid.c +++ b/lib/linux/waitpid.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -25,10 +25,13 @@ pid_t waitpid (pid_t pid, int *status_ptr, int options) { + long long_pid = pid; + long long_status_ptr = cast_voidp_to_long (status_ptr); + long long_options = options; #if __i386__ - return _sys_call3 (SYS_waitpid, (long) pid, (long) status_ptr, (int) options); + return _sys_call3 (SYS_waitpid, long_pid, long_status_ptr, long_options); #elif __x86_64__ || __arm__ - return _sys_call4 (SYS_wait4, (long) pid, (long) status_ptr, (int) options, 0); + return _sys_call4 (SYS_wait4, long_pid, long_status_ptr, long_options, 0); #else #error arch not supported #endif diff --git a/lib/m2/chmod.c b/lib/m2/chmod.c deleted file mode 100644 index 7a383014..00000000 --- a/lib/m2/chmod.c +++ /dev/null @@ -1,31 +0,0 @@ -/* -*-comment-start: "//";comment-end:""-*- - * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2023 Jan (janneke) Nieuwenhuizen - * - * This file is part of GNU Mes. - * - * GNU Mes is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * GNU Mes is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Mes. If not, see . - */ - -#include -#include -#include - -int -chmod (char const *file_name, int mask) -{ - long long_file_name = file_name; - long long_mask = mask; - return _sys_call2 (SYS_chmod, long_file_name, long_mask); -} diff --git a/lib/m2/clock_gettime.c b/lib/m2/clock_gettime.c deleted file mode 100644 index 9edaf5ef..00000000 --- a/lib/m2/clock_gettime.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -*-comment-start: "//";comment-end:""-*- - * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018,2019,2023 Jan (janneke) Nieuwenhuizen - * - * This file is part of GNU Mes. - * - * GNU Mes is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * GNU Mes is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Mes. If not, see . - */ - -#include -#include -#include - -int -clock_gettime (long clk_id, struct timespec *tp) -{ - long long_tp = tp; - return _sys_call2 (SYS_clock_gettime, clk_id, tp); -} diff --git a/lib/m2/getcwd.c b/lib/m2/getcwd.c index 849c0a0f..7c748302 100644 --- a/lib/m2/getcwd.c +++ b/lib/m2/getcwd.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -24,8 +24,6 @@ #include #include -// CONSTANT PATH_MAX 1024 - char *__getcwd_buf; char * diff --git a/lib/m2/isatty.c b/lib/m2/isatty.c index fbe50ead..31b06ae3 100644 --- a/lib/m2/isatty.c +++ b/lib/m2/isatty.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -24,7 +24,6 @@ #include #include -// CONSTANT TCGETS 0x5401 #define TCGETS 0x5401 struct ktermios diff --git a/lib/m2/malloc.c b/lib/m2/malloc.c deleted file mode 100644 index 4c3488d0..00000000 --- a/lib/m2/malloc.c +++ /dev/null @@ -1,36 +0,0 @@ -/* -*-comment-start: "//";comment-end:""-*- - * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2021 Jan (janneke) Nieuwenhuizen - * - * This file is part of GNU Mes. - * - * GNU Mes is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * GNU Mes is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Mes. If not, see . - */ - -#include -#include - -char *__brk = 0; - -void * -malloc (size_t size) -{ - if (!__brk) - __brk = cast_long_to_charp (brk (0)); - if (brk (__brk + size) == -1) - return 0; - char *p = __brk; - __brk = __brk + size; - return p; -} diff --git a/lib/m2/mes_open.c b/lib/m2/mes_open.c deleted file mode 100644 index d2b1c1ca..00000000 --- a/lib/m2/mes_open.c +++ /dev/null @@ -1,28 +0,0 @@ -/* -*-comment-start: "//";comment-end:""-*- - * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen - * - * This file is part of GNU Mes. - * - * GNU Mes is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * GNU Mes is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Mes. If not, see . - */ - -int -mes_open (char *file_name, int flags, int mask) -{ - int filedes = open (file_name, flags, mask); - if (filedes > 2) - __ungetc_clear (filedes); - return filedes; -} diff --git a/lib/m2/read.c b/lib/m2/read.c deleted file mode 100644 index 515b0b80..00000000 --- a/lib/m2/read.c +++ /dev/null @@ -1,31 +0,0 @@ -/* -*-comment-start: "//";comment-end:""-*- - * GNU Mes --- Maxwell Equations of Software - * Copyright © 2019,2020,2023 Jan (janneke) Nieuwenhuizen - * - * This file is part of GNU Mes. - * - * GNU Mes is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * GNU Mes is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Mes. If not, see . - */ - -#include -#include -#include -#include - -long -read (int filedes, void *buffer, long size) -{ - long bytes = _sys_call3 (SYS_read, filedes, buffer, size); - return bytes; -} diff --git a/lib/m2/waitpid.c b/lib/m2/waitpid.c deleted file mode 100644 index 5cd18d98..00000000 --- a/lib/m2/waitpid.c +++ /dev/null @@ -1,39 +0,0 @@ -/* -*-comment-start: "//";comment-end:""-*- - * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen - * - * This file is part of GNU Mes. - * - * GNU Mes is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * GNU Mes is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Mes. If not, see . - */ - -#include -#include -#include -#include - -int -waitpid (int pid, int *status_ptr, int options) -{ - long long_pid = pid; - long long_status_ptr = cast_voidp_to_long (status_ptr); - long long_options = options; -//##if __i386__ -//# return _sys_call3 (SYS_waitpid, long_pid, long_status_ptr, long_options); -//##elif __x86_64__ || __arm__ - return _sys_call4 (SYS_wait4, long_pid, long_status_ptr, long_options, 0); -//##else -//##error arch not supported -//##endif -} diff --git a/lib/mes/div.c b/lib/mes/div.c index 4ea0ce32..9ccb7b44 100644 --- a/lib/mes/div.c +++ b/lib/mes/div.c @@ -31,12 +31,6 @@ struct ldiv_t long rem; }; -int __raise (int); - -#if __TINYC__ || SYSTEM_LIBC -#define __raise(x) -1 -#endif - void __mesabi_div0 (void) { diff --git a/lib/mes/ntoab.c b/lib/mes/ntoab.c index 98e81072..c8827503 100644 --- a/lib/mes/ntoab.c +++ b/lib/mes/ntoab.c @@ -23,7 +23,19 @@ #include #include -#if __M2_PLANET__ || (!(__MESC__ && __arm__) && !(__TINYC__ && __arm__ && BOOTSTRAP)) +#if __MESC__ && __arm__ +#define __MESC__and__arm__ +#endif + +#if __TINYC__ && __arm__ && BOOTSTRAP +#define __TINYC__and__arm__and__BOOTSTRAP +#endif + +#define __not__MESC__arm__and__not__TINYC__arm__BOOTSTRAP !defined (__MESC__and__arm__) && !defined (__TINYC__and__arm__and__BOOTSTRAP) + +// FIXME: M2-Planet 1.10.0 crashes on this... +// #if __M2__ || (!defined (__MESC__and__arm__) && !defined (__TINYC__and__arm__and__BOOTSTRAP)) +#if __M2__ || __not__MESC__arm__and__not__TINYC__arm__BOOTSTRAP size_t __mesabi_uldiv (size_t a, size_t b, size_t *remainder) { diff --git a/lib/posix/getcwd.c b/lib/posix/getcwd.c index e3e6d67c..97e81c75 100644 --- a/lib/posix/getcwd.c +++ b/lib/posix/getcwd.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020,2021 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -23,8 +23,6 @@ #include #include -char *__getcwd_buf; - char * getcwd (char *buffer, size_t size) { diff --git a/lib/posix/getenv.c b/lib/posix/getenv.c index 9130f76d..9386044b 100644 --- a/lib/posix/getenv.c +++ b/lib/posix/getenv.c @@ -1,6 +1,6 @@ /* * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -22,8 +22,11 @@ #include #include -// CONSTANT M2_PTR_SIZE 4 +#if __M2__ +#define M2_PTR_SIZE 4 +#else #define M2_PTR_SIZE 1 +#endif char * getenv (char const *s) diff --git a/lib/posix/setenv.c b/lib/posix/setenv.c index 321a5ab1..1754e6e9 100644 --- a/lib/posix/setenv.c +++ b/lib/posix/setenv.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -22,8 +22,11 @@ #include #include -// CONSTANT M2_PTR_SIZE 4 +#if __M2__ +#define M2_PTR_SIZE 4 +#else #define M2_PTR_SIZE 1 +#endif int setenv (char const *s, char const *v, int overwrite_p) diff --git a/lib/stub/__raise.c b/lib/stub/__raise.c index 9467513c..bfa9853c 100644 --- a/lib/stub/__raise.c +++ b/lib/stub/__raise.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2020,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -18,8 +18,6 @@ * along with GNU Mes. If not, see . */ -// CONSTANT SIGABRT 0 - int __raise (int signum) { diff --git a/scaffold/read.kaem b/scaffold/read.kaem index f23e2dfb..974c9fa4 100644 --- a/scaffold/read.kaem +++ b/scaffold/read.kaem @@ -44,7 +44,8 @@ M2-Planet \ -f lib/mes/fdgetc.c \ -f lib/stdio/getchar.c \ -f lib/stdio/putchar.c \ - -f lib/m2/open.c \ + -f lib/linux/open.c \ + -f include/m2/types.h \ -f include/sys/types.h \ -f include/stdio.h \ -f scaffold/read.c \ diff --git a/simple.make b/simple.make index 8da48c3e..847d4baf 100644 --- a/simple.make +++ b/simple.make @@ -33,7 +33,7 @@ M2_PLANET_FUBAR = i386 #M2_PLANET_ARCH = amd64 #M2_PLANET_FUBAR = amd64 -M2_PLANET_FLAGS = --bootstrap-mode --debug --architecture $(M2_PLANET_ARCH) +M2_PLANET_FLAGS = --debug --architecture $(M2_PLANET_ARCH) CFLAGS:= \ $(CFLAGS) \ @@ -76,22 +76,26 @@ M2_SOURCES = \ lib/linux/x86-mes-m2/crt1.c \ lib/linux/x86-mes-m2/_exit.c \ lib/linux/x86-mes-m2/_write.c \ - lib/mes/globals.c \ + lib/mes/globals.c \ lib/m2/cast.c \ - lib/m2/exit.c \ - lib/mes/write.c \ + lib/stdlib/exit.c \ + lib/stub/__buffered_read.c \ lib/linux/x86-mes-m2/syscall.c \ lib/stub/__raise.c \ lib/linux/brk.c \ - lib/m2/malloc.c \ + lib/linux/malloc.c \ lib/string/memset.c \ - \ - lib/m2/read.c \ + lib/linux/read.c \ lib/mes/fdgetc.c \ + lib/linux/lseek.c \ + lib/posix/write.c \ + \ lib/stdio/getchar.c \ lib/stdio/putchar.c \ - lib/m2/open.c \ - lib/m2/mes_open.c \ + lib/stub/__buffered_read.c \ + lib/linux/_open3.c \ + lib/linux/open.c \ + lib/mes/mes_open.c \ lib/string/strlen.c \ lib/mes/eputs.c \ lib/mes/fdputc.c \ @@ -120,15 +124,15 @@ M2_SOURCES = \ lib/mes/fdungetc.c \ lib/posix/setenv.c \ lib/linux/access.c \ - lib/m2/chmod.c \ + lib/linux/chmod.c \ lib/linux/ioctl3.c \ lib/m2/isatty.c \ lib/linux/fork.c \ lib/m2/execve.c \ lib/m2/execv.c \ - lib/m2/waitpid.c \ + lib/linux/waitpid.c \ lib/linux/gettimeofday.c \ - lib/m2/clock_gettime.c \ + lib/linux/clock_gettime.c \ lib/m2/time.c \ lib/linux/_getcwd.c \ lib/m2/getcwd.c \ @@ -139,12 +143,6 @@ M2_SOURCES = \ lib/linux/unlink.c \ src/m2.c -M2_TODO = \ - lib/m2/file_print.c \ - lib/mes/ntoab.c \ - lib/mes/fdgetc.c \ - lib/mes/fdungetc.c - INCLUDES = \ include/mes/builtins.h \ include/mes/constants.h \ @@ -189,8 +187,18 @@ bin/gc-gcc: simple.make $(GCC_SOURCES) $(TEST_GC_SOURCES) $(INCLUDES) | bin $(CC) $(CFLAGS) -D GC_TEST=1 -o $@ $(GCC_SOURCES) $(TEST_GC_SOURCES) M2_PLANET_INCLUDES = \ - include/m2/lib.h \ + include/mes/config.h \ + include/mes/lib-mini.h \ + include/mes/lib.h \ include/linux/x86/syscall.h \ + include/time.h \ + include/sys/time.h \ + include/sys/types.h \ + include/stdio.h \ + include/limits.h \ + include/sys/stat.h \ + include/fcntl.h \ + include/signal.h \ include/mes/mes.h \ include/mes/builtins.h \ include/mes/constants.h \ diff --git a/src/core.c b/src/core.c index 15585e45..a986dcf7 100644 --- a/src/core.c +++ b/src/core.c @@ -148,7 +148,7 @@ length (struct scm *x) struct scm * error (struct scm *key, struct scm *x) { -#if !__MESC_MES__ && !__M2_PLANET__ +#if !__MESC_MES__ && !__M2__ struct scm *throw = module_ref (R0, cell_symbol_throw); if (throw != cell_undefined) return apply (throw, cons (key, cons (x, cell_nil)), R0); diff --git a/src/gc.c b/src/gc.c index 4b45069e..a55f24dc 100644 --- a/src/gc.c +++ b/src/gc.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020,2021 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen * Copyright © 2022 Gabriel Wicki * * This file is part of GNU Mes. @@ -31,8 +31,11 @@ int g_dump_filedes; +#if __M2__ +#define M2_CELL_SIZE 12 +#else #define M2_CELL_SIZE 1U -// CONSTANT M2_CELL_SIZE 12 +#endif char * cell_bytes (struct scm *x) @@ -41,16 +44,20 @@ cell_bytes (struct scm *x) return p + (2 * sizeof (long)); } +#if __M2__ +#define U10 10 +#define U100 100 +#else #define U10 10U -// CONSTANT U10 10 #define U100 100U -// CONSTANT U100 100 +#endif + void gc_init () { #if SYSTEM_LIBC ARENA_SIZE = 100000000; /* 2.3GiB */ -#elif ! __M2_PLANET__ +#elif ! __M2__ ARENA_SIZE = 300000; /* 32b: 3MiB, 64b: 6 MiB */ #else ARENA_SIZE = 20000000; diff --git a/src/posix.c b/src/posix.c index bfb1bcd3..75201ca9 100644 --- a/src/posix.c +++ b/src/posix.c @@ -34,10 +34,6 @@ #include #include -#if SYSTEM_LIBC -#define __raise(x) -1 -#endif - struct scm * abort_ () /*:((name . "abort")) */ { @@ -377,13 +373,14 @@ waitpid_ (struct scm *pid, struct scm *options) return cons (make_number (child), make_number (status)); } -#if __x86_64__ +#if __M2__ +/* Milliseconds for everyone else. */ +#define TIME_UNITS_PER_SECOND 1000 +#elif __x86_64__ /* Nanoseconds on 64-bit systems with POSIX timers. */ -// CONSTANT TIME_UNITS_PER_SECOND 1000000000 #define TIME_UNITS_PER_SECOND 1000000000U #else /* Milliseconds for everyone else. */ -// CONSTANT TIME_UNITS_PER_SECOND 1000 #define TIME_UNITS_PER_SECOND 1000U #endif @@ -408,8 +405,12 @@ gettimeofday_ () /*:((name . "gettimeofday")) */ return cons (make_number (time->tv_sec), make_number (time->tv_usec)); } +#if __M2__ +#define UL1000000000 1000000000 +#else #define UL1000000000 1000000000UL -// CONSTANT UL1000000000 1000000000 +#endif + long seconds_and_nanoseconds_to_long (long s, long ns) { diff --git a/src/symbol.c b/src/symbol.c index cd82328f..5d0aaaa2 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -23,14 +23,10 @@ #include -// char const *MES_VERSION = "0.24.2"; - -#if __M2_PLANET__ +#if __M2__ #define M2_CELL_SIZE 12 -// CONSTANT M2_CELL_SIZE 12 #else #define M2_CELL_SIZE 1 -// CONSTANT M2_CELL_SIZE 12 #endif struct scm * diff --git a/src/test/gc.c b/src/test/gc.c index 8d3c70cf..edafad8c 100644 --- a/src/test/gc.c +++ b/src/test/gc.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -24,8 +24,11 @@ #include #include +#if __M2__ +#define M2_CELL_SIZE 12 +#else #define M2_CELL_SIZE 1 -// CONSTANT M2_CELL_SIZE 12 +#endif int g_debug; diff --git a/src/vector.c b/src/vector.c index 0fc84040..e4a35ead 100644 --- a/src/vector.c +++ b/src/vector.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -21,12 +21,10 @@ #include "mes/lib.h" #include "mes/mes.h" -#if __M2_PLANET__ +#if __M2__ #define M2_CELL_SIZE 12 -// CONSTANT M2_CELL_SIZE 12 #else #define M2_CELL_SIZE 1 -// CONSTANT M2_CELL_SIZE 12 #endif struct scm * From 77255749355d00026cc1d9f1e9fda1e3c35bb414 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Mon, 14 Nov 2022 14:15:41 +0100 Subject: [PATCH 013/118] kaem: Add kaem.arm and kaem.x86. * kaem.arm, kaem.x86: New files. --- kaem.arm | 24 ++++++++++++++++++++++++ kaem.x86 | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 kaem.arm create mode 100644 kaem.x86 diff --git a/kaem.arm b/kaem.arm new file mode 100644 index 00000000..4e973a1f --- /dev/null +++ b/kaem.arm @@ -0,0 +1,24 @@ +#! /bin/sh +# Copyright © 2022 Jan (janneke) Nieuwenhuizen +# +# This file is part of GNU Mes. +# +# GNU Mes is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GNU Mes is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Mes. If not, see . + +# Usage: +# kaem --verbose --strict + +mes_cpu=arm +stage0_cpu=armv7l +kaem --verbose --strict diff --git a/kaem.x86 b/kaem.x86 new file mode 100644 index 00000000..60ab6e6b --- /dev/null +++ b/kaem.x86 @@ -0,0 +1,24 @@ +#! /bin/sh +# Copyright © 2022 Jan (janneke) Nieuwenhuizen +# +# This file is part of GNU Mes. +# +# GNU Mes is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GNU Mes is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Mes. If not, see . + +# Usage: +# kaem --verbose --strict + +mes_cpu=x86 +stage0_cpu=x86 +kaem --verbose --strict From cbea14f843ffb9cd767ef2246d09f344752bf72e Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 18 Nov 2022 01:30:06 +0100 Subject: [PATCH 014/118] core: Move M2_PTR_SIZE, M2_CELL_SIZE to include file. * lib/posix/getenv.c (M2_PTR_SIZE), lib/posix/setenv.c (M2_PTR_SIZE): Move definition... * include/mes/lib-mini.h (M2_PTR_SIZE): ...here. * src/gc.c (M2_CELL_SIZE), src/symbol.c (M2_CELL_SIZE), src/test/gc.c (M2_CELL_SIZE), src/vector.c (M2_CELL_SIZE): Move definition... * include/mes/mes.h (M2_CELL_SIZE): ...here. --- include/mes/lib-mini.h | 9 +++++++++ include/mes/mes.h | 9 +++++++++ lib/posix/getenv.c | 6 ------ lib/posix/setenv.c | 6 ------ src/gc.c | 6 ------ src/symbol.c | 6 ------ src/test/gc.c | 6 ------ src/vector.c | 6 ------ 8 files changed, 18 insertions(+), 36 deletions(-) diff --git a/include/mes/lib-mini.h b/include/mes/lib-mini.h index b3f24316..eb994f79 100644 --- a/include/mes/lib-mini.h +++ b/include/mes/lib-mini.h @@ -37,6 +37,15 @@ #define STDERR 2 #endif +/* M2-Planet does not support pointer arithmetic. Explicitly compensate + for that by multiplying with M2_PTR_SIZE when using (char) + pointers. */ +#if __M2__ +#define M2_PTR_SIZE 4 +#else +#define M2_PTR_SIZE 1 +#endif + extern char **environ; extern int __stdin; extern int __stdout; diff --git a/include/mes/mes.h b/include/mes/mes.h index 337f03aa..0323b2dc 100644 --- a/include/mes/mes.h +++ b/include/mes/mes.h @@ -53,6 +53,15 @@ struct scm }; }; +/* M2-Planet does not support pointer arithmetic. Explicitly compensate + for that by multiplying with M2_CELL_SIZE when using cell + pointers. */ +#if __M2__ +#define M2_CELL_SIZE 12 +#else +#define M2_CELL_SIZE 1 +#endif + /* mes */ extern char *g_datadir; extern int g_debug; diff --git a/lib/posix/getenv.c b/lib/posix/getenv.c index 9386044b..e514f8c1 100644 --- a/lib/posix/getenv.c +++ b/lib/posix/getenv.c @@ -22,12 +22,6 @@ #include #include -#if __M2__ -#define M2_PTR_SIZE 4 -#else -#define M2_PTR_SIZE 1 -#endif - char * getenv (char const *s) { diff --git a/lib/posix/setenv.c b/lib/posix/setenv.c index 1754e6e9..bdca5a7c 100644 --- a/lib/posix/setenv.c +++ b/lib/posix/setenv.c @@ -22,12 +22,6 @@ #include #include -#if __M2__ -#define M2_PTR_SIZE 4 -#else -#define M2_PTR_SIZE 1 -#endif - int setenv (char const *s, char const *v, int overwrite_p) { diff --git a/src/gc.c b/src/gc.c index a55f24dc..8439536d 100644 --- a/src/gc.c +++ b/src/gc.c @@ -31,12 +31,6 @@ int g_dump_filedes; -#if __M2__ -#define M2_CELL_SIZE 12 -#else -#define M2_CELL_SIZE 1U -#endif - char * cell_bytes (struct scm *x) { diff --git a/src/symbol.c b/src/symbol.c index 5d0aaaa2..55330fcd 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -23,12 +23,6 @@ #include -#if __M2__ -#define M2_CELL_SIZE 12 -#else -#define M2_CELL_SIZE 1 -#endif - struct scm * init_symbol (struct scm *x, long type, char const *name) { diff --git a/src/test/gc.c b/src/test/gc.c index edafad8c..62960436 100644 --- a/src/test/gc.c +++ b/src/test/gc.c @@ -24,12 +24,6 @@ #include #include -#if __M2__ -#define M2_CELL_SIZE 12 -#else -#define M2_CELL_SIZE 1 -#endif - int g_debug; void diff --git a/src/vector.c b/src/vector.c index e4a35ead..ad6b097b 100644 --- a/src/vector.c +++ b/src/vector.c @@ -21,12 +21,6 @@ #include "mes/lib.h" #include "mes/mes.h" -#if __M2__ -#define M2_CELL_SIZE 12 -#else -#define M2_CELL_SIZE 1 -#endif - struct scm * make_vector_ (long k, struct scm *e) { From 6bc6e8354e711ce566a2884ed471f1da7ebcf920 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Tue, 15 Nov 2022 06:36:07 +0100 Subject: [PATCH 015/118] lib: linux: Add wait4. * lib/linux/waitpid.c (waitpid): Factor-out wait4 call to... * lib/linux/wait4.c: ...new file here. * include/sys/wait.h (wait4): Add prototype. Include sys/resource.h. * include/sys/resource.h (struct rusage): Remove gratuitous "int" for M2-Planet. * build-aux/configure-lib.sh (libc_SOURCES): Add it. * kaem.run, simple.make (M2_SOURCES), simple.sh: Likewise. Also add resource.h. --- build-aux/configure-lib.sh | 1 + include/sys/resource.h | 28 ++++++++++++++-------------- include/sys/wait.h | 6 +++++- kaem.run | 2 ++ lib/linux/wait4.c | 36 ++++++++++++++++++++++++++++++++++++ lib/linux/waitpid.c | 8 +++++--- simple.make | 3 +++ simple.sh | 2 ++ 8 files changed, 68 insertions(+), 18 deletions(-) create mode 100644 lib/linux/wait4.c diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh index 7d1f9417..eb320a66 100644 --- a/build-aux/configure-lib.sh +++ b/build-aux/configure-lib.sh @@ -215,6 +215,7 @@ lib/linux/malloc.c lib/linux/_read.c lib/linux/time.c lib/linux/unlink.c +lib/linux/wait4.c lib/linux/waitpid.c lib/linux/$mes_cpu-mes-$compiler/syscall.c lib/linux/getpid.c diff --git a/include/sys/resource.h b/include/sys/resource.h index dab45d17..d277f08c 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -32,20 +32,20 @@ struct rusage { struct timeval ru_utime; struct timeval ru_stime; - long int ru_maxrss; - long int ru_ixrss; - long int ru_idrss; - long int ru_isrss; - long int ru_minflt; - long int ru_majflt; - long int ru_nswap; - long int ru_inblock; - long int ru_oublock; - long int ru_msgsnd; - long int ru_msgrcv; - long int ru_nsignals; - long int ru_nvcsw; - long int ru_nivcsw; + long ru_maxrss; + long ru_ixrss; + long ru_idrss; + long ru_isrss; + long ru_minflt; + long ru_majflt; + long ru_nswap; + long ru_inblock; + long ru_oublock; + long ru_msgsnd; + long ru_msgrcv; + long ru_nsignals; + long ru_nvcsw; + long ru_nivcsw; }; #define RUSAGE_SELF 0 diff --git a/include/sys/wait.h b/include/sys/wait.h index 4cff86fc..ca476b8e 100644 --- a/include/sys/wait.h +++ b/include/sys/wait.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -20,6 +20,8 @@ #ifndef __MES_SYS_WAIT_H #define __MES_SYS_WAIT_H 1 +#include + #if SYSTEM_LIBC #undef __MES_SYS_WAIT_H #include_next @@ -35,6 +37,8 @@ typedef int pid_t; pid_t waitpid (pid_t pid, int *status_ptr, int options); pid_t wait (int *status_ptr); +pid_t wait4 (pid_t pid, int *wstatus, int options, + struct rusage *rusage); #endif // ! SYSTEM_LIBC diff --git a/kaem.run b/kaem.run index 024c268c..1179aa23 100644 --- a/kaem.run +++ b/kaem.run @@ -98,6 +98,8 @@ M2-Planet \ -f lib/linux/fork.c \ -f lib/m2/execve.c \ -f lib/m2/execv.c \ + -f include/sys/resource.h \ + -f lib/linux/wait4.c \ -f lib/linux/waitpid.c \ -f lib/linux/gettimeofday.c \ -f lib/linux/clock_gettime.c \ diff --git a/lib/linux/wait4.c b/lib/linux/wait4.c new file mode 100644 index 00000000..dfb9bb96 --- /dev/null +++ b/lib/linux/wait4.c @@ -0,0 +1,36 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include +#include +#include +#include +#include + +pid_t +wait4 (pid_t pid, int *status_ptr, int options, struct rusage *rusage) +{ + long long_pid = pid; + long long_status_ptr = cast_voidp_to_long (status_ptr); + long long_options = options; + long long_rusage = cast_voidp_to_long (rusage); + return _sys_call4 (SYS_wait4, long_pid, long_status_ptr, long_options, + long_rusage); +} diff --git a/lib/linux/waitpid.c b/lib/linux/waitpid.c index 426a6e72..80d8bbe5 100644 --- a/lib/linux/waitpid.c +++ b/lib/linux/waitpid.c @@ -18,9 +18,11 @@ * along with GNU Mes. If not, see . */ +#include #include #include #include +#include pid_t waitpid (pid_t pid, int *status_ptr, int options) @@ -28,10 +30,10 @@ waitpid (pid_t pid, int *status_ptr, int options) long long_pid = pid; long long_status_ptr = cast_voidp_to_long (status_ptr); long long_options = options; -#if __i386__ +#if defined (SYS_waitpid) return _sys_call3 (SYS_waitpid, long_pid, long_status_ptr, long_options); -#elif __x86_64__ || __arm__ - return _sys_call4 (SYS_wait4, long_pid, long_status_ptr, long_options, 0); +#elif defined (SYS_wait4) + return wait4 (pid, status_ptr, options, 0); #else #error arch not supported #endif diff --git a/simple.make b/simple.make index 847d4baf..4dd3d03c 100644 --- a/simple.make +++ b/simple.make @@ -130,6 +130,7 @@ M2_SOURCES = \ lib/linux/fork.c \ lib/m2/execve.c \ lib/m2/execv.c \ + lib/linux/wait4.c \ lib/linux/waitpid.c \ lib/linux/gettimeofday.c \ lib/linux/clock_gettime.c \ @@ -193,12 +194,14 @@ M2_PLANET_INCLUDES = \ include/linux/x86/syscall.h \ include/time.h \ include/sys/time.h \ + include/m2/types.h \ include/sys/types.h \ include/stdio.h \ include/limits.h \ include/sys/stat.h \ include/fcntl.h \ include/signal.h \ + include/sys/resource.h \ include/mes/mes.h \ include/mes/builtins.h \ include/mes/constants.h \ diff --git a/simple.sh b/simple.sh index 70ddb211..06887251 100755 --- a/simple.sh +++ b/simple.sh @@ -263,6 +263,8 @@ $CC -g -D HAVE_CONFIG_H=1 \ lib/linux/_read.c \ lib/linux/time.c \ lib/linux/unlink.c \ + include/sys/resource.h \ + lib/linux/wait4.c \ lib/linux/waitpid.c \ lib/linux/$mes_cpu-mes-$compiler/syscall.c \ \ From 640bdd027bc4d8874962336695fd8e0d2d097265 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Mon, 13 Feb 2023 11:24:43 +0100 Subject: [PATCH 016/118] lib: __assert_fail: Remove M2-Planet workarounds. * lib/mes/__assert_fail.c (__assert_fail): Use *file, *function. --- lib/mes/__assert_fail.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mes/__assert_fail.c b/lib/mes/__assert_fail.c index eb5d0c85..5dd3d781 100644 --- a/lib/mes/__assert_fail.c +++ b/lib/mes/__assert_fail.c @@ -25,7 +25,7 @@ void __assert_fail (char const *msg, char const *file, unsigned line, char const *function) { - if (file && file[0]) + if (file && *file) { eputs (file); eputs (":"); @@ -35,7 +35,7 @@ __assert_fail (char const *msg, char const *file, unsigned line, eputs (itoa (line)); eputs (":"); } - if (function && function[0]) + if (function && *function) { eputs (function); eputs (":"); From 762200b65a85ddb5ddc0189c8b64d0a09f1d0196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sat, 24 Dec 2022 10:45:21 +0000 Subject: [PATCH 017/118] m2: Add new style x86 defines to support M2-Planet 1.11.0. * lib/m2/x86/x86_defs.M1: Add new M1 defines. --- lib/m2/x86/x86_defs.M1 | 83 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/lib/m2/x86/x86_defs.M1 b/lib/m2/x86/x86_defs.M1 index d411ac1d..e56fc579 100644 --- a/lib/m2/x86/x86_defs.M1 +++ b/lib/m2/x86/x86_defs.M1 @@ -1,5 +1,6 @@ ## Copyright (C) 2017 Jeremiah Orians ## Copyright (C) 2021 Jan (janneke) Nieuwenhuizen +## Copyright (C) 2023 Andrius Štikonas ## This file is part of M2-Planet. ## ## M2-Planet is free software: you can redistribute it and/or modify @@ -101,3 +102,85 @@ DEFINE SUBTRACT_eax_from_ebx_into_ebx 29C3 DEFINE TEST 85C0 DEFINE XCHG_eax_ebx 93 DEFINE XOR_ebx_eax_into_eax 31D8 + +DEFINE add_eax, 81C0 +DEFINE add_ebp, 81C5 +DEFINE add_ebx,eax 01C3 +DEFINE add_eax,ebp 01E8 +DEFINE add_eax,ebx 01D8 +DEFINE and_eax,ebx 21D8 +DEFINE call E8 +DEFINE call_eax FFD0 +DEFINE cmp 39C3 +DEFINE cdq 99 +DEFINE div_ebx F7F3 +DEFINE idiv_ebx F7FB +DEFINE int CD +DEFINE je 0F84 +DEFINE jne 0F85 +DEFINE jmp E9 +DEFINE lea_eax,[ebp+DWORD] 8D85 +DEFINE lea_eax,[esp+DWORD] 8D8424 +DEFINE lea_ebx,[esp+DWORD] 8D9C24 +DEFINE lea_ecx,[esp+DWORD] 8D8C24 +DEFINE lea_edx,[esp+DWORD] 8D9424 +DEFINE mov_eax,[esp+DWORD] 8B8424 +DEFINE mov_eax,ebp 89E8 +DEFINE mov_eax,ebx 89D8 +DEFINE mov_eax,ebx 89D8 +DEFINE mov_eax,edx 89D0 +DEFINE mov_ebx,eax 89C3 +DEFINE mov_ecx,eax 89C1 +DEFINE mov_ecx,esp 89E1 +DEFINE mov_edi,esp 89E7 +DEFINE mov_ebp,edi 89fd +DEFINE mov_ebp,esp 89E5 +DEFINE mov_eax, B8 +DEFINE mov_ebx, BB +DEFINE mov_edx, BA +DEFINE mov_eax,[eax] 8B00 +DEFINE mov_ebx,[ebx] 8B1B +DEFINE mov_ecx,[ecx] 8B09 +DEFINE mov_edx,[edx] 8B12 +DEFINE mov_[ebx],al 8803 +DEFINE mov_[ebx],ax 668903 +DEFINE mov_[ebx],eax 8903 +DEFINE movsx_eax,BYTE_PTR_[eax] 0FBE00 +DEFINE movsx_ebx,BYTE_PTR_[ebx] 0FBE1B +DEFINE movsx_eax,WORD_PTR_[eax] 0FBF00 +DEFINE movzx_eax,BYTE_PTR_[eax] 0FB600 +DEFINE movzx_eax,WORD_PTR_[eax] 0FB700 +DEFINE movzx_eax,al 0FB6C0 +DEFINE mul_ebx F7E3 +DEFINE imul_ebx F7EB +DEFINE NULL 00000000 +DEFINE not_eax F7D0 +DEFINE or_eax,ebx 09D8 +DEFINE pop_eax 58 +DEFINE pop_ebx 5B +DEFINE pop_ebp 5D +DEFINE pop_edi 5F +DEFINE push_eax 50 +DEFINE push_ebx 53 +DEFINE push_ebp 55 +DEFINE push_edi 57 +DEFINE ret C3 +DEFINE sal_eax, C1E0 +DEFINE sal_eax,cl D3F0 +DEFINE shl_eax,cl D3E0 +DEFINE sar_eax,cl D3F8 +DEFINE shr_eax,cl D3E8 +DEFINE seta_al 0F97C0 +DEFINE setae_al 0F93C0 +DEFINE setb_al 0F92C0 +DEFINE setbe_al 0F96C0 +DEFINE sete_al 0F94C0 +DEFINE setle_al 0F9EC0 +DEFINE setl_al 0F9CC0 +DEFINE setge_al 0F9DC0 +DEFINE setg_al 0F9FC0 +DEFINE setne_al 0F95C0 +DEFINE sub_ebx,eax 29C3 +DEFINE test_eax,eax 85C0 +DEFINE xchg_ebx,eax 93 +DEFINE xor_eax,ebx 31D8 From ad183456875349a46617b61817f6384c8be690e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 30 Apr 2023 20:35:54 +0100 Subject: [PATCH 018/118] core: Fix a typo in comment. * src/gc.c (gc_init): Fix typo. --- src/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gc.c b/src/gc.c index 8439536d..ba70cfd6 100644 --- a/src/gc.c +++ b/src/gc.c @@ -92,7 +92,7 @@ gc_init () g_cells = cast_charp_to_scmp (g_arena); g_stack_array = cast_charp_to_scmpp (g_arena + arena_bytes); - /* The vector that holds the arenea. */ + /* The vector that holds the arena. */ cell_arena = g_cells; cell_zero = cell_arena + M2_CELL_SIZE; From 1a1fbfd36c03fcb7f9e29967148727d57fb49e84 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Wed, 3 May 2023 07:42:13 +0200 Subject: [PATCH 019/118] DRAFT doc: Update for 0.25. * doc/images/gcc-mesboot-graph.dot: Regenerate. * doc/mes.texi (Introduction): Whitespace fixes. (Full Source Bootstrap): Mention deployment in Guix. (Requirements): Update M2-Planet to 1.10.0. (Bootstrap Requirements): Likewise. (The Mes Bootstrap Process): Update Reduced Binary Bootstrap to Full Source Bootstrap. Update next priority. Add deployments. (Bootstrapping): Add tagline for "Invoking mesar". (Full Source Bootstrap Deployments): New subsection. --- doc/images/gcc-mesboot-graph.dot | 181 +++++++++++++------------------ doc/mes.texi | 127 +++++++++++++++------- 2 files changed, 167 insertions(+), 141 deletions(-) diff --git a/doc/images/gcc-mesboot-graph.dot b/doc/images/gcc-mesboot-graph.dot index 8243fe72..f985df35 100644 --- a/doc/images/gcc-mesboot-graph.dot +++ b/doc/images/gcc-mesboot-graph.dot @@ -1,107 +1,80 @@ digraph "Guix bag" { - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" [label = "gcc-core-mesboot0@2.95.3", shape = box, fontname = sans]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" [color = red]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" [color = red]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [color = red]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" [color = red]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" [color = red]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" [color = red]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = red]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" [color = red]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = red]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = red]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = red]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = red]; - "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = red]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" [label = "binutils-mesboot0@2.14", shape = box, fontname = sans]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" [color = cyan3]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [color = cyan3]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" [color = cyan3]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" [color = cyan3]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" [color = cyan3]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = cyan3]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" [color = cyan3]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = cyan3]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = cyan3]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = cyan3]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = cyan3]; - "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = cyan3]; - "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" [label = "bash-mesboot0@2.05b", shape = box, fontname = sans]; - "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = darkgoldenrod]; - "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = darkgoldenrod]; - "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkgoldenrod]; - "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkgoldenrod]; - "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkgoldenrod]; - "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkgoldenrod]; - "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [label = "make-mesboot0@3.80", shape = box, fontname = sans]; - "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = magenta]; - "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = magenta]; - "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = magenta]; - "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = magenta]; - "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = magenta]; - "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [label = "tcc-boot0@0.9.26-1103-g6e62e0e", shape = box, fontname = sans]; - "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" [color = darkseagreen]; - "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/a6nbjivhxp65wqj5s8rz0fnmwzqxmhry-bootstrap-mescc-tools-0.5.2.drv" [color = darkseagreen]; - "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkseagreen]; - "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkseagreen]; - "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkseagreen]; - "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkseagreen]; - "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" [label = "mes-boot@0.22", shape = box, fontname = sans]; - "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" [color = peachpuff4]; - "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/a6nbjivhxp65wqj5s8rz0fnmwzqxmhry-bootstrap-mescc-tools-0.5.2.drv" [color = peachpuff4]; - "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = peachpuff4]; - "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = peachpuff4]; - "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = peachpuff4]; - "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = peachpuff4]; - "/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" [label = "bootstrap-mes-rewired@0.19", shape = box, fontname = sans]; - "/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" -> "/gnu/store/r7bbw2ywmgqp6m5a1hp0fs4lhc51w3sq-bootstrap-mes-0.drv" [color = cyan3]; - "/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = cyan3]; - "/gnu/store/r7bbw2ywmgqp6m5a1hp0fs4lhc51w3sq-bootstrap-mes-0.drv" [label = "bootstrap-mes@0", shape = box, fontname = sans]; - "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [label = "gash-boot@0.2.0", shape = box, fontname = sans]; - "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkviolet]; - "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkviolet]; - "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [label = "bootar@1a", shape = box, fontname = sans]; - "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue]; - "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [label = "guile-bootstrap@2.0", shape = box, fontname = sans]; - "/gnu/store/a6nbjivhxp65wqj5s8rz0fnmwzqxmhry-bootstrap-mescc-tools-0.5.2.drv" [label = "bootstrap-mescc-tools@0.5.2", shape = box, fontname = sans]; - "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [label = "gash-utils-boot@0.1.0", shape = box, fontname = sans]; - "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = blue]; - "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = blue]; - "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue]; - "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [label = "bzip2-mesboot@1.0.8", shape = box, fontname = sans]; - "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = blue]; - "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = blue]; - "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = blue]; - "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = blue]; - "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = blue]; - "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue]; - "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" [label = "gzip-mesboot@1.2.4", shape = box, fontname = sans]; - "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = red]; - "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = red]; - "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = red]; - "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = red]; - "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = red]; - "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" [label = "patch-mesboot@2.5.9", shape = box, fontname = sans]; - "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = darkseagreen]; - "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = darkseagreen]; - "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkseagreen]; - "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkseagreen]; - "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkseagreen]; - "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkseagreen]; - "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" [label = "sed-mesboot0@1.18", shape = box, fontname = sans]; - "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = darkgoldenrod]; - "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = darkgoldenrod]; - "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkgoldenrod]; - "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkgoldenrod]; - "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkgoldenrod]; - "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkgoldenrod]; - "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" [label = "tcc-boot@0.9.27", shape = box, fontname = sans]; - "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [color = blue]; - "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = blue]; - "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = blue]; - "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = blue]; - "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = blue]; - "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = blue]; - "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue]; + "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" [label = "gcc-core-mesboot0@2.95.3", shape = box, fontname = sans]; + "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" [color = darkgoldenrod]; + "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" [color = darkgoldenrod]; + "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" [color = darkgoldenrod]; + "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" [color = darkgoldenrod]; + "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [color = darkgoldenrod]; + "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkgoldenrod]; + "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = darkgoldenrod]; + "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkgoldenrod]; + "/gnu/store/8vp8iadwjcvhaaqpa1wy60irhjdppwx7-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkgoldenrod]; + "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" [label = "binutils-mesboot0@2.20.1a", shape = box, fontname = sans]; + "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" [color = darkgoldenrod]; + "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" [color = darkgoldenrod]; + "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" [color = darkgoldenrod]; + "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [color = darkgoldenrod]; + "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkgoldenrod]; + "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = darkgoldenrod]; + "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkgoldenrod]; + "/gnu/store/8r05q5i3aspzqkg1jr7py719r74nfaji-binutils-mesboot0-2.20.1a.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkgoldenrod]; + "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" [label = "gzip-mesboot@1.2.4", shape = box, fontname = sans]; + "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [color = peachpuff4]; + "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = peachpuff4]; + "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = peachpuff4]; + "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = peachpuff4]; + "/gnu/store/l4dmmjr7sxzlyh0df7kqcjkfd3w4gink-gzip-mesboot-1.2.4.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = peachpuff4]; + "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [label = "tcc-boot0@0.9.26-1136-g5bba73cc", shape = box, fontname = sans]; + "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" [color = cyan3]; + "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" [color = cyan3]; + "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = cyan3]; + "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = cyan3]; + "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = cyan3]; + "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = cyan3]; + "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" [label = "mes-boot@0.24.2", shape = box, fontname = sans]; + "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" [color = darkseagreen]; + "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkseagreen]; + "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = darkseagreen]; + "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkseagreen]; + "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkseagreen]; + "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" [label = "stage0-posix@1.4", shape = box, fontname = sans]; + "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/7zxbgnrnhvm7g8bz1m5knpsbdfxzxl9g-bootstrap-seeds-1.0.0.drv" [color = darkviolet]; + "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkviolet]; + "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = darkviolet]; + "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkviolet]; + "/gnu/store/xavqa6yvv08ns4xggf27wc14m2kw2pvn-stage0-posix-1.4.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkviolet]; + "/gnu/store/7zxbgnrnhvm7g8bz1m5knpsbdfxzxl9g-bootstrap-seeds-1.0.0.drv" [label = "bootstrap-seeds@1.0.0", shape = ellipse, fontname = sans]; + "/gnu/store/7zxbgnrnhvm7g8bz1m5knpsbdfxzxl9g-bootstrap-seeds-1.0.0.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkgoldenrod]; + "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [label = "bootar@1b", shape = box, fontname = sans]; + "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = peachpuff4]; + "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [label = "guile-bootstrap@2.0", shape = ellipse, fontname = sans]; + "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [label = "gash-boot@0.3.0", shape = box, fontname = sans]; + "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkseagreen]; + "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkseagreen]; + "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [label = "gash-utils-boot@0.2.0", shape = box, fontname = sans]; + "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = darkviolet]; + "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = darkviolet]; + "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = darkviolet]; + "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" [label = "patch-mesboot@2.5.9", shape = box, fontname = sans]; + "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [color = blue]; + "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [color = blue]; + "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = blue]; + "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = blue]; + "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = blue]; + "/gnu/store/xznzx9xadd0x7z1az87likm636i8fldh-patch-mesboot-2.5.9.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = blue]; + "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [label = "make-mesboot0@3.80", shape = box, fontname = sans]; + "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [color = dimgrey]; + "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = dimgrey]; + "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = dimgrey]; + "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = dimgrey]; + "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = dimgrey]; + "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" [label = "tcc-boot@0.9.27", shape = box, fontname = sans]; + "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/3a9ynm7wmrggy8fx030830561a6rqrdj-mes-boot-0.24.2.drv" [color = blue]; + "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/gqz3fvamvvzb2gp6b6kk4imr0kywvxcr-make-mesboot0-3.80.drv" [color = blue]; + "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/1jfd6izcr1f5ijkrh7z8bpfnkgfc6rvz-tcc-boot0-0.9.26-1136-g5bba73cc.drv" [color = blue]; + "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/08jspv02rj1zad6y6ascil5r8lw4zz7d-gash-boot-0.3.0.drv" [color = blue]; + "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/hjzqij47br5wns4y2dzs094rsp4q82n5-gash-utils-boot-0.2.0.drv" [color = blue]; + "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/c2rwfalxivxrs29b56hxxb8zz6ad38iz-bootar-1b.drv" [color = blue]; + "/gnu/store/qmxs62ligcdsdb0x3n00mgfr6hm8nx3h-tcc-boot-0.9.27.drv" -> "/gnu/store/5pfm57hqv1xk7bm9xc36y568ssv1zawb-guile-bootstrap-2.0.drv" [color = blue]; } diff --git a/doc/mes.texi b/doc/mes.texi index bdf2c420..8f6fbd25 100644 --- a/doc/mes.texi +++ b/doc/mes.texi @@ -13,7 +13,7 @@ @set OPENPGP-SIGNING-KEY-ID 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 @copying -Copyright @copyright{} 2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen@* +Copyright @copyright{} 2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -93,7 +93,11 @@ Bootstrapping * The Mes Bootstrap Process:: How Mes will make you yogurt from pure milk. * Invoking mes:: Running Mes, a minimalist Guile lookalike. * Invoking mescc:: Running the MesCC bootstrap compiler. -* Invoking mesar:: +* Invoking mesar:: Running the MesCC bootstrap archiver. + +The Mes Bootstrap Process + +* Full Source Bootstrap Deployments:: Invoking mes @@ -156,8 +160,8 @@ essential freedoms: @item The freedom to study how the program works, and change it so it does - your computing as you wish (freedom 1). Access to the source code is - a precondition for this. + your computing as you wish (freedom 1). Access to the source code + is a precondition for this. @item The freedom to redistribute copies so you can help others (freedom @@ -165,8 +169,8 @@ essential freedoms: @item The freedom to distribute copies of your modified versions to others - (freedom 3). By doing this you can give the whole community a chance - to benefit from your changes. Access to the source code is a + (freedom 3). By doing this you can give the whole community a + chance to benefit from your changes. Access to the source code is a precondition for this. @end enumerate @end quotation @@ -325,12 +329,21 @@ from source. @node Full Source Bootstrap @section Full Source Bootstrap +@quotation +The holy grail for bootstrappability will be connecting @code{hex0} to +@code{mes}. + +@author Carl Dong +@end quotation + Reduction of binary seeds is great, but there is an obvious target: we cannot allow any binary seeds in our software stack. Not even in the bootstrap binary seed. Maybe that is a bit too strong: we want to have the absolute minimum of binary seeds and all binary seeds need to be inspectable and must be reviewed. How big would the absolute minimal -set be? +set be? During the Guix 1.5 development series we managed to close the +gap between @code{stage0-posix} and @code{mes}. We refer to this as the +@emph{Full-Source Bootstrap}. @menu * Stage0:: The Magical Self-Hosting Hex Assembler. @@ -565,7 +578,7 @@ The following dependencies are optional: @itemize Support for building the bootstrap @file{bin/mes-m2} depends on -@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.9.0. +@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.10.0. @end itemize @cindex Guile, compatibility @@ -595,7 +608,7 @@ Bootstrapping Mes depends on the following packages: @itemize @item a POSIX-compatible shell @item @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}, version 1.4.0, -@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.9.0. +@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.10.0. @item @url{https://savannah.gnu.org/projects/nyacc/, NYACC}, version 1.00.2, @end itemize @@ -684,17 +697,17 @@ responsibility. * The Mes Bootstrap Process:: How Mes will make you yogurt from pure milk. * Invoking mes:: Running Mes, a minimalist Guile lookalike. * Invoking mescc:: Running the MesCC bootstrap compiler. -* Invoking mesar:: +* Invoking mesar:: Running the MesCC bootstrap archiver. @end menu @node The Mes Bootstrap Process @section The Mes Bootstrap Process -The Reduced Binary Seed bootstrap currently adopted by Guix@footnote{See +The Full Source Bootstrap currently adopted by Guix@footnote{See @file{gnu/packages/commencement.scm} in the @var{master} branch in Guix git @url{https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/commencement.scm}}. -In its intiial form it is only available for x86-linux and armhf-linux. +In its intiial form it is only available for x86-linux. Currently, it goes like this: @@ -702,48 +715,48 @@ Currently, it goes like this: gcc-mesboot (4.9.4) ^ | - glibc-mesboot (2.16.0) + (...) ^ | - gcc-mesboot1 (4.7.4) + binutils-mesboot (2.20.1a), glibc-mesboot (2.2.5), + gcc-core-mesboot (2.95.3) ^ | - binutils-mesboot (2.20.1a) + patch-mesboot (2.5.9) ^ | - gcc-mesboot0 (2.95.3) + bootstrappable-tcc (0.9.26+31 patches) ^ | - glibc-mesboot0 (2.2.5) + gnu-make-mesboot0 (3.80) ^ | - gcc-core-mesboot (2.95.3) + gzip-mesboot (1.2.4) ^ | - make-mesboot0, diffutils-mesboot, binutils-mesboot0 (2.20.1a) + tcc-boot (0.9.27) ^ | - tcc-boot + mes-boot (0.24.2) ^ | - tcc-boot0 + stage0-posix (hex0..M2-Planet) ^ | - mes-boot + gash-boot, gash-utils-boot ^ | * - gash-boot, gash-utils-boot - ^ - | - * - bootstrap-mescc-tools, bootstrap-mes (~12 MiB) - bootstrap-guile (~48 MiB) + bootstrap-seeds (357-bytes for x86) + ~~~ + [bootstrap-guile-2.0.9 driver (~25 MiB)] @end verbatim -@c This graph is generated from wip-bootstrap, doing: +@c This graph is generated from Guix master, doing: -@c guix graph --type=bag -e '(@@ (gnu packages commencement) gcc-core-mesboot0)' > doc/images/gcc-mesboot-graph.dot +@c guix graph --type=bag -e '(@@ (gnu packages commencement) gcc-core-mesboot0)' \ +@c | sed -re 's,((bootstrap-seeds|guile-bootstrap).*shape =) box,\1 ellipse,' \ +@c > doc/images/gcc-mesboot-graph.dot @c dot -T png doc/images/gcc-mesboot-graph.dot > doc/images/gcc-mesboot-graph.png Here's a generated dependency diagram to for the initial bootstrap gcc @@ -751,12 +764,6 @@ that builds the rest of Guix. @image{images/gcc-mesboot-graph,6in,,Reference graph of the gcc-core-mesboot0} -Work is ongoing to remove these binary seeds that were intentionally -injected by our own doing as temporary shortcut -@example -bootstrap-mescc-tools (seed), bootstrap-mes (seed) -@end example - For now, this additional non-bootstrapped dependencies (i.e., binary seeds) are taken for granted @@ -764,7 +771,53 @@ seeds) are taken for granted bootstrap-guile @end example -Our next priority is to eleminate these one by one. +Our next priority is to eleminate the dependency on +@code{bootstrap-guile} for @code{Gash} and @code{Gash-Utils}, and thus +for @code{Mes}. + +@menu +* Full Source Bootstrap Deployments:: +@end menu + +@node Full Source Bootstrap Deployments +@subsection Full Source Bootstrap Deployments + +@table @code + +@item GNU Guix +Reference implementation of the Full Source Bootstrap for +@code{i686-linux} and @code{x86_64-linux} +@url{https://guix.gnu.org/en/blog/2023/the-full-source-bootstrap-building-from-source-all-the-way-down/,Guix FSB, building from source all the way down}. + +@item Bitcoin Core +The first application of Guix' Reduced Binary Seed Bootstrap was done in +bitcoin core +@url{https://github.com/bitcoin/bitcoin/blob/master/contrib/guix/README.md, +Bootstrappable Bitcoin Core Builds}. + +@item Live Bootstrap +The @url{https://github.com/fosslinux/live-bootstrap/,live-bootstrap} +has no dependency on @code{guile-bootstrap}, and removes and bootstraps +generated autotools and flex/bison files. + +@item Freedesktop SDK +The Freedesktop SDK used to have an informal dependency on its previous +version being installed in binary from. This dependency was mostly +broken in +@url{https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/merge_requests/11557, +bootstrap freedesktop binary seed}, they still have a dependency on +binary Rust. + +@item Full Source Bootstrap from Git +Building on the Live Bootstrap, but building most everything from Git +@url{https://github.com/schierlm/FullSourceBootstrapFromGit, FSB from Git}. + +@item NixOS +Implementation of a FSB has started +@url{https://github.com/NixOS/nixpkgs/pull/227914,NixOS 256b bootstrap +(in progress)}. + +@end table @node Invoking mes @section Invoking mes From ad7ce36b5b9e7362b71d86be0e10842df4e40a66 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Wed, 3 May 2023 14:47:09 +0200 Subject: [PATCH 020/118] build: Drop support for mescc-tools 0.5.2. * build-aux/build-scaffold.sh (stage0_cpu_flag): Remove. Update users. * build-aux/cflags.sh (stage0_arch): Remove. * build-aux/config.sh.in (numbered_arch): Remove. * configure (main): Remove check for numbered-arch?. Remove substitution of @numbered-arch@. * configure.sh (numbered_arch): Likewise. * module/mescc.scm (%numbered-arch?): Remove. (parse-opts): Remove support for --numbered-arch? * module/mescc/mescc.scm (mescc:compile): Remove alignment exception for numbered-arch?. (infos->hex2): Likewise. (arch-get-architecture): Remove support for numbered-arch?. * scripts/mescc.in (numbered_arch): Remove. * scripts/mescc.scm.in (%numbered-arch?): Remove. ("%numbered_arch"): Remove. --- build-aux/build-scaffold.sh | 16 +++++----------- build-aux/cflags.sh | 6 +----- build-aux/config.sh.in | 3 +-- configure | 9 +-------- configure.sh | 8 -------- module/mescc.scm | 7 +------ module/mescc/mescc.scm | 26 ++++++++------------------ scripts/mescc.in | 4 +--- scripts/mescc.scm.in | 8 +------- 9 files changed, 19 insertions(+), 68 deletions(-) diff --git a/build-aux/build-scaffold.sh b/build-aux/build-scaffold.sh index 96dbf4bd..25209fce 100755 --- a/build-aux/build-scaffold.sh +++ b/build-aux/build-scaffold.sh @@ -1,7 +1,7 @@ #! /bin/sh # GNU Mes --- Maxwell Equations of Software -# Copyright © 2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen +# Copyright © 2017,2018,2019,2022,2023 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # @@ -54,15 +54,9 @@ trace "TEST exit-42" [ $r != 42 ] && echo " => $r" [ $r = 42 ] -if $numbered_arch; then - stage0_cpu_flag="--Architecture $stage0_arch"; -else - stage0_cpu_flag="--architecture $stage0_cpu"; -fi - trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0exit-42.hex2" $HEX2\ --little-endian\ - $stage0_cpu_flag\ + --architecture $stage0_cpu\ --base-address 0x1000000\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0header.hex2\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0exit-42.hex2\ @@ -75,7 +69,7 @@ trace "TEST 0exit-42" trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2" $HEX2\ --little-endian\ - $stage0_cpu_flag\ + --architecture $stage0_cpu\ --base-address 0x1000000\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-header.hex2\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2\ @@ -101,7 +95,7 @@ trace "TEST hello-mes" trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2" $HEX2\ --little-endian\ - $stage0_cpu_flag\ + --architecture $stage0_cpu\ --base-address 0x1000000\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0header.hex2\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2\ @@ -114,7 +108,7 @@ trace "TEST 0hello-mes" trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2" $HEX2\ --little-endian\ - $stage0_cpu_flag\ + --architecture $stage0_cpu\ --base-address 0x1000000\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-header.hex2\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2\ diff --git a/build-aux/cflags.sh b/build-aux/cflags.sh index 344e4cf8..da98b4cb 100644 --- a/build-aux/cflags.sh +++ b/build-aux/cflags.sh @@ -1,5 +1,5 @@ # GNU Mes --- Maxwell Equations of Software -# Copyright © 2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen +# Copyright © 2018,2019,2020,2022,2023 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # @@ -18,19 +18,15 @@ case "$mes_cpu" in arm) - stage0_arch=40 stage0_cpu=armv7l ;; x86_64) - stage0_arch=2 stage0_cpu=amd64 ;; x86) - stage0_arch=1 stage0_cpu=x86 ;; *) - stage0_arch=1 stage0_cpu=$mes_cpu ;; esac diff --git a/build-aux/config.sh.in b/build-aux/config.sh.in index 8b271423..ae4c1ce7 100644 --- a/build-aux/config.sh.in +++ b/build-aux/config.sh.in @@ -1,5 +1,5 @@ # GNU Mes --- Maxwell Equations of Software -# Copyright © 2018 Jan (janneke) Nieuwenhuizen +# Copyright © 2018,2023 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # @@ -57,7 +57,6 @@ abs_top_srcdir="@abs_top_srcdir@" arch="@arch@" build="@build@" host="@host@" -numbered_arch=${numbered_arch-"@numbered_arch@"} bootstrap=${bootstrap-@bootstrap@} compiler=${compiler-@compiler@} diff --git a/configure b/configure index 41f09dd6..03692d93 100755 --- a/configure +++ b/configure @@ -556,12 +556,7 @@ Some influential environment variables: (and (file-exists? "/bin/sh") "/bin/sh") (file-name "sh" deps) "sh")) - (hex2 (file-name "hex2" deps)) - (numbered-arch? (begin - (stdout "checking for stage0 architecture flag... ") - (let ((numbered? (and hex2 (string-contains (gulp-pipe (string-append hex2 " --help 2>&1" )) "--Architecture 12345")))) - (stdout (if numbered? "numbered\n" "named\n")) - numbered?)))) + (hex2 (file-name "hex2" deps))) (define* (substitute file-name pairs #:key (target (if (string-suffix? ".in" file-name) @@ -655,7 +650,6 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system) ("@LDFLAGS@" . ,(or (getenv "LDFLAGS") "-static -g")) ("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") "")) ("@M1FLAGS@" . ,(or (getenv "M1FLAGS") "")) - ("@numbered_arch@" . ,(if numbered-arch? "true" "false")) ,@(map (lambda (o) @@ -724,7 +718,6 @@ GNU Mes is configured for libc: " mes-libc " kernel: " mes-kernel " system: " mes-system " - tools: " (if numbered-arch? "numbered" "named") " arch bootstrap: " (if with-bootstrap? "yes" "no") " courageous: " (if with-courage? "yes" "no") " diff --git a/configure.sh b/configure.sh index 2831452d..378e50ca 100755 --- a/configure.sh +++ b/configure.sh @@ -99,13 +99,6 @@ else GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')} fi -numbered_arch=false -mes_tools=named -if ( $HEX2 --help 2>&1 ) | grep -q "\-\-Architecture 12345"; then - numbered_arch=true - mes_tools=numbered -fi - bindir=$(eval echo ${bindir-$prefix/bin}) datadir=$(eval echo ${datadir-$prefix/share}) docdir=$(eval echo ${docdir-$datadir/doc/mes}) @@ -172,7 +165,6 @@ subst () { -e s,"@M2_PLANET@,$M2_PLANET,"\ -e s,"@KAEM@,$KAEM,"\ -e s,"@MES_FOR_BUILD@,$MES_FOR_BUILD,"\ - -e s,"@numbered_arch@,$numbered_arch,"\ -e s,"@SHELL@,$SHELL,"\ $1 > $2 } diff --git a/module/mescc.scm b/module/mescc.scm index 36839d96..fa881a13 100644 --- a/module/mescc.scm +++ b/module/mescc.scm @@ -1,5 +1,5 @@ ;;; GNU Mes --- Maxwell Equations of Software -;;; Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2016,2017,2018,2019,2023 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Mes. ;;; @@ -42,7 +42,6 @@ (define %includedir (or (getenv "%includedir") "include")) (define %libdir (or (getenv "%libdir") ".")) (define %version (or (getenv "%version") "0.0")) -(define %numbered-arch? (and=> (getenv "%numbered_arch") (lambda (x) (equal? x "true")))) (when (and=> (getenv "V") (lambda (v) (and (= (string-length v) 1) (> (string->number v) 1)))) (format (current-error-port) "mescc[~a]...\n" %scheme)) @@ -78,7 +77,6 @@ (nostartfiles) (nostdinc) (nostdlib) - (numbered-arch?) (preprocess (single-char #\E)) (static) (std (value #t)) @@ -109,7 +107,6 @@ Options: -dumpmachine display the compiler's target machine --base-address=ADDRESS use BaseAddress ADDRESS [0x1000000] - --numbered-arch mescc-tools use numbered arch -D DEFINE[=VALUE] define DEFINE [VALUE=1] -E preprocess only; do not compile, assemble or link -g add debug info (call stack in GDB) @@ -173,8 +170,6 @@ General help using GNU software: (options (if arch (acons 'arch arch options) options)) (kernel (option-ref options 'kernel %host-kernel)) (options (acons 'kernel kernel options)) - (numbered-arch? (option-ref options 'numbered-arch? %numbered-arch?)) - (options (acons 'numbered-arch? numbered-arch? options)) (dumpmachine? (option-ref options 'dumpmachine #f)) (preprocess? (option-ref options 'preprocess #f)) (print-libgcc-file-name? (option-ref options 'print-libgcc-file-name #f)) diff --git a/module/mescc/mescc.scm b/module/mescc/mescc.scm index 9638a008..a6e633f9 100644 --- a/module/mescc/mescc.scm +++ b/module/mescc/mescc.scm @@ -1,5 +1,5 @@ ;;; GNU Mes --- Maxwell Equations of Software -;;; Copyright © 2016,2017,2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2016,2017,2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2021 W. J. van der Laan ;;; ;;; This file is part of GNU Mes. @@ -79,12 +79,8 @@ (else (replace-suffix input-base ".s")))) (infos (map (cut file->info options <>) files)) (verbose? (count-opt options 'verbose)) - (numbered-arch? (option-ref options 'numbered-arch? #f)) (align (filter-map (multi-opt 'align) options)) - (align (if (null? align) '(functions) (map string->symbol align))) - (align (if (not numbered-arch?) align - ;; function alignment not supported by MesCC-Tools 0.5.2 - (filter (negate (cut eq? <> 'functions)) align)))) + (align (if (null? align) '(functions) (map string->symbol align)))) (when verbose? (format (current-error-port) "dumping: ~a\n" M1-file-name)) (with-output-to-file* M1-file-name @@ -173,12 +169,8 @@ (options (acons 'compile #t options)) ; ugh (options (acons 'output hex2-file-name options)) (verbose? (count-opt options 'verbose)) - (numbered-arch? (option-ref options 'numbered-arch? #f)) (align (filter-map (multi-opt 'align) options)) - (align (if (null? align) '(functions) (map string->symbol align))) - (align (if (not numbered-arch?) align - ;; function alignment not supported by MesCC-Tools 0.5.2 - (filter (negate (cut eq? <> 'functions)) align)))) + (align (if (null? align) '(functions) (map string->symbol align)))) (when verbose? (format (current-error-port) "dumping: ~a\n" M1-file-name)) (with-output-to-file* M1-file-name @@ -373,13 +365,11 @@ ((equal? arch "x86_64") "x86_64.M1")))) (define (arch-get-architecture options) - (let* ((arch (arch-get options)) - (numbered-arch? (option-ref options 'numbered-arch? #f)) - (flag (if numbered-arch? "--Architecture" "--architecture"))) - (list flag - (cond ((equal? arch "arm") (if numbered-arch? "40" "armv7l")) - ((equal? arch "x86") (if numbered-arch? "1" "x86")) - ((equal? arch "x86_64") (if numbered-arch? "2" "amd64")))))) + (let ((arch (arch-get options))) + (list "--architecture" + (cond ((equal? arch "arm") "armv7l") + ((equal? arch "x86") "x86") + ((equal? arch "x86_64") "amd64"))))) (define (multi-opt option-name) (lambda (o) (and (eq? (car o) option-name) (cdr o)))) (define (count-opt options option-name) diff --git a/scripts/mescc.in b/scripts/mescc.in index e5b08d63..46314ccc 100644 --- a/scripts/mescc.in +++ b/scripts/mescc.in @@ -1,7 +1,7 @@ #! @BASH@ # GNU Mes --- Maxwell Equations of Software -# Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen +# Copyright © 2018,2019,2023 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # @@ -49,8 +49,6 @@ includedir=${includedir-@includedir@} export includedir libdir=${libdir-@libdir@} export libdir -numbered_arch=${numbered_arch=@numbered_arch@} -export numbered_arch if [ ! -f $bindir/mescc.scm ]; then bindir=$(dirname $0) diff --git a/scripts/mescc.scm.in b/scripts/mescc.scm.in index 0fa613a5..db4fa131 100644 --- a/scripts/mescc.scm.in +++ b/scripts/mescc.scm.in @@ -2,7 +2,7 @@ --no-auto-compile -e main -L @guile_site_dir@ -C @guile_site_ccache_dir@ -s !# ;;; GNU Mes --- Maxwell Equations of Software -;;; Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2016,2017,2018,2019,2023 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Mes. ;;; @@ -48,18 +48,12 @@ (define %kernel (if (string-prefix? "@mes_kernel" "@mes_kernel@") %kernel "@mes_kernel@")) -(define %numbered-arch? (if (getenv "numbered_arch") (and=> (getenv "numbered_arch") - (lambda (x) (equal? x "true"))) - (if (string-prefix? "@numbered_arch" "@numbered_arch@") #f - (equal? "@numbered_arch@" "true")))) - (setenv "%prefix" %prefix) (setenv "%includedir" %includedir) (setenv "%libdir" %libdir) (setenv "%version" %version) (setenv "%arch" %arch) (setenv "%kernel" %kernel) -(setenv "%numbered_arch" (if %numbered-arch? "true" "false")) (cond-expand (mes From c20f6ac0253372ca001670d2eef2d71f81df6738 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Sun, 21 May 2023 12:15:42 +0200 Subject: [PATCH 021/118] lib: Define O_TMPFILE for GNU make 4.4.1. * include/fcntl.h (O_TMPFILE): New define. --- include/fcntl.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/fcntl.h b/include/fcntl.h index c5bc6951..09877471 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -1,6 +1,7 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen + * Copyright © 2023 Emily Trau * * This file is part of GNU Mes. * @@ -40,10 +41,11 @@ #define O_APPEND 0x400 #ifdef __arm__ -#define O_DIRECTORY 0x4000 -/*#define O_DIRECT 0x10000*/ +#define O_DIRECTORY 0x4000 +#define O_TMPFILE 0x404000 #else -#define O_DIRECTORY 0x10000 +#define O_DIRECTORY 0x10000 +#define O_TMPFILE 0x410000 #endif #elif __GNU__ From 8aa28acb4f5b73ad049b61af212e512d8ba2ba49 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Mon, 15 May 2023 19:10:05 +0300 Subject: [PATCH 022/118] build: Fix typo. * build-aux/GNUmakefile.in (X86_ARCH_HEADERS): Fix typo --- build-aux/GNUmakefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/GNUmakefile.in b/build-aux/GNUmakefile.in index a1214c4f..80b51e79 100644 --- a/build-aux/GNUmakefile.in +++ b/build-aux/GNUmakefile.in @@ -85,7 +85,7 @@ PHONY_TARGETS:=\ .PHONY: $(PHONY_TARGETS) -X86_ARCH_HEADERS = $(wildcard $(scrdest)include/linux/x86/*.h) +X86_ARCH_HEADERS = $(wildcard $(srcdest)include/linux/x86/*.h) ARCH_HEADERS = $(X86_ARCH_HEADERS:$(srcdest)include/linux/x86/%=include/arch/%) default: all From 00720c8d5f548176ec575219b668d0ed57e5f447 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Sat, 1 Jul 2023 08:29:17 +0200 Subject: [PATCH 023/118] mes: Define R_OK as 4. Reported by fossy via IRC. * mes/module/mes/posix.mes (R_OK): Define as 4. --- mes/module/mes/posix.mes | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mes/module/mes/posix.mes b/mes/module/mes/posix.mes index fc1b1574..fa8c679c 100644 --- a/mes/module/mes/posix.mes +++ b/mes/module/mes/posix.mes @@ -1,7 +1,7 @@ ;;; -*-scheme-*- ;;; GNU Mes --- Maxwell Equations of Software -;;; Copyright © 2017 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2017, 2023 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Mes. ;;; @@ -24,7 +24,7 @@ (mes-use-module (srfi srfi-13)) -(define R_OK 0) +(define R_OK 4) (define S_IRWXU #o700) (define (basename file-name . ext) From ab9946d8effc89bc534fb3aeb59ff1810814cefd Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Sun, 2 Jul 2023 21:10:35 +0200 Subject: [PATCH 024/118] lib/tests: Initialize local variable. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reuported by Andrius Štikonas via IRC. * lib/tests/assert/50-assert.c (main): Initialize local f. * lib/tests/scaffold/21-char-array.c (main): Likewise. --- lib/tests/assert/50-assert.c | 4 ++-- lib/tests/scaffold/21-char-array.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tests/assert/50-assert.c b/lib/tests/assert/50-assert.c index 6702ab10..21037999 100644 --- a/lib/tests/assert/50-assert.c +++ b/lib/tests/assert/50-assert.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2023 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -25,7 +25,7 @@ int main () { - int f; + int f = 0; puts ("\n"); puts ("t: assert (1) ?\n"); diff --git a/lib/tests/scaffold/21-char-array.c b/lib/tests/scaffold/21-char-array.c index a3bf9eef..2db15eb2 100644 --- a/lib/tests/scaffold/21-char-array.c +++ b/lib/tests/scaffold/21-char-array.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2018,2023 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -24,7 +24,7 @@ main () char *s = "mes"; if (!s[0]) return 1; - int f; + int f = 0; int v = 3; if (!s[f]) return 2; From 5850531ae95e71f3a558eef5f345d5acea2aab49 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Mon, 3 Jul 2023 20:29:54 +0200 Subject: [PATCH 025/118] core: Set compiler for M2-Planet. This is a follow-up to commit 7a6505be6efcae3fe0376a91069c2341a0ca85a7 build: Cater for M2-Planet. * src/mes.c (mes_environment)[__M2__]: Set compiler to "m2c". --- src/mes.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mes.c b/src/mes.c index 86699ba5..86619286 100644 --- a/src/mes.c +++ b/src/mes.c @@ -47,6 +47,8 @@ mes_environment (int argc, char **argv) char *compiler = "gnuc"; #if __MESC__ compiler = "mesc"; +#elif __M2__ + compiler = "m2c"; #elif __TINYC__ compiler = "tcc"; #endif From 8e75c00c7b278b70d3f42dc6be90e09a0ae652c0 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Sat, 8 Jul 2023 11:11:38 +0200 Subject: [PATCH 026/118] repl: Fix include, load, use MODULE, and mes-use-module. Reported by Irvise via IRC. * mes/module/mes/repl.mes (repl)[load-env, mes-load-module-env]: New inner defines. [use]: Use mes-load-module-env, do not return content of module. Special-case 'include' and 'load'. --- mes/module/mes/repl.mes | 56 ++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/mes/module/mes/repl.mes b/mes/module/mes/repl.mes index 45833288..fb38df29 100644 --- a/mes/module/mes/repl.mes +++ b/mes/module/mes/repl.mes @@ -126,6 +126,26 @@ along with GNU Mes. If not, see . (newline)) (core:macro-expand sexp)))) + (define (load-env file-name a) + (push! *input-ports* (current-input-port)) + (set-current-input-port + (open-input-file file-name)) + (let ((x (core:eval (append2 (cons 'begin (read-input-file-env a)) + '((current-module))) + a))) + (set-current-input-port (pop! *input-ports*)) + x)) + + (define (mes-load-module-env module a) + (push! *input-ports* (current-input-port)) + (set-current-input-port + (open-input-file (string-append %moduledir (module->file module)))) + (let ((x (core:eval (append2 (cons 'begin (read-input-file-env a)) + '((current-module))) + a))) + (set-current-input-port (pop! *input-ports*)) + x)) + (define (help . x) (display help-commands) *unspecified*) (define (show . x) (define topic-alist `((#\newline . ,show-commands) @@ -140,7 +160,8 @@ along with GNU Mes. If not, see . (define (use a) (lambda () (let ((module (read))) - (mes-load-module-env module a)))) + (mes-load-module-env module a) + module))) (define (meta command a) (let ((command-alist `((expand . ,(expand a)) (help . ,help) @@ -163,19 +184,26 @@ along with GNU Mes. If not, see . (display sexp) (display "]") (newline)) - (if (and (pair? sexp) (eq? (car sexp) 'mes-use-module)) - (loop (mes-load-module-env (cadr sexp) a)) - (let ((e (if (and (pair? sexp) (eq? (car sexp) (string->symbol "unquote"))) - (meta (cadr sexp) a) - (core:eval sexp a)))) - (if (eq? e *unspecified*) (loop a) - (let ((id (string->symbol (string-append "$" (number->string count))))) - (set! count (+ count 1)) - (display id) - (display " = ") - (write e) - (newline) - (loop (acons id e a))))))))) + (cond + ((and (pair? sexp) (eq? (car sexp) 'mes-use-module)) + (let ((module (cadr sexp))) + (mes-load-module-env module a) + (loop a))) + ((and (pair? sexp) (memq (car sexp) '(include load))) + (load-env (cadr sexp) a) + (loop a)) + (else + (let ((e (if (and (pair? sexp) (eq? (car sexp) (string->symbol "unquote"))) + (meta (cadr sexp) a) + (core:eval sexp a)))) + (if (eq? e *unspecified*) (loop a) + (let ((id (string->symbol (string-append "$" (number->string count))))) + (set! count (+ count 1)) + (display id) + (display " = ") + (write e) + (newline) + (loop (acons id e a)))))))))) (lambda (key . args) (if (defined? 'with-output-to-string) (simple-format (current-error-port) "exception:~a:~a\n" key args) From d5ba6723018f47496a463d5041d1d338092b157b Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Thu, 24 Aug 2023 14:28:00 +0200 Subject: [PATCH 027/118] build: Fix typo causing tcc tests being skipped. * build-aux/check-mescc.sh (TESTS): Use $tcc_tests instead of $tcc_test. --- build-aux/check-mescc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/check-mescc.sh b/build-aux/check-mescc.sh index 46479a04..fc05f12a 100755 --- a/build-aux/check-mescc.sh +++ b/build-aux/check-mescc.sh @@ -298,7 +298,7 @@ fi if test -n "$bootstrap"; then TESTS="${TESTS-$mes_tests$tcc_tests}" else - TESTS="${TESTS-$mes_tests$tcc_test$gnu_tests}" + TESTS="${TESTS-$mes_tests$tcc_tests$gnu_tests}" fi # Allow for make check xfail_tests=lib/tests/setjmp/80-setjmp.c From ff0277723611f660b63f0c1140a5ea8a823592ab Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Thu, 24 Aug 2023 15:12:58 +0200 Subject: [PATCH 028/118] mes: Add %program to mes-compatibility for Guile. This fixes running scaffold/boot/gc.scm with Guile. * module/mes/guile.scm (%program): Define and export. --- module/mes/guile.scm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/module/mes/guile.scm b/module/mes/guile.scm index 242561f9..3e758692 100644 --- a/module/mes/guile.scm +++ b/module/mes/guile.scm @@ -2,6 +2,7 @@ ;;; GNU Mes --- Maxwell Equations of Software ;;; Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2023 Ekaitz Zarraga ;;; ;;; This file is part of GNU Mes. ;;; @@ -23,8 +24,7 @@ ;;; Code: (define-module (mes guile) - #:export ( - + #:export ( @@ -34,6 +34,8 @@ %arch %compiler + %program + append2 core:apply core:car @@ -46,14 +48,10 @@ core:write-error core:write-port core:type - %compiler equal2? keyword->string pmatch-car - pmatch-cdr - ) - ;;#:re-export (open-input-file open-input-string with-input-from-string) - ) + pmatch-cdr)) (cond-expand (guile-2) @@ -91,10 +89,11 @@ (define 10) (define 11) (define 15) + (define %arch (car (string-split %host-type #\-))) (define %compiler "gnuc") + (define %program #f) - (define %compiler "gnuc") (define keyword->string (compose symbol->string keyword->symbol)) (define (core:type x) From 294d8a9737c9d6e6f01d642abc8a0c5d43c40487 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Thu, 24 Aug 2023 19:06:40 +0200 Subject: [PATCH 029/118] mes: iota: Make compatible with Guile. * mes/module/mes/scm.mes (iota): Throw exception when n < 0. * tests/scm.test: Import (mes catch). ("iota -1"): Rewrite with exception handling. --- mes/module/mes/scm.mes | 7 +++++-- tests/scm.test | 10 +++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/mes/module/mes/scm.mes b/mes/module/mes/scm.mes index dadd3589..5700e179 100644 --- a/mes/module/mes/scm.mes +++ b/mes/module/mes/scm.mes @@ -2,6 +2,7 @@ ;;; GNU Mes --- Maxwell Equations of Software ;;; Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2023 Ekaitz Zarraga ;;; ;;; This file is part of GNU Mes. ;;; @@ -164,8 +165,10 @@ (list-tail (cdr x) (- n 1)))) (define (iota n) - (if (<= n 0) '() - (append2 (iota (- n 1)) (list (- n 1))))) + (cond + ((< n 0) (throw 'wrong-type-arg n)) + ((= n 0) '()) + (else (append2 (iota (- n 1)) (list (- n 1)))))) (define (reverse lst) (let loop ((lst lst) (r '())) diff --git a/tests/scm.test b/tests/scm.test index a19fcd16..a3b14a59 100755 --- a/tests/scm.test +++ b/tests/scm.test @@ -10,6 +10,7 @@ exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests ;;; GNU Mes --- Maxwell Equations of Software ;;; Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2023 Ekaitz Zarraga ;;; ;;; This file is part of GNU Mes. ;;; @@ -30,6 +31,8 @@ exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests #:use-module (mes mes-0) #:use-module (mes test)) +(mes-use-module (mes catch)) + (cond-expand (mes (primitive-load "module/mes/test.scm")) @@ -131,7 +134,12 @@ exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests '() (iota 0)) (pass-if-equal "iota -1" - '() (iota -1)) + 'iota-negative-length + (catch 'wrong-type-arg + (lambda () + (iota -1)) + (lambda (key . args) + 'iota-negative-length))) (pass-if "cond-expand" (sequal? (cond-expand (foobar #f) (mes (display ": pass: *YAY*") 'mes) (guile (display ": pass: *GUILE*") 'mes)) 'mes)) From 721a06fc0b586f7615a7f6c5f78d33223f3fd987 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Thu, 24 Aug 2023 19:54:06 +0200 Subject: [PATCH 030/118] tests: Make tests/vector.test compatible with Guile. * mes/module/mes/type-0.mes (unspecified?): New function. * tests/vector.test (make-vector): Use it to test equality rather than rely on string comparison. --- mes/module/mes/type-0.mes | 4 ++++ tests/vector.test | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mes/module/mes/type-0.mes b/mes/module/mes/type-0.mes index beefbf06..5d1af885 100644 --- a/mes/module/mes/type-0.mes +++ b/mes/module/mes/type-0.mes @@ -2,6 +2,7 @@ ;;; GNU Mes --- Maxwell Equations of Software ;;; Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2023 Ekaitz Zarraga ;;; ;;; This file is part of GNU Mes. ;;; @@ -76,6 +77,9 @@ (define (port? x) (eq? (core:type x) )) +(define (unspecified? x) + (eq? (if #f #f) x)) + (define (procedure? p) (and (or (builtin? p) (and (pair? p) (eq? (car p) 'lambda)) diff --git a/tests/vector.test b/tests/vector.test index 0bf8c185..8263b3e4 100755 --- a/tests/vector.test +++ b/tests/vector.test @@ -7,6 +7,7 @@ exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests ;;; GNU Mes --- Maxwell Equations of Software ;;; Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2023 Ekaitz Zarraga ;;; ;;; This file is part of GNU Mes. ;;; @@ -39,7 +40,11 @@ exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests (pass-if "vector?" (vector? #(1 2 c))) (pass-if "vector-length" (seq? (vector-length #(1)) 1)) -(pass-if "make-vector" (sequal? (make-vector 3) #(*unspecified* *unspecified* *unspecified*))) +(pass-if "make-vector" (let ((v (make-vector 3))) + (and (= 3 (vector-length v)) + (unspecified? (vector-ref v 0)) + (unspecified? (vector-ref v 1)) + (unspecified? (vector-ref v 2))))) (pass-if "make-vector 1" (sequal? (make-vector 3 0) #(0 0 0))) (pass-if "vector-ref" (seq? (vector-ref #(0 1) 1) 1)) From 102fe7dc5899abf58f8e8d39d029550735cc6810 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Sat, 26 Aug 2023 23:53:38 +0200 Subject: [PATCH 031/118] mescc: Remove duplicate include. * module/mescc/preprocess.scm (mescc): Remove second (nyacc lang c99 parser) include. --- module/mescc/preprocess.scm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/mescc/preprocess.scm b/module/mescc/preprocess.scm index 375ac3bd..05aa7546 100644 --- a/module/mescc/preprocess.scm +++ b/module/mescc/preprocess.scm @@ -1,5 +1,5 @@ ;;; GNU Mes --- Maxwell Equations of Software -;;; Copyright © 2016,2017,2018,2020 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2016,2017,2018,2020,2023 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Mes. ;;; @@ -26,7 +26,6 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (nyacc lang c99 parser) - #:use-module (nyacc lang c99 parser) #:use-module (nyacc version) #:use-module (mes guile) #:export (c99-input->ast)) From addecda4fe613b8068a067f77d2426815f4c3c3f Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Mon, 28 Aug 2023 09:12:36 +0200 Subject: [PATCH 032/118] guix: mes.git: Add gdb. * guix/git/mes.scm (mes.git)[native-inputs]: Add gdb. --- guix/git/mes.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/guix/git/mes.scm b/guix/git/mes.scm index 6a9f34fe..4a61fbf8 100644 --- a/guix/git/mes.scm +++ b/guix/git/mes.scm @@ -31,6 +31,7 @@ #:use-module (gnu packages commencement) #:use-module (gnu packages cross-base) #:use-module (gnu packages gcc) + #:use-module (gnu packages gdb) #:use-module (gnu packages graphviz) #:use-module (gnu packages guile) #:use-module (gnu packages man) @@ -241,7 +242,7 @@ Guile.") (license gpl3+))) (define-public mes.git - (let ((version #!mes!# "0.24.2") + (let ((version #!mes!# "0.24.2") (revision "0") (commit (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f 2" OPEN_READ)))) (package @@ -250,4 +251,7 @@ Guile.") (version (string-append version "-" revision "." (string-take commit 7))) (source (local-file %source-dir #:recursive? #t - #:select? (git-predicate %source-dir)))))) + #:select? (git-predicate %source-dir))) + (native-inputs + `(("gdb" ,gdb) + ,@(package-native-inputs mes)))))) From 96ad09dbfdb30a3f93528af45c81be668c399bfd Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Mon, 28 Aug 2023 09:40:18 +0200 Subject: [PATCH 033/118] lib: tests: 63-struct-cell: Avoid segfault by array overflow with gcc >= 10. * lib/tests/scaffold/63-struct-cell.c (g_functions]: Use size 3. --- lib/tests/scaffold/63-struct-cell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tests/scaffold/63-struct-cell.c b/lib/tests/scaffold/63-struct-cell.c index 2af86e0c..0f97d311 100644 --- a/lib/tests/scaffold/63-struct-cell.c +++ b/lib/tests/scaffold/63-struct-cell.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2023 Janneke Nieuwenhuizen * * This file is part of GNU Mes. * @@ -80,7 +80,7 @@ struct function g_bar = { &bar, 1, "bar" }; void *functions[2]; //int functions[2]; -struct function g_functions[2]; +struct function g_functions[3]; int g_function = 0; enum type_t From 4134285e8ed3dd85003ceedf905a6b2a3aa514d1 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Tue, 29 Aug 2023 20:09:36 +0200 Subject: [PATCH 034/118] lib: tests: Add 16-cast. * lib/tests/scaffold/16-cast.c: Add file. * build-aux/check-mescc.sh (mes_tests): Add it. --- build-aux/check-mescc.sh | 1 + lib/tests/scaffold/16-cast.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 lib/tests/scaffold/16-cast.c diff --git a/build-aux/check-mescc.sh b/build-aux/check-mescc.sh index fc05f12a..b8dfc6d3 100755 --- a/build-aux/check-mescc.sh +++ b/build-aux/check-mescc.sh @@ -46,6 +46,7 @@ lib/tests/scaffold/13-if-neq.c lib/tests/scaffold/14-if-goto.c lib/tests/scaffold/15-if-not-f.c lib/tests/scaffold/16-if-t.c +lib/tests/scaffold/16-cast.c lib/tests/scaffold/17-compare-char.c lib/tests/scaffold/17-compare-ge.c lib/tests/scaffold/17-compare-gt.c diff --git a/lib/tests/scaffold/16-cast.c b/lib/tests/scaffold/16-cast.c new file mode 100644 index 00000000..d83d4e8b --- /dev/null +++ b/lib/tests/scaffold/16-cast.c @@ -0,0 +1,36 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2023 Ekaitz Zarraga + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +int +main () +{ + char c = -1; + unsigned u = c; + unsigned t = (unsigned char)c; + int i = -1; + int r = u != -1; + if (r) + return 2; + i = 255; + r = t != 255; + if (r) + return 1; + return 0; +} From 2be2de827f2bcb42b619ee18df2530eab41e853b Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Tue, 29 Aug 2023 20:15:03 +0200 Subject: [PATCH 035/118] lib: tests: Add 17-compare-rotated. * lib/tests/scaffold/17-compare-rotated.c: Add file. * build-aux/check-mescc.sh (mes_tests): Add it. --- build-aux/check-mescc.sh | 1 + lib/tests/scaffold/17-compare-rotated.c | 42 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 lib/tests/scaffold/17-compare-rotated.c diff --git a/build-aux/check-mescc.sh b/build-aux/check-mescc.sh index b8dfc6d3..0ac7216c 100755 --- a/build-aux/check-mescc.sh +++ b/build-aux/check-mescc.sh @@ -64,6 +64,7 @@ lib/tests/scaffold/17-compare-or.c lib/tests/scaffold/17-compare-and-or.c lib/tests/scaffold/17-compare-assign.c lib/tests/scaffold/17-compare-call.c +lib/tests/scaffold/17-compare-rotated.c lib/tests/scaffold/18-assign-shadow.c lib/tests/scaffold/20-while.c lib/tests/scaffold/21-char-array-simple.c diff --git a/lib/tests/scaffold/17-compare-rotated.c b/lib/tests/scaffold/17-compare-rotated.c new file mode 100644 index 00000000..2487445e --- /dev/null +++ b/lib/tests/scaffold/17-compare-rotated.c @@ -0,0 +1,42 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2023 Ekaitz Zarraga + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +int +main () +{ + unsigned u = 0xFFFFFFFF; + u = u <<30 >>30; // higher 30 bits are cleared because they leave + // the register to the left + int i = 3; + int r = u != i; + if (r) + return 1; + + unsigned short s = 0xFFFF; + s = s <<14 >>14; // s<<14 is promoted to int, the higher bits are + // not cleared, because there's space in the + // register + i = 0xFFFF; + r = s != i; + if (r) + return 2; + + return 0; +} From 0f0dad64368a48157dbceb96c021838bb91b3862 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Wed, 30 Aug 2023 04:46:27 +0200 Subject: [PATCH 036/118] DRAFT lib: tests: 17-compare-unsigned-char-le.c: Avoid gcc optimize. * lib/tests/scaffold/17-compare-unsigned-char-le.c (main): Change comparison with immediate to comparison with variable. --- lib/tests/scaffold/17-compare-unsigned-char-le.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/tests/scaffold/17-compare-unsigned-char-le.c b/lib/tests/scaffold/17-compare-unsigned-char-le.c index 70977903..7ce0372a 100644 --- a/lib/tests/scaffold/17-compare-unsigned-char-le.c +++ b/lib/tests/scaffold/17-compare-unsigned-char-le.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2018,2023 Janneke Nieuwenhuizen * * This file is part of GNU Mes. * @@ -21,10 +21,12 @@ int main () { - unsigned char r = -2; - if (r <= -3) + unsigned char uc = -2; + int i = - 3; + if (uc <= i) return 1; - if (r <= (unsigned char) -1) + i = -1; + if (uc <= (unsigned char) i) return 0; return 2; } From a0c9c0aedbe76b2ea44f5a67756b5e08f90063e0 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Wed, 30 Aug 2023 04:53:28 +0200 Subject: [PATCH 037/118] DRAFT lib: tests: 17-compare-unsigned-short-le.c: Avoid gcc optimize. * lib/tests/scaffold/17-compare-unsigned-short-le.c (main): Change comparison with immediate to comparison with variable. --- lib/tests/scaffold/17-compare-unsigned-short-le.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/tests/scaffold/17-compare-unsigned-short-le.c b/lib/tests/scaffold/17-compare-unsigned-short-le.c index 20b77ebc..97403af4 100644 --- a/lib/tests/scaffold/17-compare-unsigned-short-le.c +++ b/lib/tests/scaffold/17-compare-unsigned-short-le.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2018,2023 Janneke Nieuwenhuizen * * This file is part of GNU Mes. * @@ -21,10 +21,12 @@ int main () { - unsigned short r = -2; - if (r <= -3) + unsigned short us = -2; + int i = -3; + if (us <= i) return 1; - if (r <= (unsigned short) -1) + i = -1; + if (us <= (unsigned short) i) return 0; return 2; } From 6aa77fe162e97b476c20cc235464c59ae6213337 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Wed, 30 Aug 2023 05:53:19 +0200 Subject: [PATCH 038/118] DRAFT lib: tests: 17-compare-unsigned-le: Add case from 7s-unsigned-compare. * lib/tests/scaffold/17-compare-unsigned-le.c: Add case from 7s-unsigned-compare; rewrite to avoid gcc-optimize. --- lib/tests/scaffold/17-compare-unsigned-le.c | 22 +++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/tests/scaffold/17-compare-unsigned-le.c b/lib/tests/scaffold/17-compare-unsigned-le.c index e6b7fa60..54afafd7 100644 --- a/lib/tests/scaffold/17-compare-unsigned-le.c +++ b/lib/tests/scaffold/17-compare-unsigned-le.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2018,2023 Janneke Nieuwenhuizen * * This file is part of GNU Mes. * @@ -21,10 +21,20 @@ int main () { - unsigned r = -2; - if (r <= -3) + unsigned u = -2; + int i = -3; + int r = u <= -3; + if (r) return 1; - if (r <= -1) - return 0; - return 2; + + i = -1; + r = u <= -1; + if (!r) + return 2; + + u = 0; + i = -1; + r = i <= u; + if (r) + return 3; } From b6bad13883977a5249468ae25c9ecba7f8030f37 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Sat, 9 Sep 2023 13:56:01 +0200 Subject: [PATCH 039/118] build: Help help2man generate reproducible man-pages. * build-aux/GNUmakefile.in (SOURCE_DATE_EPOCH): New variable. --- build-aux/GNUmakefile.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build-aux/GNUmakefile.in b/build-aux/GNUmakefile.in index 80b51e79..c5ede91e 100644 --- a/build-aux/GNUmakefile.in +++ b/build-aux/GNUmakefile.in @@ -227,6 +227,10 @@ man: doc/mes.1 doc/mescc.1 doc/mesar.1 %: %.o %: %.c +# help2man reproducibility +SOURCE_DATE_EPOCH=$(shell git show HEAD --format=%ct --no-patch 2>/dev/null || echo 0) +export SOURCE_DATE_EPOCH + doc/mes.1: src/${program_prefix}mes | build MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) \ --name="Scheme interpreter for bootstrapping the GNU system" \ @@ -286,7 +290,7 @@ TARBALL_VERSION=$(COMMIT:v%=%) TARBALL_DIR:=$(PACKAGE)-$(TARBALL_VERSION) TARBALL:=$(TARBALL_DIR).tar.gz # Be friendly to Debian; avoid using EPOCH -MTIME=$(shell git show HEAD --format=%ct --no-patch 2>/dev/null) +MTIME=$(SOURCE_DIR_EPOCH) # Reproducible tarball TAR_FLAGS=--sort=name --mtime=@$(MTIME) --owner=0 --group=0 --numeric-owner --mode=go=rX,u+rw,a-s From 002dc6253a6472ec8a63d1826e1d1880521cbe94 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Sat, 9 Sep 2023 14:04:20 +0200 Subject: [PATCH 040/118] build: Generate reproducible doc/version.texi. * build-aux/GNUmakefile.in (doc/version.texi): Use timestamp from git. --- build-aux/GNUmakefile.in | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build-aux/GNUmakefile.in b/build-aux/GNUmakefile.in index c5ede91e..7af36148 100644 --- a/build-aux/GNUmakefile.in +++ b/build-aux/GNUmakefile.in @@ -170,10 +170,13 @@ uninstall: doc/version.texi: ${srcdest}doc/mes.texi GNUmakefile @mkdir -p $(@D) - (set `LANG= date -r $< +'%d %B %Y'`;\ - echo "@set UPDATED $$1 $$2 $$3"; \ - echo "@set UPDATED-MONTH $$2 $$3"; \ - echo "@set EDITION $(VERSION)"; \ + timestamp=$$({ git log --pretty=format:%ct -- $< \ + || date +%s -r $<; } \ + | sort -n -r | head -n 1); \ + dmy=$$(date --date="@$$timestamp" "+%-d %B %Y"); \ + (echo "@set UPDATED $$dmy"; \ + echo "@set UPDATED-MONTH $$my"; \ + echo "@set EDITION $(VERSION)"; \ echo "@set VERSION $(VERSION)") > $@ doc: doc/version.texi From 189ea8eb9d1f19508415dcdacf9e6426760bea24 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Thu, 17 Nov 2022 22:48:28 +0100 Subject: [PATCH 041/118] x86_64: build: Cater for M2-Planet. * build-aux/cflags.sh: Set cc_cpu. * build-aux/config.sh.in (cc_cpu): Export. * build-aux/export.make (cc_cpu): Likewise. * kaem.arm (cc_cpu): New variable. * kaem.x86 (cc_cpu): New variable. * kaem.run (cc_cpu): New variable. Define ____. * scaffold/argv.kaem (cc_cpu): Likewise. Define __linux__ * scaffold/global-array.kaem (cc_cpu): Likewise. * scaffold/hello.kaem (cc_cpu): Likewise. * scaffold/local-array.kaem (cc_cpu): Likewise. * scaffold/local-static-array.kaem (cc_cpu): Likewise. * scaffold/main.kaem (cc_cpu): Likewise. * scaffold/read.kaem (cc_cpu): Likewise. * kaem.x86_64: New file. lib/m2/x86_64/ELF-x86_64.hex2, lib/m2/x86_64/x86_64_defs.M1: New files, imported from M2Libc. lib/linux/x86_64-mes-m2/_exit.c, lib/linux/x86_64-mes-m2/_write.c, lib/linux/x86_64-mes-m2/crt1.M1, lib/linux/x86_64-mes-m2/crt1.c, lib/linux/x86_64-mes-m2/syscall.c: New files, adapted for M2-Planet calling convention from ... * lib/linux/x86_64-mes-mescc: ... here. * build-aux/build.sh.in: Also allow kaem build for x86_64. * include/mes/lib-mini.h[__M2__]: Define as sizeof (void*). * include/mes/mes.h[__M2__](M2_CELL_SIZE): Define as sizeof (struct scm). * lib/x86_64-mes/x86_64.M1 (add____$i8,%rbp, mov____%rdi,%rbp): New defines. * src/posix.c (TIME_UNITS_PER_SECOND): Cater for 64bit M2-Planet. --- build-aux/build.sh.in | 3 +- build-aux/cflags.sh | 4 + build-aux/config.sh.in | 1 + build-aux/export.make | 3 +- include/mes/lib-mini.h | 2 +- include/mes/mes.h | 2 +- kaem.arm | 1 + kaem.run | 2 + kaem.x86 | 1 + kaem.x86_64 | 25 ++++++ lib/linux/x86_64-mes-m2/_exit.c | 29 +++++++ lib/linux/x86_64-mes-m2/_write.c | 31 +++++++ lib/linux/x86_64-mes-m2/crt1.M1 | 56 ++++++++++++ lib/linux/x86_64-mes-m2/crt1.c | 34 ++++++++ lib/linux/x86_64-mes-m2/syscall.c | 137 ++++++++++++++++++++++++++++++ lib/m2/x86_64/ELF-x86_64.hex2 | 74 ++++++++++++++++ lib/m2/x86_64/x86_64_defs.M1 | 101 ++++++++++++++++++++++ lib/x86_64-mes/x86_64.M1 | 2 + scaffold/argv.kaem | 3 + scaffold/global-array.kaem | 6 +- scaffold/hello.kaem | 5 +- scaffold/local-array.kaem | 6 +- scaffold/local-static-array.kaem | 6 +- scaffold/main.kaem | 5 +- scaffold/read.kaem | 5 +- src/posix.c | 11 +-- 26 files changed, 540 insertions(+), 15 deletions(-) create mode 100644 kaem.x86_64 create mode 100644 lib/linux/x86_64-mes-m2/_exit.c create mode 100644 lib/linux/x86_64-mes-m2/_write.c create mode 100644 lib/linux/x86_64-mes-m2/crt1.M1 create mode 100644 lib/linux/x86_64-mes-m2/crt1.c create mode 100644 lib/linux/x86_64-mes-m2/syscall.c create mode 100644 lib/m2/x86_64/ELF-x86_64.hex2 create mode 100644 lib/m2/x86_64/x86_64_defs.M1 diff --git a/build-aux/build.sh.in b/build-aux/build.sh.in index b8900b1b..2a2cb3d0 100644 --- a/build-aux/build.sh.in +++ b/build-aux/build.sh.in @@ -102,7 +102,8 @@ fi ) if test -n "$M2_PLANET" && (test "$mes_cpu" == "x86" \ - || test "$mes_cpu" == "arm"); then + || test "$mes_cpu" == "x86_64" \ + || test "$mes_cpu" == "arm" ); then ( . ${srcdest}build-aux/trace.sh if [ -z "$V" -o "$V" = 0 ]; then diff --git a/build-aux/cflags.sh b/build-aux/cflags.sh index da98b4cb..e19bd1dc 100644 --- a/build-aux/cflags.sh +++ b/build-aux/cflags.sh @@ -18,16 +18,20 @@ case "$mes_cpu" in arm) + cc_cpu=arm stage0_cpu=armv7l ;; x86_64) + cc_cpu=x86_64 stage0_cpu=amd64 ;; x86) + cc_cpu=i386 stage0_cpu=x86 ;; *) stage0_cpu=$mes_cpu + cc_cpu=$mes_cpu ;; esac diff --git a/build-aux/config.sh.in b/build-aux/config.sh.in index ae4c1ce7..a919f141 100644 --- a/build-aux/config.sh.in +++ b/build-aux/config.sh.in @@ -97,6 +97,7 @@ export CC export DIFF export SHELL export V +export cc_cpu export colors export compiler export courageous diff --git a/build-aux/export.make b/build-aux/export.make index 3bfb0bff..05b85611 100644 --- a/build-aux/export.make +++ b/build-aux/export.make @@ -1,5 +1,5 @@ # GNU Mes --- Maxwell Equations of Software -# Copyright © 2018 Jan (janneke) Nieuwenhuizen +# Copyright © 2018,2023 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # @@ -43,6 +43,7 @@ export moduledir export sysconfdir export bootstrap +export cc_cpu export compiler export courageous export mes_system diff --git a/include/mes/lib-mini.h b/include/mes/lib-mini.h index eb994f79..48d91362 100644 --- a/include/mes/lib-mini.h +++ b/include/mes/lib-mini.h @@ -41,7 +41,7 @@ for that by multiplying with M2_PTR_SIZE when using (char) pointers. */ #if __M2__ -#define M2_PTR_SIZE 4 +#define M2_PTR_SIZE sizeof (void*) #else #define M2_PTR_SIZE 1 #endif diff --git a/include/mes/mes.h b/include/mes/mes.h index 0323b2dc..c189ab69 100644 --- a/include/mes/mes.h +++ b/include/mes/mes.h @@ -57,7 +57,7 @@ struct scm for that by multiplying with M2_CELL_SIZE when using cell pointers. */ #if __M2__ -#define M2_CELL_SIZE 12 +#define M2_CELL_SIZE sizeof (struct scm) #else #define M2_CELL_SIZE 1 #endif diff --git a/kaem.arm b/kaem.arm index 4e973a1f..4357c62b 100644 --- a/kaem.arm +++ b/kaem.arm @@ -19,6 +19,7 @@ # Usage: # kaem --verbose --strict +cc_cpu=arm mes_cpu=arm stage0_cpu=armv7l kaem --verbose --strict diff --git a/kaem.run b/kaem.run index 1179aa23..d4d51b54 100644 --- a/kaem.run +++ b/kaem.run @@ -19,6 +19,7 @@ # Usage: # kaem --verbose --strict +cc_cpu=${cc_cpu:-i386} mes_cpu=${mes_cpu:-x86} stage0_cpu=${stage0_cpu:-x86} @@ -27,6 +28,7 @@ mkdir -p m2 M2-Planet \ --debug \ --architecture ${stage0_cpu} \ + -D __${cc_cpu}__=1 \ -D __linux__=1 \ -f include/mes/config.h \ -f include/mes/lib-mini.h \ diff --git a/kaem.x86 b/kaem.x86 index 60ab6e6b..caea7f87 100644 --- a/kaem.x86 +++ b/kaem.x86 @@ -19,6 +19,7 @@ # Usage: # kaem --verbose --strict +cc_cpu=i386 mes_cpu=x86 stage0_cpu=x86 kaem --verbose --strict diff --git a/kaem.x86_64 b/kaem.x86_64 new file mode 100644 index 00000000..b20aecc3 --- /dev/null +++ b/kaem.x86_64 @@ -0,0 +1,25 @@ +#! /bin/sh +# Copyright © 2022 Jan (janneke) Nieuwenhuizen +# +# This file is part of GNU Mes. +# +# GNU Mes is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GNU Mes is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Mes. If not, see . + +# Usage: +# kaem --verbose --strict + +cc_cpu=x86_64 +mes_cpu=x86_64 +stage0_cpu=amd64 +kaem --verbose --strict diff --git a/lib/linux/x86_64-mes-m2/_exit.c b/lib/linux/x86_64-mes-m2/_exit.c new file mode 100644 index 00000000..3396ebb7 --- /dev/null +++ b/lib/linux/x86_64-mes-m2/_exit.c @@ -0,0 +1,29 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2018,2020,2022 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include "mes/lib-mini.h" + +void +_exit (int status) +{ + asm ("mov____$i32,%rax SYS_exit"); + asm ("mov____0x8(%rbp),%rdi !-8"); + asm ("syscall"); +} diff --git a/lib/linux/x86_64-mes-m2/_write.c b/lib/linux/x86_64-mes-m2/_write.c new file mode 100644 index 00000000..25b0faed --- /dev/null +++ b/lib/linux/x86_64-mes-m2/_write.c @@ -0,0 +1,31 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2018,2020,2022 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include "mes/lib-mini.h" + +void +_write (int filedes, void const *buffer, size_t size) +{ + asm ("mov____$i32,%rax SYS_write"); + asm ("mov____0x8(%rbp),%rdi !-8"); + asm ("mov____0x8(%rbp),%rsi !-16"); + asm ("mov____0x8(%rbp),%rdx !-24"); + asm ("syscall"); +} diff --git a/lib/linux/x86_64-mes-m2/crt1.M1 b/lib/linux/x86_64-mes-m2/crt1.M1 new file mode 100644 index 00000000..5a792ff2 --- /dev/null +++ b/lib/linux/x86_64-mes-m2/crt1.M1 @@ -0,0 +1,56 @@ +### GNU Mes --- Maxwell Equations of Software +### Copyright © 2017,2018,2019,2022,2023 Jan (janneke) Nieuwenhuizen +### +### This file is part of GNU Mes. +### +### GNU Mes is free software; you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by +### the Free Software Foundation; either version 3 of the License, or (at +### your option) any later version. +### +### GNU Mes is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +### GNU General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with GNU Mes. If not, see . + +:_start + push___%rbp + mov____%rsp,%rbp + + ;; mes c lib io + mov____$i8,%rax !0 + movl___%eax,0x32 &GLOBAL___stdin + mov____$i8,%rax !1 + movl___%eax,0x32 &GLOBAL___stdout + mov____$i8,%rax !2 + movl___%eax,0x32 &GLOBAL___stderr + + ;; M2-Planet pushes forward + mov____%rbp,%rax ;argc + add____$i8,%rax !8 + mov____(%rax),%rax + push___%rax + + mov____%rbp,%rax ;argv + add____$i8,%rax !16 + push___%rax + + mov____%rbp,%rax ;envp + add____$i8,%rax !8 + mov____(%rax),%rax + add____$i8,%rax !0x03 + shl____$i8,%rax !0x03 + add____%rbp,%rax + push___%rax + + ;; mes c lib environ + mov____%rax,0x32 &GLOBAL_environ + + call32 %FUNCTION_main + + mov____%rax,%rdi + mov____$i32,%rax SYS_exit + syscall diff --git a/lib/linux/x86_64-mes-m2/crt1.c b/lib/linux/x86_64-mes-m2/crt1.c new file mode 100644 index 00000000..da4c4824 --- /dev/null +++ b/lib/linux/x86_64-mes-m2/crt1.c @@ -0,0 +1,34 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2018,2022 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include "mes/lib-mini.h" + +int __stdin; +int __stdout; +int __stderr; +char **environ; +int main (int argc, char **argv, char **envp); + +/* FIXME: this is going to be called `FUNCTION__start' */ +//#int +//#_start () +//#{ +//# .. +//#} diff --git a/lib/linux/x86_64-mes-m2/syscall.c b/lib/linux/x86_64-mes-m2/syscall.c new file mode 100644 index 00000000..0675be0b --- /dev/null +++ b/lib/linux/x86_64-mes-m2/syscall.c @@ -0,0 +1,137 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2016,2017,2018,2020,2022 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include +#include + +long +__sys_call (long sys_call) +{ + asm ("mov____0x8(%rbp),%rax !-8"); + asm ("syscall"); +} + +long +__sys_call1 (long sys_call, long one) +{ + asm ("mov____0x8(%rbp),%rax !-8"); + asm ("mov____0x8(%rbp),%rdi !-16"); + asm ("syscall"); +} + +long +__sys_call2 (long sys_call, long one, long two) +{ + asm ("mov____0x8(%rbp),%rax !-8"); + asm ("mov____0x8(%rbp),%rdi !-16"); + asm ("mov____0x8(%rbp),%rsi !-24"); + asm ("syscall"); +} + +long +__sys_call3 (long sys_call, long one, long two, long three) +{ + asm ("mov____0x8(%rbp),%rax !-8"); + asm ("mov____0x8(%rbp),%rdi !-16"); + asm ("mov____0x8(%rbp),%rsi !-24"); + asm ("mov____0x8(%rbp),%rdx !-32"); + asm ("syscall"); +} + +long +__sys_call4 (long sys_call, long one, long two, long three, long four) +{ + asm ("mov____0x8(%rbp),%rax !-8"); + asm ("mov____0x8(%rbp),%rdi !-16"); + asm ("mov____0x8(%rbp),%rsi !-24"); + asm ("mov____0x8(%rbp),%rdx !-32"); + asm ("mov____0x8(%rbp),%r10 !-40"); + asm ("syscall"); +} + +long +_sys_call (long sys_call) +{ + long r = __sys_call (sys_call); + if (r < 0) + { + errno = -r; + r = -1; + } + else + errno = 0; + return r; +} + +long +_sys_call1 (long sys_call, long one) +{ + long r = __sys_call1 (sys_call, one); + if (r < 0) + { + errno = -r; + r = -1; + } + else + errno = 0; + return r; +} + +long +_sys_call2 (long sys_call, long one, long two) +{ + long r = __sys_call2 (sys_call, one, two); + if (r < 0) + { + errno = -r; + r = -1; + } + else + errno = 0; + return r; +} + +long +_sys_call3 (long sys_call, long one, long two, long three) +{ + long r = __sys_call3 (sys_call, one, two, three); + if (r < 0) + { + errno = -r; + r = -1; + } + else + errno = 0; + return r; +} + +long +_sys_call4 (long sys_call, long one, long two, long three, long four) +{ + long r = __sys_call4 (sys_call, one, two, three, four); + if (r < 0) + { + errno = -r; + r = -1; + } + else + errno = 0; + return r; +} diff --git a/lib/m2/x86_64/ELF-x86_64.hex2 b/lib/m2/x86_64/ELF-x86_64.hex2 new file mode 100644 index 00000000..32ccc7c7 --- /dev/null +++ b/lib/m2/x86_64/ELF-x86_64.hex2 @@ -0,0 +1,74 @@ +### Copyright (C) 2016 Jeremiah Orians +### Copyright (C) 2017 Jan Nieuwenhuizen +### This file is part of M2-Planet. +### +### M2-Planet is free software: you can redistribute it and/or modify +### it under the terms of the GNU General Public License as published by +### the Free Software Foundation, either version 3 of the License, or +### (at your option) any later version. +### +### M2-Planet is distributed in the hope that it will be useful, +### but WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +### GNU General Public License for more details. +### +### You should have received a copy of the GNU General Public License +### along with M2-Planet. If not, see . + +### stage0's hex2 format +### !