Commit Graph

1354 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen 16f4adfbc2
core: Fix compile warnings.
* lib/libmes.c: Fix warning.
* src/posix.c (execl_): Fix warning, add debug printing.
2018-06-26 06:19:51 +02:00
Jan Nieuwenhuizen 7be16f51b3
core: execl_: Allow 1000 arguments.
* src/posix.c (execl_): Allow 1000 arguments.
2018-06-26 06:05:20 +02:00
Jan Nieuwenhuizen 50d7036e03
mescc: Support binutils 2.10.1: strrchr: Stop at start of string.
* lib/libc+tcc.c (strrchr): Stop at start of string.
* scaffold/tests/88-strrchr.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-06-24 17:25:46 +02:00
Jan Nieuwenhuizen 350d94aa77
build: Support tcc, create tinycc-seed with tcc.
* configure: check for tcc.
* build-aux/cc32-mes.sh: Rename from cc-mes-gcc.sh.  Support
  tcc.  Update users.
* build-aux/build-cc32-mes.sh: Rename from build-mes-gcc.sh.  Update users.
* GNUmakefile (mes-tcc): New target.
* .gitignore: Ignore mes-tcc arch output.
* lib/crt1.c (_start): Add "rm" constraint so satisfy tcc.
* lib/linux-gcc.c (_sys_call, _sys_call1 _sys_call2 _sys_call3): Likewise.
2018-06-24 09:28:23 +02:00
Jan Nieuwenhuizen c2ff5ec954
mescc: Support glibc-2.2.5: header tweaks.
* include/sys/types.h [__PTRDIFF_T]: Extra guard for ptrdiff_t.
  [__SIZE_T]: Extra guard for size_t.
* include/stdlib.h: Include alloca; remove alloca prototype,
* include/errno.h: Add E2BIG.
2018-06-21 00:27:27 +02:00
Jan Nieuwenhuizen 41a6585295
mescc: Support binutils 2.20.1: vfprint, vsprintf: %llx.
* lib/libc+tcc.c (vfprintf, vsprintf): Handle %%llx.  Print error:
  should we skip another int, va_arg a long long?
2018-06-24 17:26:53 +02:00
Jan Nieuwenhuizen 2551eef953
mescc: Support binutils 2.14: vfprint, vsprintf: %12.10d.
* lib/libc+tcc.c (vfprintf, vsprintf): Handle %12.10d.
* scaffold/tests/70-printf.c: Test it.
2018-06-21 00:27:49 +02:00
Jan Nieuwenhuizen f245237f83
mescc: Support gnu toolchain: libtcc1.
* lib/libtcc1.c: New file.
* lib/libc+tcc-gcc.c: Remove libtcc1 stubs.
2018-06-19 20:29:25 +02:00
Jan Nieuwenhuizen 98a8f3f23e
mescc: Support binutils-2.20.1a: header tweaks.
* include/signal.h: Include sys/types.h; remove type declaration copies.
* include/stdarg.h: Likewise.
* include/stdio.h: Likewise.
* include/stdlib.h: Likewise.
* include/unistd.h: Likewise.
2018-06-19 20:23:38 +02:00
Jan Nieuwenhuizen 63bf9bb2f7
mescc: Support Tinycc 0.9.27: Drop dlclose, dlopen.
* lib/libc+tcc.c (dlclose, dlopen): Remove.
* include/dlfcn.h (RTLD_DEFAULT): Add.
2018-06-18 22:56:06 +02:00
Jan Nieuwenhuizen a1334148ca
core: Resurrect dump-tiny.
* src/reader.c (dump): Resurrect dump-tiny.
2018-06-18 22:55:23 +02:00
Jan Nieuwenhuizen 8793e0dde3
core: Resurrect loading of boot-0.32-mo. 2018-06-18 18:55:59 +02:00
Jan Nieuwenhuizen 22a22c1de8
mescc: Support binutils 2.25: fseek: Add debug printing.
* lib/libc+tcc.c (fseek): Add debug printing.
2018-06-17 14:17:39 +02:00
Jan Nieuwenhuizen 2062826435
mescc: Tinycc support: bcopy: Do not return void.
* lib/m4.c (bcopy): Do not return void.  Helps tcc.
2018-06-17 14:16:05 +02:00
Jan Nieuwenhuizen c6ae0f41a3
mescc: Support binutils 2.25: memcmp: Support size 0.
* lib/libc+tcc.c (memcmp): Support size 0.
2018-06-17 10:18:59 +02:00
Jan Nieuwenhuizen 0639e3faf1
mescc: Support binutils 2.25: vsscanf: Skip `l'.
* lib/libc+tcc.c (vsscanf): Skip `l'.
2018-06-17 09:26:34 +02:00
Jan Nieuwenhuizen 49bcea84fd
mescc: Debugging oops.
* lib/libc.c (__mes_debug): Oops, wrong direction.
2018-06-17 08:39:31 +02:00
Jan Nieuwenhuizen a9215931e8
mescc: Support binutils 2.15a: fread: read ungetc'd chars too.
* lib/libmes.c (_ungetc_fd): New variable.
  (fdgetc): Use it.
  (_fdungetc_p): New function.
