Commit Graph

32 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen 82c85c24da
build: Support mescc-tools 0.5.2.
* configure: Remove version check for mescc-tools.
Check for stage0 architecture flag type.
* configure.sh: Likewise.
* build-aux/build-scaffold.sh: Add stage0 flag type indirection.
* module/mescc/mescc.scm (arch-get-architecture): Likewise.
2019-12-07 14:39:19 +01:00
Jan Nieuwenhuizen 778fbd4f48
mescc: Fix for compiling handwritten .S assembly.
* module/mescc/mescc.scm (mescc:compile): Handle .S.
(mescc:link): Likewise.
2019-12-06 21:17:13 +01:00
Jan Nieuwenhuizen 2c2f03c9e4
mescc: Honor --includedir, --libdir.
* guix/git/mes.scm (mes):
* module/mescc.scm (%includedir, %libdir): New variable.
(mescc:main): Add them to options.
* module/mescc/mescc.scm (mescc:preprocess, c->info): Add %includedir.
(arch-find): Use %libdir instead of
prefix-file.
(prefix-file): Remove.
* scripts/mescc.scm.in (%includedir, %libdir): Initialize from and set
in environment.

xx

* module/mescc/mescc.scm :
2019-11-24 11:14:14 +01:00
Jan Nieuwenhuizen c03807b78f
mescc: Be silent.
* module/mescc/M1.scm (infos->M1, info->M1): Add verbose?.  Move
debugging into verbose? > 1.
* module/mescc/compile.scm (c99-input->info, c99-ast->info): Likewise.
(mescc:trace-verbose): Rename from mescc:trace.
(mescc:trace): New function.
* module/mescc.scm (mescc:main): Likewise.
* module/mescc/mescc.scm (mescc:preprocess, c->ast mescc:compile,
c->info, E->info): Likewise.
* module/mescc/preprocess.scm (c99-input->full-ast, c99-input->ast):
Likewise.
2019-07-27 09:51:21 +02:00
Jan Nieuwenhuizen af1cc3ce81
mescc: Add <include>/<kernel>/<arch> to include path.
* module/mescc/preprocess.scm (c99-input->full-ast): Add
<include>/<kernel>/<arch> to include path.
* module/mescc/compile.scm (c99-input->info): Pass arch.
* module/mescc/mescc.scm (mescc:preprocess): Likewise.
(c->info): Likewise.
(c->ast): Likewise.
2019-07-26 22:44:04 +02:00
Jan Nieuwenhuizen d5a0ecb3d5
mescc: Resurrect --write.
* module/mescc/mescc.scm (mescc:preprocess): Pass pretty-print/write
to c->ast.
2019-07-26 18:57:45 +02:00
Jan Nieuwenhuizen 6541ec8c09
mescc: Use basename of input as default output name.
* module/mescc/mescc.scm (mescc:preprocess, mescc:compile,
mescc:assemble, M1->hex2): Use basename of input as default output name.
2019-07-08 19:42:31 +02:00
Jan Nieuwenhuizen fbe0b2eef8
porting: Add x86 scaffold: exit and write in assembly.
* lib/x86-mes-gcc/exit-42.S: New file.
* lib/x86-mes-gcc/hello-mes.S: New file.
* lib/x86-mes/elf32-0exit-42.hex2: New file.
* lib/x86-mes/elf32-0hello-mes.hex2: New file.
* lib/x86-mes/elf32-body-hello-mes.hex2: New file.
* lib/x86-mes/elf32-body-exit-42.hex2: Rewrite.
* lib/x86-mes/elf32-header.hex2: Fix copyright header.
* lib/x86-mes/elf32-0header.hex2: Likewise.
* lib/x86-mes/elf-0footer.hex2: Remove.
* build-aux/build-scaffold.sh: Build them.
* .dir-locals.el (asm-mode): Allow TABs.
* .gitignore: Reserve .S assembly sources, i.e. manual written
assembly.  Update build system.
* module/mescc/mescc.scm: Update.
* build-aux/build-lib.sh: Update.
* scripts/ar.in: Update.
2019-06-13 14:19:59 +02:00
Jan Nieuwenhuizen 78b3c85f15
build: Cater for ARM.
* configure: Cater for ARM.
* configure.sh: Likewise
* build-aux/GNUmakefile.in: Likewise.
* build-aux/bootstrap.sh.in: Likewise.
* module/mescc.scm (parse-opts): Likewise.
* src/mes.c (mes_environment): Likewise.
* build-aux/build.sh.in: Likewise.
* build-aux/config.sh Likewise.
* build-aux/install.sh.in: Likewise.
* module/mes/guile.scm: Likewise.
* scripts/mescc.scm.in: Likewise.
* module/mescc/mescc.scm (arch-get): New function.
(arch-get-info): New function.
(arch-get-define): New function.
(arch-get-m1-options): New function.
(arch-get-Architecture): New function.
(mescc:preprocess c->info, E->info, M1->hex2, hex2->elf,
M1->blood-elf, arch-find): Use them.
2019-05-22 17:55:20 +02:00
Jan Nieuwenhuizen 5dc245e739
build: Simplify.
core: Make mes src/ c files separate compilation units.

