Jan Nieuwenhuizen
44a0d9f46c
mescc: Mes C Library: Support gcc-4.6.4: Add strtok.
...
* include/string.h (strtok): Declare.
* lib/string/strtok.c (strtok): New file.
* lib/libc+gnu.c: Include it.
2019-09-09 18:33:26 +02:00
Jan Nieuwenhuizen
bf670b2c73
mescc: Mes C Library: Support gcc-4.6.4: Add mmap, munmap.
...
* include/linux/x86/syscall.h (SYS_mmap, SYS_munmap): New macro.
* include/linux/x86_64/syscall.h (SYS_mmap, SYS_munmap): New macro.
* include/sys/mman.h (MAP_SHARED, MAP_PRIVATE, MAP_ANONYMOUS,
MAP_POPULATE, MAP_ANON, MAP_FAILED): New macro.
(mmap, munmap): Declare.
* lib/linux/x86-mes-gcc/mes.c (_sys_call6): New function.
* lib/linux/x86-mes/mes.c (__sys_call6): New function.
(_sys_call6): New function.
* lib/linux/x86_64-mes-gcc/mes.c (_sys_call6): New function.
* lib/linux/x86_64-mes/mes.c (__sys_call): Cater for 6 syscall parameters.
(_sys_call6): New function.
* lib/x86-mes/x86.M1 (pop____%ebp): New macro.
* lib/x86_64-mes/x86_64.M1 (mov____0x8(%rbp),%r9): New macro.
* lib/linux/mmap.c: New file.
* lib/linux/munmap.c: New file.
* build-aux/configure-lib.sh (libc_gnu_SOURCES): Add them.
2019-09-09 18:33:25 +02:00
Jan Nieuwenhuizen
bc9a9948ac
mescc: Mes C Library: Support gcc-4.6.4: Add labs.
...
* lib/math/labs.c: New file.
* lib/libc+gnu.c: Include it.
* include/math.h (labs): Declare.
2019-09-09 18:33:25 +02:00
Jan Nieuwenhuizen
5cbe225ddc
mescc: Mes C Library: Support gcc-4.6.4: Implement rewind.
...
* lib/stdio/rewind.c: Move from ../stub. Implement.
* include/stdio.h (rewind): Declare.
* lib/libc+gnu.c: Update include.
* lib/libg.c: Update include.
* lib/stub/rewind.c: Remove.
2019-09-09 18:33:25 +02:00
Jan Nieuwenhuizen
c2b160b58a
mescc: Mes C Library: Support gcc-4.6.4: Add asctime stub.
...
* lib/stub/asctime.c: New file.
* lib/libc+gnu.c: Include it.
* include/time.h (asctime): Declare.
2019-09-09 18:33:25 +02:00
Jan Nieuwenhuizen
96b246be7c
mescc: Mes C Library: Support gcc-4.6.4: vfprintf, vsnprintf: #-type.
...
* lib/stdio/vfprintf.c (vfprintf): Support #-type prefix. Show whole
format upon error.
* lib/stdio/vsnprintf.c (vsnprintf): Likewise.
* lib/stdio/vfscanf.c (vfscanf): Show whole template upon error.
* lib/stdio/vsscanf.c (vsscanf): Likewise.
2019-09-09 18:33:25 +02:00
Jan Nieuwenhuizen
03c09d358e
mescc: Mes C Library: Support gcc-4.6.4: vfprintf, vsnprintf: pad with space.
...
* lib/stdio/vfprintf.c (vfprintf): pad with space.
* lib/stdio/vsnprintf.c (vsnprintf): pad with space.
2019-09-09 18:33:25 +02:00
Jan Nieuwenhuizen
3853afd484
mescc: Mes C Library: Support gcc-4.6.4: atexit: return 0.
...
* lib/stdlib/atexit.c (atexit): return 0.
2019-09-09 18:33:25 +02:00
Jan Nieuwenhuizen
109014ffed
mescc: Mes C Library: Support gcc-4.6.4: Add math stubs.
...
* lib/math/ceil.c: New file.
* lib/math/floor.c: New file.
* lib/stub/atan2.c: New file.
* lib/stub/cos.c: New file.
* lib/stub/exp.c: New file.
* lib/stub/log.c: New file.
* lib/stub/modf.c: New file.
* lib/stub/pow.c: New file.
* lib/stub/sin.c: New file.
* lib/stub/sqrt.c: New file.
* lib/libc+gnu.c: Include them.
* include/math.h (atan2, ceil, cos, exp, fabs, floor, log, modf, pow,
sin, sqrt): Declare.
* lib/math/fabs.c: Update.
* lib/stub/ldexp.c: Update.
2019-09-09 18:33:24 +02:00
Jan Nieuwenhuizen
5073083dea
mescc: Mes C Library: Support gcc-4.6.4: Add fscanf, vfscanf.
...
* lib/stdio/vfscanf.c: New file.
* lib/stdio/fscanf.c: New file.
* build-aux/configure-lib.sh (libc_gnu_SOURCES): Add them.
* include/stdio.h (fscanf): Declare.
* include/stdarg.h (vfscanf): Declare.
* lib/libc+gnu.c: Include them.
* lib/libg.c: Likewise.
* lib/stub/fscanf.c: Remove.
2019-09-09 18:33:24 +02:00
Jan Nieuwenhuizen
2d11c7a95b
mescc: Mes C Library: vfprintf, vsnprintf: Pad floats with space.
...
* lib/stdio/vfprintf.c (vfprintf): Pad floats with space.
* lib/stdio/vsnprintf.c (vsnprintf): Pad floats with space.
* lib/tests/stdio/90-sprintf.c: Test it.
2019-09-09 18:33:24 +02:00
Jan Nieuwenhuizen
55d538b2c5
mescc: Mes C Library: Support gcc-4.6.4: Fix ctime stub.
...
* lib/stub/ctime.c (ctime): Fix stub to avoid segfault upon use.
2019-09-09 18:33:24 +02:00
Jan Nieuwenhuizen
a520728889
mescc: Mes C Library: vsscanf: Increase count for scanned float.
...
* lib/stdio/vsscanf.c (vsscanf): Increase count for scanned float.
2019-09-09 18:33:23 +02:00
Jan Nieuwenhuizen
ff441b38e4
mescc: Mes C Library: Support GNU Tar: Fix getpwnam, getpwuid stubs.
...
* lib/stub/getpwnam.c (getpwnam): Return pointer to static struct
passwd.
* lib/stub/getpwuid.c (getpwuid): Likewise.
2019-09-09 18:33:23 +02:00
Jan Nieuwenhuizen
56db7e2aca
mescc: Mes C Library: Support GNU Tar: Add getgrgid, getgrnam, setgrent stub.
...
* include/grp.h: New file.
* lib/stub/getgrgid.c: New file.
* lib/stub/getgrnam.c: New file.
* lib/stub/setgrent.c: New file.
* lib/libc+gnu.c: Include them.
2019-09-09 18:33:23 +02:00
Jan Nieuwenhuizen
61419f0bf3
mescc: Mes C Library: Support GNU Awk: Add wchar_t.
...
* include/sys/types.h (wchar_t): New typedef.
2019-09-09 18:33:23 +02:00
Jan Nieuwenhuizen
55fde29822
mescc: Mes C Library: Support GNU Awk: Add getpgid, getpgrp stubs.
...
* include/unistd.h (getpgid, getpgrp): Declare.
* lib/stub/getpgid.c: New file.
* lib/stub/getpgrp.c: New file.
* lib/libc+gnu.c: Include them.
2019-09-09 18:33:23 +02:00
Jan Nieuwenhuizen
8c9de89c6b
mescc: Mes C Library: Support GNU Tar: Add mktime stub, fix localtime stub.
...
* include/time.h (mktime): Declare.
* lib/stub/mktime.c: New stub.
* lib/libc+gnu.c: Include it.
* lib/stub/localtime.c (localtime): Return pointer to static struct
tm. Avoids segfaults.
2019-09-09 18:33:23 +02:00
Jan Nieuwenhuizen
2cb5e873c4
mescc: Mes C Library: Support GNU Tar: Add creat, mknod.
...
* include/linux/x86_64/syscall.h (SYS_mknod): New macro.
* include/linux/x86/syscall.h (SYS_mknod): New macro.
* lib/linux/mknod.c: New file.
* build-aux/configure-lib.sh (libc_gnu_SOURCES): Add it.
* include/sys/stat.h (mknod): Declare it.
* include/fcntl.h (creat): New macro.
2019-09-09 18:33:22 +02:00
Jan Nieuwenhuizen
d7bbd7f62d
mescc: Mes C Library: Support GNU Awk: Implement atof.
...
* lib/stdlib/atoi.c: Update.
* lib/stdlib/atof.c: Rename from stub/atof.c; Implement.
* lib/libc+gnu.c: Update include.
* lib/libg.c: Update include.
2019-09-09 18:33:22 +02:00
Jan Nieuwenhuizen
9d33ed0a2e
mescc: Mes C Library: Support GNU Awk: Add dtoab, %f in vfprintf, vsnprintf.
...
* include/libmes.h (dtoab): Declare.
* lib/mes/ntoab.c (ntoab): Update.
* lib/mes/dtoab.c: New file.
* build-aux/configure-lib.sh (libmes_SOURCES, libc_tcc_SOURCES): Add
it.
* lib/tests/mes/90-dtoab.c: Test it.
* lib/tests/stdio/90-sprintf.c: Test it.
* build-aux/check-mescc.sh (tests): Run it, against...
* lib/tests/mes/90-dtoab.stdout: ...baseline.
* lib/stdio/vfprintf.c (vfprintf): Support %f, even more naive support
for %e, %E, %g, %G.
* lib/stdio/vsnprintf.c (vsnprintf): Likewise.
2019-09-09 18:33:22 +02:00
Jan Nieuwenhuizen
6b4ef3c8d4
mescc: Mes C Library: Support GNU Awk: Add abtod, implementing strtod.
...
* include/libmes.h (abtod): Declare.
* lib/mes/abtod.c: New file.
* build-aux/configure-lib.sh (libmes_SOURCES, libc_tcc_SOURCES): Add
it.
* lib/mes/abtol.c: Update.
* lib/stdlib/strtod.c: Use it to implement; move from stub/strtod.
* lib/tests/mes/90-abtod.c: Test it.
* lib/tests/mes/90-abtod.stdout: Baseline.
* build-aux/check-mescc.sh (tests): Run it.
2019-09-09 18:33:22 +02:00
Jan Nieuwenhuizen
79ae7ee4eb
mescc: Mes C Library: Support GNU Awk: vsscanf: Support %f.
...
* lib/stdio/vsscanf.c (vsscanf): Support %f.
2019-09-09 18:33:22 +02:00
Jan Nieuwenhuizen
8034d6942e
mescc: Mes C Library: Support GNU Awk: Do not flush std files.
...
* lib/stdio/fflush.c (fflush): Do not flush std files.
2019-09-09 18:33:21 +02:00
Jan Nieuwenhuizen
ceaf6d62bd
mescc: Mes C Library: Support GNU Awk: Add isgraph.
...
* lib/ctype/isgraph.c: New file.
* lib/libc+gnu.c: Include it.
* include/ctype.h: Add missing prototypes.
2019-09-09 18:33:21 +02:00
Jan Nieuwenhuizen
07a9e7aac7
mescc: Mes C Library: Support GNU Tar: Add readlink, readlink.
...
* lib/linux/gnu.c (readlink, symlink): New function.
* include/unistd.h (readlink, symlink): Declare.
* include/linux/x86/syscall.h (SYS_readlink, SYS_symlink): New macro.
* include/linux/x86_64/syscall.h (SYS_symlink, SYS_readlink): New
macro.
2019-09-09 18:33:21 +02:00
Jan Nieuwenhuizen
bc2a115b55
mescc: Mes C Library: Support GNU Tar: Add execlp.
...
* lib/posix/execl.c (vexec): New function.
(execl): Use it.
* lib/posix/execlp.c: New file.
* build-aux/configure-lib.sh (libc_tcc_SOURCES): Add it.
* lib/libc+gnu.c: Include it.
* include/unistd.h (execlp): Declare.
* lib/tests/posix/90-execlp.c: New file.
* lib/tests/posix/90-execlp.stdout: New file.
* build-aux/check-mescc.sh: Test it.
2019-09-09 18:33:21 +02:00
Jan Nieuwenhuizen
b3283e2377
mescc: Mes C Library: Fix compile warnings.
...
* include/stdlib.h (abort): Add prototype.
2019-09-09 18:33:14 +02:00
Jan Nieuwenhuizen
3bed314d94
getopt: Remove old FSF address, thanks Vagrant.
...
* lib/posix/getopt.c: Remove old FSF address.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
15a39f0efe
Add missing #include.
...
* lib/tests/scaffold/55-char-array.c: Add missing #include.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
e2dfaef89e
Add missing #include.
...
* lib/tests/io/90-stat.c: Add missing #include.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
5f82a697b3
Add missing #include.
...
* lib/posix/getcwd.c: Add missing #include.
2019-09-09 16:04:15 +02:00
Jan Nieuwenhuizen
2db5ec2f55
signal: Use SA_RESTORER on x86-64.
...
* lib/linux/signal.c (signal)[x86_64]: Avoid segfault by setting
SA_RESTORER flag.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
23d857c834
signal: Add comment on why we don't use the restorer.
...
* lib/linux/signal.c: Add comment on why we don't use the restorer.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
4a183fa1cf
signal: Remove SA_SIGINFO.
...
* lib/linux/signal.c (signal): Remove SA_SIGINFO.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
3e6306a5ce
signal: Don't use custom restorer.
...
* lib/linux/signal.c (signal): Don't use custom restorer.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
02fdead244
signal: Use SA_SIGINFO (like glibc).
...
* lib/linux/signal.c (_restorer): Rename to...
(_restorer_for_siginfo): ...this.
(signal): Use it. Use SA_SIGINFO.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
e8bbe21499
signal: Make sure that the signal mask is actually unsigned long.
...
* lib/linux/signal.c (signal): Make sure that the signal mask is actually
unsigned long.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
5754e379af
Delete "__sigmask".
...
Follow-up to 6d95b89759d3c598fc84194429ae8c57249daa1a
* lib/linux/signal.c (__sigmask): Delete definition.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
3f1ba73fc7
Fix "struct sigaction" structure for rt_sigaction.
...
* include/signal.h (sigset_t): Increase size.
* lib/linux/signal.c (signal): Use new sigset_t.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
c7d050c0cd
tests: Fail early on nonexistent file.
...
* lib/tests/io/90-stat.c (main): Fail early on nonexistent file.
2019-09-09 16:04:13 +02:00
Danny Milosavljevic
5a2a00f4e8
open: Check flags, and use _open2 if applicable.
...
* lib/linux/open.c (open): Check flags; use _open2.
2019-09-09 16:04:13 +02:00
Danny Milosavljevic
3943155a64
ldiv: Make rem < 0 if a < 0.
...
* lib/mes/div.c (ldiv): Make rem < 0 if a < 0.
2019-09-09 16:04:13 +02:00
Danny Milosavljevic
21bd2c1e90
ldiv: Handle a == LONG_MIN.
...
* lib/mes/div.c (ldiv): Handle a == LONG_MIN.
2019-09-09 16:04:13 +02:00
Jan Nieuwenhuizen
49aff4ec1c
ntoab: Use __mesabi_uldiv only for arm.
...
* lib/mes/ntoab.c (ntoab)[__MESC__ && __arm__]: Use __mesabi_uldiv.
* build-aux/check-mescc.sh (XFAIL_TESTS): 70-printf-simple.c and
70-printf.c now pass for x86_64 mescc.
2019-09-09 16:04:13 +02:00
Danny Milosavljevic
08774a9c74
Fix ntoab.
...
Follow-up to b5b19304b59fefbed923b146ec8c8d495556fa76.
* lib/mes/ntoab.c (ntoab): Fix non-MESC case.
2019-07-01 20:04:26 +02:00
Danny Milosavljevic
b0466331a7
signal: Define "_restorer" everywhere except on i386.
...
* lib/linux/signal.c: Define "_restorer" everywhere except on i386.
2019-06-18 19:26:45 +02:00
Danny Milosavljevic
9b0efad295
ntoab: Use __mesabi_uldiv only on __MESC__.
...
* lib/mes/ntoab.c (ntoab): Use __mesabi_uldiv only on __MESC__.
2019-06-14 17:45:32 +02:00
Danny Milosavljevic
a63b0bae44
ntoab: Include "assert.h".
...
* lib/mes/ntoab.c: #include "assert.h".
2019-06-14 01:27:15 +02:00
Danny Milosavljevic
c35124ab54
mescc: Mes C Library: Use __mesabi_uldiv.
...
* lib/mes/ntoab.c (ntoab): Use __mesabi_uldiv.
2019-06-14 01:02:40 +02:00