Commit graph

1176 commits

Author SHA1 Message Date
Jan Nieuwenhuizen efdae700b5 bootstrap: Unbundle necessary M1 sources.
* mlibc/crt1.M1: Remove.
* mlibc/libc-mes.M1: Remove.
* src/mes.M1: Remove.
2017-11-20 06:47:46 +01:00
Jan Nieuwenhuizen e4bb2e1762 mlibc: Mescc-tools support: fix fgetc.
* mlibc/libc-mes.c (fgetc): Fix from completely fubar.
2017-11-19 16:54:59 +01:00
Jan Nieuwenhuizen 8eae2d81a4 mlibc: Mescc-tools support: strtol: partly implement stub.
* mlibc/libc-mes+tcc.c (strtol): Partly implement stub.
2017-11-19 16:54:13 +01:00
Jan Nieuwenhuizen 0fcdfef284 mlibc: Mescc-tools support: getopt, getopt_long.
* mlibc/getopt.c: Move to ANSI C.  Remove GETOPT_COMPAT and
  non-POSIXLY_CORRECT options.
* mlibc/include/getopt.h: New file.
* mlibc/libc-gcc+tcc.c: Include getopt.c.
* mlibc/libc-mes+tcc.c: Likewise.
2017-11-19 16:48:37 +01:00
Jan Nieuwenhuizen cbd10d1938 mlibc: Mescc-tools support: import getopt_long.
* mlibc/getopt.c: Import from gcc-2.0.
2017-11-19 14:09:21 +01:00
Jan Nieuwenhuizen 302282dcdb Revert "mescc: Grok char foo[] parameter."
This reverts commit c4cc75105db48b550cd515751b766b2e7a88ddc3.
2017-11-19 20:50:06 +01:00
Jan Nieuwenhuizen cb90e51068 mescc: Grok char foo[] parameter.
* module/language/c99/compiler.mes (function->text+data): Grok char
  foo[] parameter.
2017-11-19 19:59:18 +01:00
Jan Nieuwenhuizen e77e56c5b0 mescc: Grok char *const foo[];
* module/language/c99/compiler.mes (ast-strip-const): Grok char *const argv[];
2017-11-19 16:46:43 +01:00
Jan Nieuwenhuizen 2555427610 mlibc: Mescc-tools support: endianness.
* mlibc/include/endian.h: New file.
* mlibc/include/ctype.h[!(__GNUC__ && POSIX)]: Include it.
* mlibc/include/stdlib.h: Likewise.
* mlibc/include/sys/types.h: Likewise.
2017-11-19 14:06:32 +01:00
Jan Nieuwenhuizen 7f1aaa9914 mlibc: Mescc-tools support: exit stati.
* mlibc/include/stdlib.h (EXIT_FAILURE, EXIT_SUCCESS): New define.
2017-11-19 14:05:33 +01:00
Jan Nieuwenhuizen 66a78f68cb mescc: cleanup obsolete Nyacc 0.7x compatibility.
* module/language/c99/compiler.mes (ast-type->type, ast->type
  expr->accu, struct-field, decl->info,): Remove obsolete Nyacc 0.7x
  patterns.
2017-11-18 21:05:43 +01:00
Jan Nieuwenhuizen f17f4db60a guix: Release update.
* guix.scm (mes): Update commit, hash and version.  Add
  'make-git-source-writable stage.
2017-11-18 16:28:25 +01:00
Jan Nieuwenhuizen 2965649786 Release 0.11.
* configure (VERSION): Bump to 0.11.
2017-11-18 13:14:20 +01:00
Jan Nieuwenhuizen 48e8711c38 doc: Release udpate.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.11: New file.
2017-11-11 13:09:26 +01:00
Jan Nieuwenhuizen d111d64e50 build: fix for 07-include, thanks rain1!
* make.scm (add-scaffold-test): New keyword parameter: includes.
  ("07-include"): Use it.
2017-11-18 15:02:21 +01:00
Jan Nieuwenhuizen 9602e14c61 build: support gcc -m32, thanks rain1!
* guile/guix/make.scm (%CC32): fallback to %CC.
  (%C32-FLAGS): Add -m32, to suppor gcc -m32.
  (LINK.gcc): Use it.