* include/mes/constants.h: New file.
* include/mes/macros.h: New file.
* include/mes/mes.h: New file.
* src/gc.c: Update.
* src/hash.c: Update.
* src/lib.c: Update.
* src/math.c: Update.
* src/mes.c: Update.
* src/module.c: Update.
* src/posix.c: Update.
* src/reader.c: Update.
* src/string.c: Update.
* src/struct.c: Update.
* src/vector.c: Update.

    mes: Update datadir.

* src/mes.c (g_datadir): New global.
(open_boot): Rename from read_boot.
(read_boot): New function.
* mes/module/mes/boot-0.scm: Move from boot-0.scm.in
* configure: Update.
* configure.sh: Update.

    mescc: Create libraries from separate files.

* .gitignore: Update.
* build-aux/bootstrap-mes.sh: Remove.
* build-aux/bootstrap.sh.in: Remove.
* build-aux/build-guile.sh: Update.
* build-aux/build-mes.sh: Update.
* build-aux/build-scaffold.sh: New file.
* build-aux/build.sh.in: Update.
* build-aux/cc.sh: Update.
* build-aux/check-tcc.sh: Remove.
* build-aux/config.sh.in: New file.
* build-aux/config.sh: Remove.
* build-aux/install.sh.in: Update.
* build-aux/test-boot.sh: New file.
* build-aux/test-c.sh: New file.
* build-aux/test-driver: New file.
* build-aux/test-suite.sh: New file.
* build-aux/trace.sh: Update.
* build-aux/uninstall.sh.in: Update.
* configure: Update.
* configure.sh: Update.
* lib/linux/x86-mes-mescc/crt1.c: Move from lib/linux/x86-mes.
* lib/linux/x86-mes-mescc/mini.c: Likewise.
* lib/linux/x86_64-mes-mescc/crt1.c: Move from lib/linux/x86_64-mes.
* lib/linux/x86_64-mes-mescc/mini.c: Likewise.
* lib/linux/x86-mes-gcc/syscall.c: Rename from mes.c.
* lib/linux/x86-mes-mescc/syscall.c: Likewise.
* lib/linux/x86_64-mes-gcc/syscall.c: Likewise.
* lib/linux/x86_64-mes-mescc/syscall.c: Likewise.
* lib/mes/mes_open.c: Include config.h.
* lib/tests/stdio/70-printf-hello.c: Likewise.
* lib/tests/stdio/70-printf-simple.c: Likewise.
* scaffold/gc-test.sh: New file.
* simple.sh: Update.
2019-06-08 15:36:22 +02:00
Jan Nieuwenhuizen 50f3f9ffdc
mescc: Use a.out as default executable name.
* module/mescc/mescc.scm (hex2->elf): Use a.out as default executable
name.
2019-05-29 16:49:22 +02:00
Jan Nieuwenhuizen 77e75c3142
mes: Bugfix for search-path. Fixes running MesCC on Guile.
* module/mescc/mescc.scm (arch-find): Also look in cwd.
* mes/module/mes/posix.mes (search-path): Do not look in cwd.
2019-05-27 21:51:37 +02:00
Jan Nieuwenhuizen 0ef174897f
mescc: Use named --architecture switch for upcoming mescc-tools 0.6.
* module/mescc/mescc.scm (M1->hex2): Use named --architecture switch for
upcoming mescc-tools 0.6.
(hex2->elf): Likewise.
* build-aux/bootstrap-mes.sh: Likewise.
* build-aux/bootstrap.sh.in: Likewise.
* build-aux/config.sh: Likewise.
2019-05-25 16:01:39 +02:00
Jan Nieuwenhuizen fb13083d08
mescc: Support -nodefaultlibs, -nostartfiles, -nostdlib.
* module/mescc.scm (parse-opts): Parse -nodefaultlibs, -nostartfiles, -nostdlib.
* module/mescc/mescc.scm (mescc:link): Handle -nodefaultlibs, -nostdlib.
(hex2->elf): Handle -nostartfiles, -nostdlib.
2019-05-05 20:25:22 +02:00
Jan Nieuwenhuizen cd70c63a40
mescc: Exit if library cannot be found.
* module/mescc/mescc.scm (arch-find): Exit upon failure.
2018-11-08 14:46:46 +01:00
Peter De Wachter 053309e4dc
mescc: Exit with non-zero exit code when subprocess fails.
system* returns the result of waitpid. So, suppose that a subprocess
fails with exit code 1. Then the waitpid return value will be 256.
And exit(256) is equivalent to exit(0).