* lib/libc+tcc.c (_fungetc_p): New function.
* lib/libc+tcc.c (fread): Use it to read ungetc'd chars too.
2018-06-16 20:51:16 +02:00
Jan Nieuwenhuizen 7a42e5e6b0
mescc: Add another fopen test.
* scaffold/tests/98-fopen.c: New file.
* build-aux/check-mescc.sh (tests): Add it.
* AUTHORS: Mention it.
2018-06-16 16:12:51 +02:00
Jan Nieuwenhuizen 584482fb79
mescc: Add fopen test.
* scaffold/tests/97-fopen.c: New file.
* build-aux/check-mescc.sh (tests): Run it.
* include/unistd.h (link): Declare.
2018-06-16 15:18:27 +02:00
Jan Nieuwenhuizen 65d530f4ec
mescc: Support binutils-2.14: fopen: Return 0 upon failure.
* lib/libc+tcc.c (fopen): Return 0 upon failure.
2018-06-16 10:54:59 +02:00
Jan Nieuwenhuizen 125b43acc8
mescc: Update elf32-header for linux-4.17.
Previously, our binaries showed this

    $ readelf -s scaffold/main.mes-out
    There are 2 program headers, starting at offset 64

    Program Headers:
      Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
      LOAD           0x000000 0x01000000 0x01000000 0x0557c 0x0557c RWE 0x1
      LOAD           0x000000 0x01000000 0x01000000 0x0557c 0x0557c RWE 0x1

     Section to Segment mapping:
      Segment Sections...
       00     .text .data
       01     .text .data

Linux-4.17 refuses to run this and says

    Uhuuh, elf segment at 0000000001000000 requested but the memory is mapped already
    Segmentation fault

* lib/x86-mes/elf32-header.hex2: Remove unused data program header.
2018-06-16 08:32:12 +02:00
Jan Nieuwenhuizen d8e6046453
build: make seed: Update mescc-tools-seed too. 2018-06-16 06:37:20 +02:00
Jan Nieuwenhuizen 4d90fb1475
guix: mescc-tools: Update to 0.5.
* guix.scm (mescc-tools): Update to 0.5.
2018-06-16 09:44:42 +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 ebe6a1ea81
guix: Update mes to 0.15.
* guix.scm (mes): Update to 0.15.
  (mes.git): Likewise.
2018-06-11 19:13:12 +02:00
Jan Nieuwenhuizen 1b80c8a76f
Release 0.15.
* configure (VERSION): Bump to 0.15.
2018-06-10 21:10:54 +02:00
Jan Nieuwenhuizen 25651c6d51
doc: Release udpate.
* BOOTSTRAP: Update.
* HACKING: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.15: New file.
2018-05-23 22:48:00 +02:00
Jan Nieuwenhuizen b6b93f9f19
build: Resurrect non-bootstrap build.
* configure (parse-opts): Support mixing VAR=VALUE --prefix=PREFIX.
* guix.scm (mes): Remove setting PREFIX in make-flags.
* install.sh: Cater for Guix's setting read-only of scripts/diff.scm.
2018-06-12 07:05:33 +02:00
Jan Nieuwenhuizen c086f67cec
mescc: Support less-patched tcc/gcc: Add crti and crtn.
* lib/crt0.c[__MESC__]: Support MesCC.
* lib/crti.c: New file.
* lib/crtn.c: New file.
* build-aux/build-mes-gcc.sh: Build them.
2018-06-10 16:03:18 +02:00
Jan Nieuwenhuizen c2c3554884
mescc: Refactor debug and stub printing.
* lib/libc.c (__mes_debug): New function.  Use it for debug printing
  and in stubs throughout.
2018-06-10 14:07:19 +02:00
Jan Nieuwenhuizen 18194b1ae4
mescc: Support binutils-2.30: fopen fix.
* lib/libc+tcc.c (fopen): Set O_APPEND for 'a'.
2018-06-10 13:33:30 +02:00
Jan Nieuwenhuizen c349f6fdd8
mescc: Support binutils-2.30.
* lib/binutils.c (raise, strdup): New function.
  (mbstowcs): New stub.