2017-11-18 14:50:56 +01:00
Jan Nieuwenhuizen 35b1be535a bootstrap: Update necessary M1 sources.
M1 -f stage0/x86.M1 -f mlibc/crt1.M1 --LittleEndian --Architecture=1 > mlibc/crt1.hex2
   M1 -f stage0/x86.M1 -f mlibc/mini-libc-mes.M1 --LittleEndian --Architecture=1  > mlibc/libc-mes.hex2
   M1 -f stage0/x86.M1 -f src/mes.M1 --LittleEndian --Architecture=1 > src/mes.hex2
   hex2 --LittleEndian --Architecture=1 --BaseAddress=0x1000000 -f stage0/elf32-header.hex2 -f mlibc/crt1.hex2 -f mlibc/libc-mes.hex2 -f src/mes.hex2 -f stage0/elf32-footer-single-main.hex2 > src/mes-mes
   exec_enable src/mes-mes

* mlibc/libc-mes.M1: Update.
* src/mes.M1: Udate.
2017-11-18 12:14:07 +01:00
Jan Nieuwenhuizen ada6ac99dd mescc: Tinycc support: test #include.
* scaffold/tests/exit-42.i: New file.
* scaffold/tests/07-include.c: New file.
* make.scm ("07-include"): Build it.
2017-11-18 11:55:47 +01:00
Jan Nieuwenhuizen 02e70486a1 mescc: Tinycc support: struct struct array.
Support

  struct foo
  {
    struct bar baz[N];
    struct bar bla*[M];
  };

* module/language/c99/compiler.mes (expr->accu):
* scaffold/tests/7n-struct-struct-array.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-11-17 15:24:45 +01:00
Jan Nieuwenhuizen 26e9dd14e3 mlibc: Tinycc support: support, most syscalls stubbed.
* mlibc/libc-gcc.c (exit, write)[__TINYC__]: tcc-compatible gcc-style
  asm implementation.
  (read,open,access,brk,fsync)[__TINYC__]: Stub body.
* mlibc/libc-gcc+tcc.c (close,unlink, lseek, getcwd)[__TINYC__]: Stub
  body.
* mlibc/libc-mes+tcc.c: Support tinycc.
* mlibc/include/00-test.i (main) [__TINYC__]: Support tcc.
2017-11-16 22:11:07 +01:00
Jan Nieuwenhuizen 67afa2a397 mescc: Tinycc support: empty for.
* module/language/c99/compiler.mes (test-jump-label->info): Handle
  empty expression.
* make.scm (add-tcc-test "45_empty_for"): Test it.
2017-11-16 05:52:47 +01:00
Jan Nieuwenhuizen d393fd3743 tinycc: scaffold/main.c: running mes-tcc compiled binary #6.
* scaffold/main.c (main): Use variable, if, argc, ++, +=, function call to return 42.
2017-11-16 05:33:11 +01:00
Jan Nieuwenhuizen cf107cb2b2 tinycc: scaffold/main.c: running mes-tcc compiled binary #5.
* scaffold/main.c (main): Use function call and variable to return 42.
2017-11-15 23:06:23 +01:00
Jan Nieuwenhuizen a2bc80fe7b tinycc: scaffold/main.c: running mes-tcc compiled binary #4.
* scaffold/main.c (main): Use variables to return 42.
2017-11-14 19:42:08 +01:00
Jan Nieuwenhuizen b24fcbad60 mescc: Tinycc support: workaround lack of long long support.
* module/language/c99/compiler.mes (i386:type-alist): Use size=4 for
  long long as a workaround.
2017-11-14 19:39:46 +01:00
Jan Nieuwenhuizen dc65de59ce mescc: refactor expr->accu, expr->accu*, fixes nontrivial struct by value assign.
* module/language/c99/compiler.mes: (pke): New function.
  (expr->number): Rename from p-expr->number.  Update callers.
  (decl->info, init-declr->pointer, struct-field): Several pointeryness fixes.
  (expr->accu*, expr->accu): Remove special-casing for foo.bar,
  foo->bar, foo[bar].  Fixes struct by value assign for non-trival
  expressions.
  (accu->ident, ident-address->accu, ident->accu):
  (base->ident-address, ident->base): Remove.