Modified-by: Jan Nieuwenhuizen <janneke@gnu.org>

* mes/module/mes/posix.mes (status:exit-val): New function.
* module/mescc/mescc.scm (assert-system*): Use it.
2018-10-16 20:40:35 +02:00
Jan Nieuwenhuizen d862f1eceb
mescc: Support --align, off by default.
* scripts/mescc.in (parse-opts): Add --align.
* module/mescc/mescc.scm (mescc:compile): Support --align, off by
default.
* module/mescc/M1.scm (infos->M1): Add #:align parameter.
(M1:merge-infos): Likewise.  Keep types.
(info->M1): Likewise.  Make alignment switchable.
* module/mescc/compile.scm (r->ident):  Do not clobber.
(ident-add): Likewise.
(clean-info): Keep types.
* module/mescc/i386/as.scm (i386:r->byte-label): New instruction.
* lib/x86-mes/x86.M1: Add instructions.
* lib/x86_64-mes/x86_64.M1: Add instructions.
* module/mescc/x86_64/as.scm (x86_64:r->byte-label,
x86_64:r->word-label, x86_64:r->long-label): New instruction.
2018-10-06 15:56:14 +02:00
Jan Nieuwenhuizen 5484e0ffdf
build: Resurrect make seed.
* build-aux/GNUmakefile.in (seed): Resurrect.
* build-aux/build-x86_64-mes.sh: Build from seed.
2018-09-30 12:15:11 +02:00
Jan Nieuwenhuizen 3e1a197ed1
mescc: Initial x86_64 support.
make all-go && MES=guile ./pre-inst-env scripts/mescc -m64 -c scaffold/main.c
2018-08-14 20:32:56 +02:00
Jan Nieuwenhuizen ee9081f3ec
mescc: Prepare for x86_64 support.
* module/mescc/info.scm (info): Add allocated, registers.
* module/mescc/i386/info.scm: New file.
* build-aux/build-guile.sh (SCM_FILES): Add it.
* module/mescc/compile.scm (c99-input->info): Add info parameter.
(c99-ast->info): Likewise.
(i386:type-alist): Remove.
(alloc-register, free-register): New function.
(expr->register*): Rename from expr->accu*.  Update callers.
(expr->accu): Rename from expr->accu.  Update callers.
* module/mescc/mescc.scm(%info): New variable.
* module/mescc/mescc.scm (c->ast): Use it.
(mescc:compile): Likewise.
(E->info): Likewise.
2018-08-14 12:35:24 +02:00
Jan Nieuwenhuizen fe60c924dd
mescc: Add dir to include path.
* module/mescc/mescc.scm (preprocess): Add dir to include path.
(c->info): Likewise.
* scaffold/tests/08-assign.c: New file.
2018-08-15 19:11:54 +02:00
Jan Nieuwenhuizen 25c4acef82
mescc: Support -l none (linking without libc).
* module/mescc/mescc.scm (mescc:link): Support -l none.
2018-08-15 17:46:03 +02:00
Jan Nieuwenhuizen 7318e9079e
mescc: Support -o-.
* module/mescc/mescc.scm (GUILE-with-output-to-file): New variable.
(with-output-to-file): Use it in redefined function.
2018-08-14 10:58:02 +02:00
Jan Nieuwenhuizen f18e1fea36
build: Make build more autotools-like.
* build-aux/build.sh.in: Move from ./build.sh
* build-aux/check.sh.in: Likewise.
* build-aux/GNUmakefile.in: Likewise.
* build-aux/install.sh.in: Likewise.
* build-aux/uninstall.sh.in: Likewise.
* configure: Substitute them.
* configure.sh: Likewise.
* build-aux/build-cc.sh: Update: use ${srcdest} instead of ${top_builddest}.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/cc32-mes.sh: Likewise.
* build-aux/check-boot.sh: Likewise.
* build-aux/check-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/config.sh: Likewise.
* build-aux/export.make: Likewise.
* build-aux/mes-snarf.scm: Likewise.
* build-aux/pre-inst-env.in: Likewise.
* build-aux/test.sh: Likewise.
* build-aux/trace.sh: Likewise.
* module/mescc/mescc.scm: Likewise.
* scripts/mescc.in: Likewise.
* src/mes.c: Likewise.
* .gitignore: Likewise.
2018-07-25 08:14:13 +02:00
Jan Nieuwenhuizen 72cb975213
GNU Mes.
Throughout, make these changes

   Copyright headers: GNU Mes
   First mention of name: GNU Mes
   Website: https://www.gnu.org/software/mes
   Git:     git://git.savannah.gnu.org/mes.git
