Jan (janneke) Nieuwenhuizen
5ed8b3f540
mescc: Mes C Library: Add getcwd for M2-Planet.
...
* lib/m2/getcwd.c: New file.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
d64296ae80
mescc: Mes C Library: Add exit for M2-Planet.
...
* lib/m2/exit.c: New file.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
0fd1633405
mescc: Mes C Library: Add execve for M2-Planet.
...
* lib/m2/execve.c: New file.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
aa59e9a59c
mescc: Mes C Library: Add execv for M2-Planet.
...
* lib/m2/execv.c: New file.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
3494f4bd65
mescc: Mes C Library: Add clock_gettime for M2-Planet.
...
* lib/m2/clock_gettime.c: New file.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
fd4aeb1ed9
mescc: Mes C Library: Add chmod for M2-Planet.
...
* lib/m2/chmod.c: New file.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
9aace8ad4a
mescc: Mes C Library: Prepare for M2-Planet: realloc.
...
* lib/stdlib/realloc.c (realloc): Prepare for M2-Planet.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
f497c727ba
mescc: Mes C Library: Prepare for M2-Planet: fdputc.
...
* lib/mes/fdputc.c (fdputc): Prepare for M2-Planet.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
5151041a80
mescc: Mes C Library: Prepare for M2-Planet: unlink.
...
* lib/linux/unlink.c (unlink): Prepare for M2-Planet.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
861b23f66e
mescc: Mes C Library: Prepare for M2-Planet: read.
...
* lib/linux/read.c (read): Prepare for M2-Planet.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
3fbd16aba7
mescc: Mes C Library: Prepare for M2-Planet: gettimeofday.
...
* lib/linux/gettimeofday.c (gettimeofday): Prepare for M2-Planet.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
a9a1e72e2a
mescc: Mes C Library: Prepare for M2-Planet: dup2.
...
* lib/linux/dup2.c (dup2): Prepare for M2-Planet.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
340287a952
mescc: Mes C Library: Prepare for M2-Planet: dup.
...
* lib/linux/dup.c (dup): Prepare for M2-Planet.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
1d21c1472d
mescc: Mes C Library: Prepare for M2-Planet: clock_gettime.
...
* lib/linux/clock_gettime.c (clock_gettime): Prepare for M2-Planet.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
709c184d46
mescc: Mes C Library: Prepare for M2-Planet: chmod.
...
* lib/linux/chmod.c (chmod): Prepare for M2-Planet.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
ae8e598b52
mescc: Mes C Library: Prepare for M2-Planet: access.
...
* lib/linux/access.c (access): Prepare for M2-Planet.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
06d5880e8a
mescc: Mes C Library: Prepare for M2-Planet: _getcwd.
...
* lib/linux/_getcwd.c (_getcwd): Prepare for M2-Planet.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
f352012e75
mescc: Mes C Library: Bugfix __ungetc_clear.
...
* lib/m2/mes_open.c (mes_open): Remove __ungetc_init ();
* lib/m2/open.c (open): Likewise.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
1f67f1291f
kaem: scaffold/read.kaem.
...
* .gitignore: Update.
* include/linux/x86/syscall.h: Update for M2-Planet.
* lib/linux/brk.c (brk): Remove cast for M2-Planet.
* lib/linux/x86-mes-m2/syscall.c: New file.
* lib/m2/malloc.c: New file.
* lib/string/memset.c (memset): Update for M2-Planet.
* scaffold/read.c: Update for M2-Planet.
* scaffold/kaem.read: New file.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
9607b4e531
kaem: scaffold/argv.kaem.
...
* scaffold/argv.c (strcmp): Remove.
(main): Update.
* scaffold/argv.kaem: New file.
lib/x86-mes/x86.M1 (mov____%edi,%ebp, mov____%esp,%edi): New macro.
2022-05-01 20:46:15 +02:00
Jan (janneke) Nieuwenhuizen
2dc17df0f1
kaem: scaffold/main.kaem.
...
* lib/linux/x86-mes-m2/crt1.c,
lib/linux/x86-mes-m2/crt1.M1,
lib/linux/x86-mes-m2/_exit.c,
lib/linux/x86-mes-m2/_write.c: New files.
* lib/m2/x86/x86_defs.M1: New file. Import from stage0.
* lib/m2/x86/ELF-x86.hex2: New file. Import from M2-Planet.
* scaffold/main.c: Update for M2-Planet.
* scaffold/main.kaem: New file.
* .gitignore: Update.
2022-05-01 20:46:08 +02:00
Jan (janneke) Nieuwenhuizen
4454a6920e
mescc: Mes C Library: Prepare for M2-Planet: setenv.
...
* lib/posix/setenv.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
31707402a1
mescc: Mes C Library: Prepare for M2-Planet: getenv.
...
* lib/posix/getenv.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
3b504d923d
mescc: Mes C Library: Prepare for M2-Planet: ntoab.
...
* lib/mes/ntoab.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
1024a4cb86
mescc: Mes C Library: Prepare for M2-Planet: malloc.
...
* lib/stdlib/malloc.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
efd6b78302
mescc: Mes C Library: Prepare for M2-Planet: fdungetc.
...
* lib/mes/fdungetc.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
3fb416a47c
mescc: Mes C Library: Bugfix __ungetc_clear.
...
* lib/linux/_open3.c (_open3): Remove __ungetc_init ();
* lib/mes/mes_open.c (mes_open): Likewise.
* lib/mes/fdungetc.c (fdungetc): Likewise.
* lib/mes/fdgetc.c (__ungetc_p, __ungetc_clear, __ungetc_set): Call
__ungetc_init if buffer is uninitialized.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
f0530b91c5
mescc: Mes C Library: Prepare for M2-Planet: fdgetc.
...
* lib/mes/fdgetc.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
b5f6e2406c
mescc: Mes C Library: Prepare for M2-Planet: abtol.
...
* lib/mes/abtol.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
a70918380f
mescc: Mes C Library: memcmp: bugfix.
...
* lib/string/memcmp.c (memcmp): Bugfix.
* lib/tests/string/50-memcmp.c: Test it.
* build-aux/check-mescc.sh (TESTS): Add it.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
4cf5a960d8
mescc: Mes C Library: Prepare for M2-Planet: memcmp.
...
* lib/string/memcmp.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
f882050c0c
mescc: Mes C Library: Prepare for M2-Planet: memcpy.
...
* lib/string/memcpy.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
8fa2e0811c
mescc: Mes C Library: Prepare for M2-Planet: memchr.
...
* lib/string/memchr.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
92a78c8e88
mescc: Mes C Library: Prepare for M2-Planet: strncmp.
...
* lib/string/strncmp.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
488123e6a2
mescc: Mes C Library: Prepare for M2-Planet: strlen.
...
* lib/string/strlen.c: : Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
3501a8df81
mescc: Mes C Library: Prepare for M2-Planet: strcpy.
...
* lib/string/strcpy.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
9a38e97c24
mescc: Mes C Library: Prepare for M2-Planet: strcmp.
...
* lib/string/strcmp.c: Rewrite C-constructs not supported by M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
fb5163b9ba
mescc: Mes C Library: Prepare for M2-Planet: __assert_fail.
...
Rewrite C-constructs not supported by M2-Planet, such as
foo ? bar : baz; -> if (foo) bar; else baz;
static char foo[1024] -> __func_buf = malloc (1024); ... char *foo = __func_buf;
*foo -> foo[0]
foo++ -> foo = foo + 1 TODO: pointer arithmetic
foo += 1; -> foo = foo + 1
for (int foo = ; -> int foo; for (foo=
if (foo) -> if (foo != 0)
if (!foo) -> if (foo == 0)
; -> 0;
* lib/mes/__assert_fail.c: Rewrite C-constructs not supported by
M2-Planet.
2022-04-30 08:41:47 +02:00
Jan (janneke) Nieuwenhuizen
3514f5d374
mescc: Mes C Library: Add assert_msg.
...
* lib/mes/assert_msg.c: New file.
2022-04-30 08:41:47 +02:00
W. J. van der Laan
be4514c4de
lib/tests: Pass int to va_arg instead of char.
...
* lib/tests/scaffold/70-stdarg.c (stdarg1, stdarg2, stdarg3): Pass int
to va_arg instead of char to avoid gcc trap "warning: 'char’ is promoted
to ‘int’ when passed through ‘...’ [enabled by default] (so you should
pass ‘int’ not ‘char’ to ‘va_arg’) if this code is reached, the program
will abort".
2021-05-02 16:56:29 +02:00
Jan (janneke) Nieuwenhuizen
6c1ff75c5a
mescc: Mes C Library: crt: Support more than 255 command line parameters.
...
Reported by Paul Dersey <pdersey@gmail.com>.
* lib/freebsd/x86-mes-gcc/crt1.c (_start): Use mov instead of movzbl for
argc.
* lib/linux/x86-mes-gcc/crt0.c (_start): Likewise.
* lib/linux/x86-mes-gcc/crt1.c (_start): Likewise.
* lib/freebsd/x86-mes-mescc/crt1.c (_start): Likewise.
* lib/linux/x86-mes-mescc/crt1.c (_start): Likewise.
2021-05-02 14:22:21 +02:00
Jan (janneke) Nieuwenhuizen
dfa8e6e9d5
mescc: Mes C Library: malloc.c: Move unix-variant to lib/linux.
...
* lib/stdlib/malloc.c: Move to...
lib/linux/malloc.c: ...here.
* build-aux/configure-lib.sh (libc_SOURCES): Move malloc.c...
[linux]: ...here.
2021-05-02 13:13:13 +02:00
Danny Milosavljevic
2e9b02043b
libtcc1: Fix integer division, modulo and shifting procedures.
...
* lib/libtcc1.c (__divdi3): Make parameters integer.
(__moddi3): Make parameters integer.
(__udivdi3): Use unsigned division.
(__umoddi3): Use unsigned modulo.
(__lshrdi3): Add comment.
(__ashrdi3): Add comment.
2021-03-14 11:05:00 +01:00
Danny Milosavljevic
27b06c6ddb
mescc: Mes C Library: Make malloc align the blocks it gives out.
...
* include/stddef.h (max_align_t): Add typedef for max_align_t.
* lib/stdlib/malloc.c (malloc): Align the blocks it gives out to multiples
of max_align_t.
2021-01-23 08:43:48 +01:00
Jan (janneke) Nieuwenhuizen
381e8bd6e0
mescc: Mes C Library: feof: Bugfix for ARM.
...
* lib/stdio/feof.c (feof): Use int to compare with EOF.
2021-01-23 08:43:47 +01:00
Jan (janneke) Nieuwenhuizen
7ab9cfe864
mescc: Mes C Library: time.c: Use #if defined.
...
This helps resurrect the mes-0.19-based bootstrap.
* lib/linux/time.c: Use #if defined () instead of plain #if for possibly
undefined macros.
2021-01-23 08:43:47 +01:00
Jan (janneke) Nieuwenhuizen
3115261f2f
libtcc1: Compile float stubs conditionally.
...
* lib/libtcc1.c (__floatundidf, __floatundixf, __fixunsxfdi, __fixxfdi,
__fixsfdi, __fixunsdfdi, __fixunsdfsi, __floatdisf,
__floatdidf)[!(HAVE_FLOAT_STUB || HAVE_FLOAT)]: Remove.
2021-01-23 08:43:47 +01:00
Jan (janneke) Nieuwenhuizen
d9226ca678
libtcc1: Make float stubs weak.
...
* lib/libtcc1.c (__floatundidf, __floatundixf, __fixunsxfdi, __fixxfdi,
__fixsfdi, __fixunsdfdi, __fixunsdfsi, __floatdisf, __floatdidf): Add
__attribute__ ((weak)).
2021-01-23 08:43:47 +01:00
Jan (janneke) Nieuwenhuizen
b7dff2c2a4
mescc: Mes C Library: ARM: setjmp.c: Inline fake asm.
...
* lib/linux/arm-mes-gcc/_exit.c (longjmp, setjmp): Use inline fake asm.
2021-01-23 08:43:46 +01:00
Jan (janneke) Nieuwenhuizen
6703c33f96
mescc: Mes C Library: ARM: syscall.c: Inline fake asm.
...
* lib/linux/arm-mes-gcc/syscall.c (__sys_call, __sys_call1, __sys_call2,
__sys_call3, __sys_call4): Use inline fake asm.
2021-01-23 08:43:46 +01:00