Commit graph

58 commits

Author SHA1 Message Date
Jan Nieuwenhuizen af8335dc7a mescc: Tinycc support: strrchr.
* mlibc/libc-mes+tcc.c (strrchr): Implement.
2017-07-30 13:09:19 +02:00
Jan Nieuwenhuizen 8991e927c3 mescc: Tinycc support: strchr.
* mlibc/libc-mes+tcc.c (strchr): Implement.
2017-07-30 12:55:58 +02:00
Jan Nieuwenhuizen 18cb982687 mescc: Tinycc support: noisy stubs.
* mlibc/libc-mes+tcc.c: Noisy stubs.
2017-07-27 18:53:44 +02:00
Jan Nieuwenhuizen f29479dfa2 mescc: Tinycc support: memcmp.
* mlibc/libc-mes+tcc.c (memcmp): Implement.
2017-07-29 11:09:00 +02:00
Jan Nieuwenhuizen ce980c8239 mescc: Tinycc support: compile tcc with TCC_IS_NATIVE.
* mlibc/include/string.h (strcat): Declare.
* mlibc/libc-mes+tcc.c (dlclose, dlopen, mprotect, sigaction,
  sigemptyset, strcat, vfprintf): Move from libc-gcc+tcc.c.
* mlibc/libc-gcc+tcc.c: Remove them.
* module/language/c99/compiler.mes (c99-input->full-ast): Define __i386__=1.
  (i386:type-alist): Parse `long long int', `unsigned short int',
  `unsigned long long int'.
  (struct-field): Support void**.
  (init-declr->name):
  (init-declr->pointer): Support function declaration.
2017-07-28 08:07:41 +02:00
Jan Nieuwenhuizen 397d7a6c43 mlibc: Tinycc support: gcc -nostdinc -nostdlib.
* mlibc/libc-gcc+tcc.c: New file.
* mlibc/include/dlfcn.h:
* mlibc/include/errno.h:
* mlibc/include/signal.h:
* mlibc/include/sys/mman.h:
* mlibc/include/sys/time.h:  Add tcc declarations.
2017-07-27 23:44:22 +02:00
Jan Nieuwenhuizen ab74876131 mescc: Tinycc support: malloc,memcpy.
* mlibc/libc-mes.c (malloc): Rewrite.
* mlibc/libc-mes+tcc.c (memcpy): Implement.
2017-07-27 18:51:58 +02:00
Jan Nieuwenhuizen 08ba0fce55 mescc: Tinycc support: memset.
* mlibc/libc-mes+tcc.c (memset): Implement.
2017-07-27 09:08:11 +02:00
Jan Nieuwenhuizen 913fd66e5b mescc: Tinycc support: oops, use new realloc.
* mlibc/libc-mes.c (realloc): Disable naive realloc for libc-mes+tcc.c.
2017-07-27 00:13:39 +02:00
Jan Nieuwenhuizen 62e7809725 mescc: Tinycc support: calloc,malloc,realloc.
* mlibc/libc-mes+tcc.c (calloc,malloc,realloc): New function.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen 7e795763f3 mescc: Tinycc support: bugfix for char **pp = *p.
* module/language/c99/compiler.mes (ptr-declr->pointer): Grok ***.
  (decl->info): Bugfix for char **pp = *p, cleanup.
* mlibc/libc-mes.c (getenv): Update for bugfix.
* scaffold/tests/23-pointer.c (test): Test it.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen 91f9817a44 mescc: Tinycc support: execvp stub.
* mlibc/include/unistd.h (execvp): Declare.
* mlibc/libc-mes+tcc.c (execvp): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen 8296c8ec2c mescc: Tinycc support: remove stub.
* mlibc/include/stdio.h (remove): Declare.
* mlibc/libc-mes+tcc.c (remove): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen 2914b74aa4 mescc: Tinycc support: fread stub.
* mlibc/include/stdio.h (fread): Declare.
* mlibc/libc-mes+tcc.c (fread): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen 47f0ce1d5c mescc: Tinycc support: ftell stub.
* mlibc/include/stdio.h (ftell): Declare.
* mlibc/libc-mes+tcc.c (ftell): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen 019994b8ed mescc: Tinycc support: fseek stub.
* mlibc/include/stdio.h (fseek): Declare.
* mlibc/libc-mes+tcc.c (fseek): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen 76e97a9b08 mescc: Tinycc support: fopen stub.
* mlibc/include/stdio.h (fopen): Declare.
* mlibc/libc-mes+tcc.c (fopen): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen fd63f744f7 mescc: Tinycc support: strstr stub.
* mlibc/include/string.h (strstr): Declare.
* mlibc/libc-mes+tcc.c (strstr): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen d4e9659d19 mescc: Tinycc support: sscanf stub.
* mlibc/include/stdio.h (sscanf): Declare.
* mlibc/libc-mes+tcc.c (sscanf): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen cd5536b283 mescc: Tinycc support: longjmp, setjump stub.
* mlibc/include/stdarg.h (longjmp, setjmp): Declare.
* mlibc/libc-mes+tcc.c (longjmp, setjmp): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen f711b2f005 mescc: Tinycc support: fflush stub.
* mlibc/include/stdio.h (fflush): Declare.
* mlibc/libc-mes+tcc.c (fflush): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen ff16c5a31f mescc: Tinycc support: vnsprintf stub.
* mlibc/include/stdarg.h (vnsprintf): Declare.
* mlibc/libc-mes+tcc.c (vnsprintf): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen 8f2c74c1cb mescc: Tinycc support: free stub.
* mlibc/include/stdlib.h (free): Declare.
* mlibc/libc-mes+tcc.c (free): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen 60de51241a mescc: Tinycc support: strrchr stub.
* mlibc/include/string.h (strrchr): Declare.
* mlibc/libc-mes+tcc.c (strrchr): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen 9f44c4875a mescc: Tinycc support: strtoll stub.
* mlibc/include/stdlib.h (strtoll): Declare.
* mlibc/libc-mes+tcc.c (strtoll): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen ec335eef50 mescc: Tinycc support: strtoull stub.
* mlibc/include/stdlib.h (strtoull): Declare.
* mlibc/libc-mes+tcc.c (strtoull): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen c749bb5aa3 mescc: Tinycc support: strtol stub.
* mlibc/include/stdlib.h (strtol): Declare.
* mlibc/libc-mes+tcc.c (strtol): Add stub.
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 a8f22ea993 mescc: Tinycc support: fclose stub.
* mlibc/include/stdio.h (fclose): Declare.
* mlibc/libc-mes+tcc.c (fclose): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen b479d200b3 mescc: Tinycc support: fdopen stub.
* mlibc/include/stdio.h (fdopen): Declare.
* mlibc/libc-mes+tcc.c (fdopen): Add stub.
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 b860cb7a17 mescc: Tinycc support: fwrite stub.
* mlibc/include/stdio.h (fwrite): Declare.
* mlibc/libc-mes+tcc.c (fwrite): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen 15a9452d33 mescc: Tinycc support: qsort stub.
* mlibc/include/stdlib.h (qsort): Declare.
* mlibc/libc-mes+tcc.c (qsort): Add stub.
2017-07-26 11:36:44 +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 ecf0fb50b1 mescc: Tinycc support: strchr stub.
* mlibc/include/string.h (strchr): Declare.
* mlibc/libc-mes+tcc.c (strchr): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen 718410e426 mescc: Tinycc support: fprintf stub.
* mlibc/include/stdio.h (fprintf): Declare.
* mlibc/libc-mes+tcc.c (fprintf): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen 702a1f9f54 mescc: Tinycc support: localtime stub.
* mlibc/include/time.h (localtime): Declare.
* mlibc/libc-mes+tcc.c (localtime): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen aa297a28a9 mescc: Tinycc support: time stub.
* mlibc/include/time.h (time): Declare.
* mlibc/libc-mes+tcc.c (time): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen beb24d9550 mescc: Tinycc support: snprintf stub.
* mlibc/include/stdio.h (snprintf): Declare.
* mlibc/libc-mes+tcc.c (snprintf): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen ce9f0b12d0 mescc: Tinycc support: strtoul stub.
* mlibc/include/stdlib.h (strtoul): Declare.
* mlibc/libc-mes+tcc.c (strtoul): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen 5c338ef705 mescc: Tinycc support: memmove stub.
* mlibc/include/string.h (memcmp): Declare.
* mlibc/libc-mes+tcc.c (memcmp): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen 6c7d26fa1c mescc: Tinycc support: memset stub.
* mlibc/include/string.h (memset): Declare.
* mlibc/libc-mes+tcc.c (memset): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen 8f7b47ef36 mescc: Tinycc support: memmove stub.
* mlibc/include/string.h (memmove): Declare.
* mlibc/libc-mes+tcc.c (memmove): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen 7b8253cd47 mescc: Tinycc support: memcpy stub.
* mlibc/include/string.h (memcpy): Declare.
* mlibc/libc-mes+tcc.c (memcpy): Add stub.
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 5f90fe3919 mescc: Guile eval.c support: headers.
* mlibc/include/signal.h (sigset_t): New type.
* mlibc/include/float.h: New file.
* mlibc/include/stddef.h: New file.
* mlibc/include/sys/select.h: New file.
2017-07-26 11:36:36 +02:00
Jan Nieuwenhuizen eee7f8cb3c mescc: Non-Guix support. Thanks rain1!
* mlibc/include: Neutralize include guards before #include_next.
  Fixes compiling tinycc on Debian GNU/Linux.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 2ab93d7308 mescc: Tinycc support: declare struct tm.
* mlibc/include/time.h (struct tm): New type.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 16b9a21712 mescc: Tinycc support: headers.
* mlibc/include/string.h (ssize_t): New type.
* mlibc/include/unistd.h (ssize_t): New type.
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