* scaffold/tests/7k-for-each-elem.c (test): Test it.
* scaffold/tests/7c-dynarray.c (test): Test it.
* scaffold/tests/7m-struct-char-array-assign.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-11-11 13:45:53 +01:00
Jan Nieuwenhuizen 6a16258f78 mlibc: errno.h: declare errno without extern.
* mlibc/include/errno.h: drop extern.  Fixes tcc compile.
2017-11-11 13:42:42 +01:00
Jan Nieuwenhuizen 5100b3c039 guix: nyacc: Update to 0.82.4.
* guix.scm (nyacc): Update to 0.82.4.
2017-11-11 13:20:25 +01:00
Jan Nieuwenhuizen a5fd0ff343 guix: Release update.
* guix.scm (mes): Update commit, hash and version.
2017-09-10 22:10:16 +02:00
Jan Nieuwenhuizen ef69b7a28a Release 0.10.
* configure (VERSION): Bump to 0.10.
2017-09-10 22:00:13 +02:00
Jan Nieuwenhuizen 5c7ba63729 doc: Release udpate.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* doc/ANNOUNCE-0.10: New file.
* BOOTSTRAP: New file.
* make.scm: Install them.
2017-09-10 21:53:59 +02:00
Jan Nieuwenhuizen 6c55f4bd28 bootstrap: Include necessary M1 sources.
M1 -f stage0/x86.M1 -f mlibc/crt1.M1 --LittleEndian --Architecture=1 > mlibc/crt1.hex2
   M1 -f stage0/x86.M1 -f mlibc/mini-libc-mes.M1 --LittleEndian --Architecture=1  > mlibc/libc-mes.hex2
   M1 -f stage0/x86.M1 -f src/mes.M1 --LittleEndian --Architecture=1 > src/mes.hex2
   hex2 --LittleEndian --Architecture=1 --BaseAddress=0x1000000 -f stage0/elf32-header.hex2 -f mlibc/crt1.hex2 -f mlibc/libc-mes.hex2 -f src/mes.hex2 -f stage0/elf32-footer-single-main.hex2 > src/mes-mes
   exec_enable src/mes-mes

* mlibc/crt1.M1: New File.
* mlibc/libc-mes.M1: New File.
* src/mes.M1: New File.
2017-09-10 21:17:17 +02:00
Jan Nieuwenhuizen 81ddc698bb guix: Bump Nyacc to 0.82.0.
* guix.scm (nyacc): Bump to 0.82.0.
2017-09-10 21:10:08 +02:00
Jan Nieuwenhuizen 66204d56c0 mescc: Support Nyacc-0.81.0.
* module/language/c99/compiler.mes (ast->info): Handle asm-expr from
  Nyacc 0.81.0.
2017-09-10 21:09:23 +02:00
Jan Nieuwenhuizen 7e6408534f tinycc: scaffold/main.c: running tcc-compiled binary #3.
* scaffold/main.c (main): Remove asm.
2017-09-03 10:43:02 +02:00
Jan Nieuwenhuizen 9555d90174 mescc: Tinycc support: struct by value assign.
* module/language/c99/compiler.mes (expr->accu): warn for unsupported
  sizes.
* scaffold/tests/7h-struct-assign.c (test): Test it.
2017-09-10 16:59:53 +02:00
Jan Nieuwenhuizen 2896ce46c4 tinycc: scaffold/main.c: running tcc-compiled binary #2.
* scaffold/main.c (main)[__i386__]: Rename from _start.
2017-09-03 00:37:39 +02:00
Jan Nieuwenhuizen 7619190d5c build: compile crt1.c, libc-mesc.c and <input>.c separately.
* mlibc/crt1.c: New file.
* mlibc/libc-mes.c (_start): Remove.
* mlibc/libc-gcc.c (_start): Remove.
* make.scm (LINK.hex2, bin.mescc): Move from guile/guix/make.scm.
* guile/guix/make.scm (LINK.hex2, bin.mescc): Remove.
2017-09-10 16:59:43 +02:00
Jan Nieuwenhuizen 29acdfa2a7 mescc: Tinycc support: refactor _start.
* mlibc/libc-mes.c (_start): Refactor.
  (_env): Remove.
