* build-aux/GNUmakefile.in (seed): Resurrect.
* build-aux/build-x86_64-mes.sh: Build from seed.
*.stderr
*.stdout
*.x86-out
+*.x86_64-mes-E
+*.x86_64-mes-S
*.x86_64-mes-gcc-o
*.x86_64-mes-gcc-out
*.x86_64-mes-gcc-stdout
seed: all-go gcc mes-gcc mes-tcc
cd $(MES_SEED) && git reset --hard HEAD
- MES=$(GUILE) GUILE=$(GUILE) SEED=1 ${srcdest}build-aux/build-mes.sh
+ $(MAKE) MES=guile MES_SEED= SEED=1 mes
+ cp -v lib/x86-mes/*.S $(MES_SEED)/x86-mes
+ cp -v src/mes.S $(MES_SEED)/x86-mes
+ $(MAKE) MES=guile MES_SEED= SEED=1 x86_64-mes
+ cp -v lib/x86_64-mes/*.S $(MES_SEED)/x86_64-mes
+ cp -v src/mes.x86_64-mes-S $(MES_SEED)/x86_64-mes/mes.S
+ MES=$(GUILE) GUILE=$(GUILE) SEED=1 MES_SEED= ${srcdest}build-aux/build-mes.sh
cd $(MES_SEED) && MES_PREFIX=$(PWD) ./refresh.sh
MES=$(GUILE) GUILE=$(GUILE) SEED=1 ${srcdest}build-aux/build-mes.sh
- cp lib/x86-mes/elf32-header.hex2\
- lib/x86-mes/x86.M1\
- lib/x86-mes/libc+tcc.S\
+ cd $(MES_SEED) && MES_PREFIX=$(PWD) arch=x86_64-mes ./refresh.sh
+ MES=$(GUILE) GUILE=$(GUILE) SEED=1 ${srcdest}build-aux/build-x86_64-mes.sh
+ cp lib/x86-mes/libc+tcc.S\
lib/x86-mes/libc.S\
lib/x86-mes/crt1.S\
lib/x86-mes/libgetopt.S\
{ set +e; lib/x86-mes/exit-42.mes-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
-ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/linux/x86-mes/crt0
-ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/linux/x86-mes/crti
-ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/linux/x86-mes/crtn
-
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc+tcc
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc+gnu
{ set +e; lib/x86_64-mes/exit-42.x86_64-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
-# if [ -d "$MES_SEED" ]; then
-# mkdir -p lib/x86_64-mes
-# trace "M1 crt1.S" $M1\
-# $M1FLAGS\
-# -f ${srcdest}lib/x86_64-mes/x86_64.M1\
-# -f $MES_SEED/x86_64-mes/crt1.S\
-# -o lib/x86_64-mes/crt1.o
-# trace "M1 libc.S" $M1\
-# $M1FLAGS\
-# -f ${srcdest}lib/x86_64-mes/x86_64.M1\
-# -f $MES_SEED/x86_64-mes/libc.S\
-# -o lib/x86_64-mes/libc.o
-# trace "M1 mes.S" $M1\
-# --LittleEndian\
-# --Architecture 2\
-# -f ${srcdest}lib/x86_64-mes/x86_64.M1\
-# -f $MES_SEED/x86_64-mes/mes.S\
-# -o src/mes.o
-# trace "BLOOD_ELF mes.S" $BLOOD_ELF\
-# -f ${srcdest}lib/x86_64-mes/x86_64.M1\
-# -f $MES_SEED/x86_64-mes/mes.S\
-# -f $MES_SEED/x86_64-mes/libc.S\
-# -o src/mes.S.blood-elf
-# trace "M1 mes.blood-elf" $M1\
-# --LittleEndian\
-# --Architecture 2\
-# -f src/mes.S.blood-elf\
-# -o src/mes.o.blood-elf
-# trace "HEX2 mes.o" $HEX2\
-# $HEX2FLAGS\
-# -f ${srcdest}lib/x86_64-mes/elf64-header.hex2\
-# -f lib/x86_64-mes/crt1.o\
-# -f lib/x86_64-mes/libc.o\
-# -f src/mes.o\
-# -f src/mes.o.blood-elf\
-# --exec_enable\
-# -o src/mes.seed-out
-# cp src/mes.seed-out src/mes
-# trace "M1 libc+tcc.S" $M1\
-# $M1FLAGS\
-# -f ${srcdest}lib/x86_64-mes/x86_64.M1\
-# -f $MES_SEED/x86_64-mes/libc+tcc.S\
-# -o lib/x86_64-mes/libc+tcc.o
-# fi
+if [ -d "$MES_SEED" ]; then
+ mkdir -p lib/x86_64-mes
+ trace "M1 crt1.S" $M1\
+ $M1FLAGS\
+ -f ${srcdest}lib/x86_64-mes/x86_64.M1\
+ -f $MES_SEED/x86_64-mes/crt1.S\
+ -o lib/x86_64-mes/crt1.o
+ trace "M1 libc.S" $M1\
+ $M1FLAGS\
+ -f ${srcdest}lib/x86_64-mes/x86_64.M1\
+ -f $MES_SEED/x86_64-mes/libc.S\
+ -o lib/x86_64-mes/libc.o
+ trace "M1 mes.S" $M1\
+ --LittleEndian\
+ --Architecture 2\
+ -f ${srcdest}lib/x86_64-mes/x86_64.M1\
+ -f $MES_SEED/x86_64-mes/mes.S\
+ -o src/mes.o
+ trace "BLOOD_ELF mes.S" $BLOOD_ELF\
+ -f ${srcdest}lib/x86_64-mes/x86_64.M1\
+ -f $MES_SEED/x86_64-mes/mes.S\
+ -f $MES_SEED/x86_64-mes/libc.S\
+ -o src/mes.S.blood-elf
+ trace "M1 mes.blood-elf" $M1\
+ --LittleEndian\
+ --Architecture 2\
+ -f src/mes.S.blood-elf\
+ -o src/mes.o.blood-elf
+ trace "HEX2 mes.o" $HEX2\
+ $HEX2FLAGS\
+ -f ${srcdest}lib/x86_64-mes/elf64-header.hex2\
+ -f lib/x86_64-mes/crt1.o\
+ -f lib/x86_64-mes/libc.o\
+ -f src/mes.o\
+ -f src/mes.o.blood-elf\
+ --exec_enable\
+ -o src/mes.seed-out
+ cp src/mes.seed-out src/mes
+ trace "M1 libc+tcc.S" $M1\
+ $M1FLAGS\
+ -f ${srcdest}lib/x86_64-mes/x86_64.M1\
+ -f $MES_SEED/x86_64-mes/libc+tcc.S\
+ -o lib/x86_64-mes/libc+tcc.o
+fi
PREPROCESS=1
MES_ARENA=100000000
fi
-ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/linux/x86_64-mes/crt1
+MES_ARENA=100000000
-MES_LIBS='-l none' PREPROCESS= bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/x86_64-mes/exit-42
+ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/linux/x86_64-mes/crt1
+ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libc-mini
+MES64_LIBS='-l c-mini' PREPROCESS= bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/x86_64-mes/exit-42
trace "TEST lib/x86_64-mes/exit-42.x86_64-mes-out" echo lib/x86_64-mes/exit-42.x86_64-mes-out
{ set +e; lib/x86_64-mes/exit-42.x86_64-mes-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
-ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libc-mini
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libc
-
-# ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/linux/x86_64-mes/crt0
-# ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/linux/x86_64-mes/crti
-# ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/linux/x86_64-mes/crtn
-
-# ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libc+tcc
-# ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libc+gnu
-# ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libgetopt
+ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libc+tcc
+ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libc+gnu
+ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-x86_64-mes.sh lib/libgetopt
-# [ -n "$SEED" ] && exit 0
+[ -n "$SEED" ] && exit 0
-# MES_ARENA=${MES_ARENA-100000000}
-# trace "MSNARF gc.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/gc.c
-# trace "MSNARF lib.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/lib.c
-# trace "MSNARF math.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/math.c
-# trace "MSNARF mes.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/mes.c
-# trace "MSNARF posix.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/posix.c
-# trace "MSNARF reader.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/reader.c
-# trace "MSNARF vector.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/vector.c
+MES_ARENA=${MES_ARENA-100000000}
+trace "MSNARF gc.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/gc.c
+trace "MSNARF lib.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/lib.c
+trace "MSNARF math.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/math.c
+trace "MSNARF mes.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/mes.c
+trace "MSNARF posix.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/posix.c
+trace "MSNARF reader.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/reader.c
+trace "MSNARF vector.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.scm --mes src/vector.c
-# echo MES_ARENA=$MES_ARENA
-# bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/main
+echo MES_ARENA=$MES_ARENA
+bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/main
MES_LIBS='-l none' bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/main
{ set +e; scaffold/main.x86_64-mes-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
-# MES_LIBS='-l mini' bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/hello
-# MES_LIBS='-l mini' bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/argv
-# bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/malloc
-# ##sh ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/micro-mes
-# ##sh ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/tiny-mes
-# # bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/mini-mes
-# bash ${srcdest}build-aux/cc-x86_64-mes.sh src/mes
-# cp src/mes.mes-out src/mes
-true
+MES64_LIBS='-l c-mini' bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/hello
+MES64_LIBS='-l c-mini' bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/argv
+bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/malloc
+##sh ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/micro-mes
+##sh ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/tiny-mes
+# bash ${srcdest}build-aux/cc-x86_64-mes.sh scaffold/mini-mes
+bash ${srcdest}build-aux/cc-x86_64-mes.sh src/mes
+cp src/mes.x86_64-mes-out src/mes
mkdir -p $d
if [ -n "$PREPROCESS" ]; then
- trace "CPP.mes64 $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES64_CFLAGS -E -o "$o.E" "${srcdest}$c".c
- trace "CC.mes64 $c.E" ./pre-inst-env bash $MESCC $MES64_CFLAGS -S "$o".E
- trace "AS.mes64 $c.S" ./pre-inst-env bash $MESCC $MES64_CFLAGS -c -o "$o".${p}o "$o".S
+ trace "CPP.mes64 $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES64_CFLAGS -E -o "$o.${p}E" "${srcdest}$c".c
+ trace "CC.mes64 $c.E" ./pre-inst-env bash $MESCC $MES64_CFLAGS -S -o "$o".${p}S "$o".${p}E
+ trace "AS.mes64 $c.S" ./pre-inst-env bash $MESCC $MES64_CFLAGS -c -o "$o".${p}o "$o".${p}S
if [ -z "$NOLINK" ]; then
trace "LD.mes64 $c.o" ./pre-inst-env bash $MESCC $MES64_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
fi
elif [ -n "$COMPILE" ]; then
- trace "CC.mes64 $c.c" trace "MESCC $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES64_CFLAGS -S -o "$o.S" "${srcdest}$c".c
- trace "AS.mes64 $c.S" ./pre-inst-env bash $MESCC $MES64_CFLAGS -c -o "$o".${p}o "$o".S
+ trace "CC.mes64 $c.c" trace "MESCC $c.c" ./pre-inst-env bash $MESCC $MES_CPPFLAGS $MES64_CFLAGS -S -o "$o".${p}S "${srcdest}$c".c
+ trace "AS.mes64 $c.S" ./pre-inst-env bash $MESCC $MES64_CFLAGS -c -o "$o".${p}o "$o".${p}S
if [ -z "$NOLINK" ]; then
trace "LD.mes64 $c.o" ./pre-inst-env bash $MESCC $MES64_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS
fi
+++ /dev/null
-/* -*-comment-start: "//";comment-end:""-*-
- * GNU Mes --- Maxwell Equations of Software
- * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
-
-// no clue what crt0.o is and why gcc-2.6.3 needs it
-
-// instead of calling main, it seems to call either _main or ___main,
-// let's try _main first
-
-char **environ = 0;
-int _main (int argc, char *argv[]);
-
-int
-_start ()
-{
- asm ("mov____%ebp,%eax");
- asm ("add____$i8,%eax !4");
-
- asm ("movzbl_(%eax),%eax");
- asm ("add____$i8,%eax !3");
-
- asm ("shl____$i8,%eax !0x02");
- asm ("add____%ebp,%eax");
- asm ("mov____%eax,0x32 &environ");
-
- asm ("mov____%ebp,%eax");
- asm ("add____$i8,%eax !8");
- asm ("push___%eax");
-
- asm ("mov____%ebp,%eax");
- asm ("add____$i8,%eax !4");
- asm ("movzbl_(%eax),%eax");
- asm ("push___%eax");
-
- _main ();
-
- asm ("mov____%eax,%ebx");
- asm ("mov____$i32,%eax %1");
- asm ("int____$0x80");
- asm ("hlt");
-}
+++ /dev/null
-/* -*-comment-start: "//";comment-end:""-*-
- * GNU Mes --- Maxwell Equations of Software
- * Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
+++ /dev/null
-/* -*-comment-start: "//";comment-end:""-*-
- * GNU Mes --- Maxwell Equations of Software
- * Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
- *
- * 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 <http://www.gnu.org/licenses/>.
- */
DEFINE setge__%al 0f9dc0
DEFINE setge__%dil 400f9dc7
DEFINE setl___%al 0f9cc0
+DEFINE setl___%dil 400f9cc7
DEFINE setle__%al 0f9ec0
DEFINE setle__%dil 400f9ec7
DEFINE setne__%al 0f95c0
(define (.c? o) (or (string-suffix? ".c" o)
(string-suffix? ".M2" o)))
-(define (.E? o) (string-suffix? ".E" o))
+(define (.E? o) (or (string-suffix? ".E" o)
+ (string-suffix? ".mes-E" o)
+ (string-suffix? ".x86-mes-E" o)
+ (string-suffix? ".x86_64-mes-E" o)))
(define (.S? o) (or (string-suffix? ".S" o)
(string-suffix? ".mes-S" o)
+ (string-suffix? ".x86-mes-S" o)
+ (string-suffix? ".x86_64-mes-S" o)
(string-suffix? "S" o)
(string-suffix? ".M1" o)))
(define (.o? o) (or (string-suffix? ".o" o)
(string-suffix? ".mes-o" o)
- (string-suffix? "o" o)
+ (string-suffix? ".x86-mes-o" o)
+ (string-suffix? ".x86_64-mes-o" o)
(string-suffix? ".hex2" o)))