Jan Nieuwenhuizen
10e65b35ce
mescc: Tinycc support: more function stack space.
...
* module/mes/as-i386.mes (function-locals): Increase local space from
64 (16 vars) to 2*1025 + 80 (20 vars).
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
9f60904d1c
mescc: Tinycc support: lseek.
...
* mlibc/include/unistd.h (lseek): Declare.
* stage0/x86.M1 (SYS_lseek): New define.
* mlibc/libc-mes+tcc.c (lseek): New function.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
3e39c56f35
mescc: Tinycc support: unlink.
...
* mlibc/include/unistd.h (unlink): Declare.
* stage0/x86.M1 (SYS_unlink): New define.
* mlibc/libc-mes+tcc.c (unlink): New function.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
2d1623c5f0
mescc: Tinycc support: getcwd.
...
* mlibc/include/unistd.h (getcwd): Declare.
* stage0/x86.M1 (SYS_getcwd): New define.
* mlibc/libc-mes+tcc.c (getcwd): New function.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
ba6edad975
mescc: Tinycc support: close.
...
* stage0/x86.M1 (SYS_close): New define.
* mlibc/include/unistd.h (close): Declare.
* mlibc/libc-mes+tcc.c: New file.
* make.scm: Build and install it.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
accf4159a4
mescc: Tinycc support: multi-byte [local] offsets.
...
* stage0/x86.M1: Add 32bit variants for all 8bit instructions.
* module/mes/as-i386.mes: Use them, switch on size.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
af626da19a
mescc: Naming fix.
...
* stage0/x86.M1 (je8): Rename from jne8.
* module/mes/as-i386.mes (i386:jump-byte-z): Update.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
eff1e97cdf
mescc: Tinycc support: ~, ^=.
...
* module/mes/as-i386.mes (i386:accu-not): New function.
(i386:accu-negate): Rename from i386:accu-not.
* module/mes/as-i386.scm (mes): Export them.
* module/language/c99/compiler.mes (expr->accu): Support ~, ^=.
* scaffold/tests/60-math.c (test): Test it.
* stage0/x86.M1 (not____%eax): New define.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
94b3c828d3
mescc: Refactor decl.
...
* module/mes/as-i386.mes (i386:mem->base, i386:nop): New functions.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes:
* stage0/x86.M1 (nop,mov____(%edx),%edx,movzbl_(%edx),%edx): New defines.
* scaffold/tests/23-pointer.c: New file.
* scaffold/tests/t.c: New file.
* make.scm: Build them.
* module/language/c99/compiler.mes (init-declr->name): Handle array.
(init-declr->pointer): Likewise.
(ident->accu): Simplify.
(ident->base): Simplify.
(ident-address->base): Typo.
(expr->accu): Simplify.
(decl->info): Simplify.
* mlibc/libc-mes.c (getenv): Remove superfluous statement.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
fa4fdad623
build: Remove make.
...
* GNUmakefile: trivial convenience-frontend to ./make.scm
* make/*.make: Remove.
* */*.make: Remove.
2017-07-02 12:03:29 +02:00
Jan Nieuwenhuizen
83a43b81b3
mescc: Produce M1 output instead of hex2.
...
Use: ./make.scm [TARGET]
./make.scm check
* stage0/x86.M1: New file.
* mlibc/mini-libc-mes.c (exit, write): Use M1 instead of .byte.
* mlibc/libc-mes.c (_start, exit, read, write, open, access, brk,
fsync, printf): Use M1 instead of .byte.
* module/mes/as-i386.mes: Use M1.
* module/mes/make.scm: New file.
* make.scm: New file.
* guile/guix/records.scm: New File.
* guile/guix/shell-utils.scm: New file.
* module/mes/M1.mes: Rename from hex2.mes.
* module/mes/M1.scm: Rename from hex2.scm.
* scripts/mescc.mes: Update callers.
* guile/mescc.scm: Update callers.
2017-07-02 16:25:14 +02:00
Jan Nieuwenhuizen
1de0f33020
mescc: Produce object files in hex2 format, remove hex3.
...
* GNUmakefile (HEX2_FLAGS): New variable.
* make/mescc-guile.make ($(OUT)/$(TARGET)): Use HEX2 for linking.
* make/mescc-mes.make ($(OUT)/$(TARGET)): Likewise.
* guile/mescc.scm (main): Remove hex3 support.
* scripts/mescc.mes (main): Likewise.
* stage0/elf32-0header.hex2: New file, merging of elf32.hex and elf32-header.hex2.
* stage0/elf-0footer.hex2: New file.
* stage0/elf32-header.hex2: Rename from elf32-header-exit-42.hex2,
repurpose as generic debug heder.
* stage0/elf32-footer-single-main.hex2: Rename from elf32-footer-exit-42.hex2,
repurpose as generic debug footer for single-main source.
* stage0/exit-42.c: New file.
* stage0/stage0.make ($(OUT)/0exit-42): Test 0header, 0footer.
($(OUT)/exit-42.guile): Test generic debug header, footer.
* stage0/elf32.hex2: Remove.
2017-06-25 09:33:55 +02:00
Jan Nieuwenhuizen
bb0f82d5aa
build: Add stage0 hex2 test.
...
* configure (HEX2): Check for hex2 from MESCC_tools.
* INSTALL: Mention it.
* GNUmakefile (SUBDIRS): Add stage0.
* make/check-cc.make: New file.
* make/check.make: Remove CC-not-empty guard.
* scaffold/scaffold.make: Update CC check targets.
2017-06-23 20:18:09 +02:00
Jan Nieuwenhuizen
afb5c207a9
stage0: Move to-be-generated part of body to footer.
...
* stage0/elf32-footer-exit-42.hex2: Add ELF_str, ELF_sym from body.
* stage0/elf32-body-exit-42.hex2: Remove ELF_str, ELF_sym.
2017-06-21 07:05:26 +02:00
Jan Nieuwenhuizen
cfca4c5cc1
stage0: Leverage label>base in stage0 gdb header.
...
* stage0/elf32-header-exit-42.hex2: Replace calculated addresses with label>base.
* stage0/elf32-body-exit-42.hex2: Likewise.
2017-06-19 22:45:51 +02:00
Jan Nieuwenhuizen
f63d278cec
stage0: Move stage0's section-headers before text.
...
* stage0/elf32-header-exit-42.hex2: Add section-headers.
* stage0/elf32-body-exit-42.hex2: Update.
* stage0/elf32-footer-exit-42.hex2: Remove section-headers.
2017-06-19 09:52:27 +02:00
Jan Nieuwenhuizen
3b82abdfa5
stage0: Add stage0 hex2 gdb header and footer example.
...
* stage0/elf32-header-exit-42.hex2: New file.
* stage0/elf32-footer-exit-42.hex2: New file.
2017-06-18 21:06:27 +02:00
Jan Nieuwenhuizen
5bf3c92938
mescc: Remove jump calculation, use labels: prepare.
...
* module/language/c99/compiler.mes (test-jump-label->info): New
function.
* module/mes/as-i386.mes (i386:jump-label-z,i386:jump-label-byte-z,
i386:jump-label-g, i386:jump-label-ge,i386:jump-label-nz): New
functions.
* module/mes/as-i386.scm: Export them.
2017-06-12 21:00:50 +02:00
Jan Nieuwenhuizen
1263d6e278
mescc: Write object files in hex2 or hex3 format.
...
* stage0/elf32.hex2: New file.
* module/mes/hex2.mes: New file.
* module/mes/hex2.scm: New file.
* module/language/c99/compiler.mes: Eradicate object lamdas.
(current-eval, dec-xhex, function:-object->text, object->elf,
object->objects, merge-objects, alist-add): Remove.
* module/mes/elf.mes (object->elf): New function, move from compiler.mes.
* module/mes/elf.scm: Export it.
* guile/mescc.scm (parse-opts): Add -g.
(main): Use it.
* scripts/mescc.mes: Likewise.
* scripts/mescc-guile.make (MESCC.scm, MESLD.scm): Add -g flag.
* scripts/mescc-mes.make (MESCC.mes, MESLD.mes): Likewise.
* scaffold/m.c: Add proper includes.
* scaffold/argv.c: New file.
* scaffold/hello.c: Simplify.
* scaffold/micro-mes.c: Add proper includes.
* scaffold/t.c: Add proper includes.
2017-06-11 13:11:40 +02:00