* stage0/x86.M1:
2017-09-03 08:18:18 +02:00
Jan Nieuwenhuizen 9aa8d8bd9d tinycc: scaffold/main.c: first running tcc-compiled binary.
* scaffold/main.c (_start): Exit 42 using asm.
2017-08-19 11:35:58 +02:00
Jan Nieuwenhuizen 3560ee6c95 mescc: Tinycc support: fix *--p = 'x'.
* module/language/c99/compiler.mes (expr->accu): Respect size in *--p = 'x'.
* scaffold/tests/23-pointer.c (test): Test it.
2017-08-27 16:58:56 +02:00
Jan Nieuwenhuizen 19ea4fa268 mescc: Tinycc support: initializer arithmetic.
* module/language/c99/compiler.mes (p-expr->bool): New function
  (p-expr->number): Support bitwise-and, bitwise-not, cast, cond-expr.
2017-08-27 12:57:50 +02:00
Jan Nieuwenhuizen 4175579d08 core: Add logand, lognot.
* src/math.c (logand, lognot): New function.
2017-08-27 12:53:01 +02:00
Jan Nieuwenhuizen 989bfdbd25 mescc: Tinycc support: array of struct of any size.
* module/language/c99/compiler.mes (accu*value): New function
  (expr->accu*): Use it to support array of struct of any size.
* scaffold/tests/7l-struct-any-size-array.c: Test it.
* make.scm (add-scaffold-test): Build it.
2017-08-27 11:23:45 +02:00
Jan Nieuwenhuizen 21e9bf833c mescc: Tinycc support: stdint.h: declare size_t.
* mlibc/include/stdint.h (size_t)[!__MES_SIZE_T]: Declare.
2017-08-27 11:29:07 +02:00
Jan Nieuwenhuizen 69073e1954 mescc: Tinycc support: pointer arithmetic with pointer-variable.
* module/language/c99/compiler.mes (expr->accu): pointer arithmetic with pointer-variable.
* scaffold/tests/76-pointer-arithmetic.c (test): Test it.
* mlibc/include/stdarg.h (va_start): Update for fixed pointer arithmetic.
2017-08-26 10:16:53 +02:00
Jan Nieuwenhuizen 8649f7a923 mescc: Tinycc support: pointer arithmetic with &variable.
* module/language/c99/compiler.mes (expr->pointer): Handle ref.
* scaffold/tests/76-pointer-arithmetic.c: Test it.
2017-08-25 06:58:15 +02:00
Jan Nieuwenhuizen 0875ce655a mescc: Tinycc support: pointer arithmetic with variable.
* module/language/c99/compiler.mes (expr->accu): Support pointer
  arithmetic with variable: p + i, p - i, p += i, p -= i.
* scaffold/tests/76-pointer-arithmetic.c (test): Test it.
2017-08-23 07:08:16 +02:00
Jan Nieuwenhuizen 1e23dbaf17 mescc: Tinycc support: handle pointerness, siziness for cast foo*.
* module/language/c99/compiler.mes (expr->pointer): Support cast foo*.
  (expr->size): Likewise.
* scaffold/tests/7k-for-each-elem.c: Test it
* make.scm (add-scaffold-test): Build it.
2017-08-23 06:55:25 +02:00
Jan Nieuwenhuizen 93714ad0a4 mescc: Tinycc support: strtoull.
* mlibc/include/mlibc.h (_atoi): Declare.
* mlibc/include/ctype.h (isxdigit): Declare.
* mlibc/libc-gcc.c (isxdigit, _atoi): New function.
  (atoi): Use it.
* mlibc/libc-mes.c (isxdigit, _atoi): New function.
  (atoi): Use it.
* scaffold/tests/7j-strtoull.c (test): Test it.
* make.scm (add-scaffold-test): Build it.
2017-08-19 10:51:24 +02:00