2018-07-22 14:24:36 +02:00
Jan Nieuwenhuizen 53c0941937
guix: Refactor package setup.
Next to the convenient environment setup and package build from git

   guix environment -l .guix.scm
   guix build -f .guix.scm

we can now also build other included packages

    GUIX_PACKAGE_PATH=guix guix build mes@0.17
    GUIX_PACKAGE_PATH=guix guix build nyacc@0.80.42

* guix/git/mes.scm: Move from .guix.scm, make a module.
* .guix.scm: Move from guix.scm, use it.
* build-aux/manifest.scm: Update location.
* build-aux/pre-inst-env.in: Support it.
* configure: Check for guix.
* build-aux/export.make: Export GUIX.
* GNUmakefile (update-hash): New target.
2018-07-22 08:41:48 +02:00
Jan Nieuwenhuizen 4203a427d0
build: Support --srcdir build.
* build-aux/config.sh: New file.
* build-aux/trace.sh: New file.
* build-aux/GNUmakefile.in: New file.
* configure: Support srcdir configure.
* GNUmakefile: Support srcdir build.
* build-aux/build-cc.sh: Likewise.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/cc32-mes.sh: Likewise.
* build-aux/check-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/export.make: Likewise.
* build-aux/mes-snarf.scm: Likewise.
* build-aux/pre-inst-env.in: Likewise.
* build-aux/test.sh: Likewise.
* build.sh: Likewise.
* check.sh: Likewise.
* install.sh: Likewise.
* module/mescc/mescc.scm: Likewise.
* scripts/mescc.in: Likewise.
* src/mes.c: Likewise.
2018-07-22 00:43:39 +02:00
Jan Nieuwenhuizen 69813a6da3
build: Support Debian build, install.
* scripts/mescc: Support Debian build, install.
* lib/libmes.c (fdgetc): Allow Nyacc/ungetc conflict.
* build-aux/export.make (ARCH): Export.
* build-aux/build-mes.sh: Disable full build for non-bootstrap
  x86-only.
* check.sh (total): Use bash to invoke build-aux/check-mescc.sh.
* build-aux/build-guile.sh (SCM_FILES): Support guile-2.0.
* module/mes/guile.scm (guile-2.0): Support guile-2.0.
* build-aux/build-mes.sh: Use bash.
* build-aux/setup-mes.sh: New file.
2018-07-12 22:29:59 +02:00
Jan Nieuwenhuizen a25653e7f1
mescc: Be sure to exit upon system* failure.
* module/mescc/mescc.scm (assert-system*): New function.
  (M1->hex2, hex2->elf, M1->blood-elf): Use it.
2018-07-12 22:29:59 +02:00
Jan Nieuwenhuizen a27770389e
Update for mescc-tools-0.5.
* build-aux/build-mes.sh (HEX2FLAGS): Remove = from flags.
* build.sh (HEX2FLAGS): Likewise.
* module/mescc/mescc.scm (hex2->elf): Likewise.
2018-06-16 06:38:05 +02:00
Jan Nieuwenhuizen 272b522962
build: Use arch-dir.
* lib/x86-mes: Move from stage0.
* build-aux/build-cc.sh: Create libraries in lib/gcc.  Update users.
* build-aux/build-mes.sh: Create libraries in lib/x86-mes.  Update users.
* build-aux/build-mes-gcc.sh: Rename from build-mlibc.sh.  Create
  libraries in lib/x86-mes-gcc.  Update callers.
* build-aux/cc-mes-gcc.sh: Rename from cc-mlibc.sh.  Update callers.
2018-05-29 20:07:46 +02:00
Jan Nieuwenhuizen a10c48735d
mescc: Posixify interface.
* module/mescc/compile.mes: Move from language/c99/compiler.mes.
* module/mescc: New module..
* module/mescc/M1.scm: Move from mes/M1.mes.
* module/mescc/as.scm: Likewise.
* module/mescc/bytevectors.scm: Likewise.
* module/mescc/mescc.scm: New file.
* scripts/mescc: Update to new layout and posixy interface.
* GNUmakefile: Likewise.
* build-aux/build-cc.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/build-mlibc.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc-mlibc.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/test.sh: Likewise.
* build.sh: Likewise.
* .gitignore: Update for posixy extensions.
2018-05-25 08:05:02 +02:00