* include/fcntl.h (O_APPEND, FD_CLOEXEC): New define.
2018-06-09 17:58:47 +02:00
Jan Nieuwenhuizen 53dd76ffc0
mescc: Support binutils-2.10.1: Stubs set errno to 0. 2018-06-09 11:28:31 +02:00
Jan Nieuwenhuizen bb3353a272
mescc: Silence some stubs.
* lib/libc+tcc.c: [!NOISY_FLOATS, !NOISY_TIMES]: Silence stubs.
* lib/gcc.c: Likewise.
* lib/binutils.c: Likewise.
2018-06-09 07:40:07 +02:00
Jan Nieuwenhuizen a744fd9ba4
mescc: Add debug printing: fopen, fwrite.
* lib/libc+tcc.c (fopen, fwrite)[MESC_DEBUG]: Print debug info.
2018-06-10 07:51:56 +02:00
Jan Nieuwenhuizen 3ba5b23dab
mescc: Support binutils-2.10.1: opentype `r+'.
* lib/libc+tcc.c (fopen): Support opentype `r+'.
2018-06-10 07:51:10 +02:00
Jan Nieuwenhuizen 831bd71a14
mescc: syscall: return only ever error -1, set errno. 2018-06-08 07:17:51 +02:00
Jan Nieuwenhuizen b7d913d7a0
mescc: Support gcc-2.95: Add getpwnam stub.
* lib/gcc.c (getpwnam): New stub.
2018-06-07 18:04:17 +02:00
Jan Nieuwenhuizen a70bc92857
mescc: Support gcc-3.0: Implement alarm, setitimer. 2018-06-07 18:03:51 +02:00
Jan Nieuwenhuizen ef0a39547c
mescc: Support gcc-3.0: Implement atexit. 2018-06-07 18:02:21 +02:00
Jan Nieuwenhuizen 93cb6375ae
mescc: Support gcc-3.0: Implement dup2, fcntl, getrusage.
* include/sys/resource.h: New file.
* lib/linux+gnu.c (fcntl, dup2, getrusage): New function.
* lib/binutils.c (fcntl): Remove stub.
2018-06-07 08:02:32 +02:00
Jan Nieuwenhuizen b7c35dad69
mescc: Support gcc-3.2: Implement getuid, getgid.
* lib/linux+gnu.c (getuid, getdid): New function.
* lib/binutils.c (getuid, getdid): Remove stub.
2018-06-07 07:19:01 +02:00
Jan Nieuwenhuizen d1e3a786aa
mescc: Support gcc-3.2: Reset errno.
* lib/linux-gcc.c (_sys_call, _sys_call1, _sys_call2, _sys_call3):
  Reset errno.
* lib/linux-mes.c (__sys_call, __sys_call1, __sys_call2 ,
  __sys_call3): Rename from _*.
   (_sys_call, _sys_call1, _sys_call2, _sys_call3): New function.
  Reset errno.
2018-06-07 07:16:43 +02:00
Jan Nieuwenhuizen cc466662b9
mescc: Support gcc-3.2: Implement integer strto*.
* lib/libc+tcc.c (strtoll, strtoul): Call strtoul.
2018-06-06 22:39:57 +02:00
Jan Nieuwenhuizen 04302b3fe4
mescc: Support gcc-3.2: Add getpid, signal.
* lib/linux+gnu.c (getpid, signal): New function.
* include/signal.h: Declare signal.
* include/unistd.h: Declare getpid.
* scaffold/tests/95-signal.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-06-06 22:14:35 +02:00
Jan Nieuwenhuizen 7c4a6a88ed
mescc: Support gcc-3.4.0: *printf: Support `%n'.
* lib/libc+tcc.c (vfprintf, vsprintf): Support `%n'.  For Gcc 3.4.0.
* scaffold/tests/70-printf.c: Test it.
2018-06-06 19:29:32 +02:00
Jan Nieuwenhuizen f4616dfef1
mescc: Support gcc-3.4.0: alloca.
* lib/alloca.c: New file.
* AUTHORS: Mention it.
* lib/libc+gnu.c: Add it.
* include/stdlib.h: Declare alloca.
2018-06-06 19:44:29 +02:00
Jan Nieuwenhuizen f60cac6e1d
mescc: Support gcc-3.4.0: unsetenv.
* lib/gcc.c (unsetenv): New function.
2018-06-06 19:43:32 +02:00
Jan Nieuwenhuizen 4f6f79973e
mescc: Support gcc-3.2: Add __divdi3, __moddi3 stubs.
* lib/gcc.c (__divdi3, __moddi3): New stubs.
2018-06-06 17:02:01 +02:00