Jan (janneke) Nieuwenhuizen
bc1fa57851
lib: stat: Use SYS_stat64 for 32bit platforms.
...
This fixes <https://debbugs.gnu.org/41264 >.
* include/linux/arm/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/linux/x86/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/sys/stat.h (struct stat): Move definition to...
* include/linux/arm/kernel-stat.h,
include/linux/m2/kernel-stat.h,
include/linux/x86/kernel-stat.h,
include/linux/x86_64/kernel-stat.h: These new files.
* include/gnu/x86/kernel-stat.h: New file.
* configure (main): Copy <srcdest>include/<kernel>/<arch>/*.h to
include/.
* configure.sh: Likewise.
* .gitignore: Ignore them. Add copyright header.
* build-aux/GNUmakefile.in (X86_ARCH_HEADERS, ARCH_HEADERS): New
variables.
(build): Use them.
(include/arch/%.h, arch-dir): New targets.
* build-aux/bootstrap.sh.in (AM_CPPFLAGS): Replace
<srcdest>include/<kernel>/<cpu> with built ../include.
* build-aux/build.sh.in (AM_CPPFLAGS): Likewise.
* build-aux/install.sh.in: Also install built include.
* include/m2/types.h: New file.
* kaem.run: Use it.
* simple.sh: Copy kernel-stat.h, syscall.h for kernel/cpu to
include/arch.
2022-10-29 13:17:58 +02:00
Jan (janneke) Nieuwenhuizen
25e0c4d119
lib: __assert_fail: Update to standard.
...
* lib/mes/__assert_fail.c (__assert_fail): Add file, line, function
parameters.
* include/assert.h (assert): Update caller.
(__assert_fail): Update prototype.
* include/mes/lib.h (__assert_fail): Likewise.
* lib/mes/assert_msg.c (assert_msg): Likewise. Include assert.h.
2022-10-26 21:14:05 +02:00
Jan (janneke) Nieuwenhuizen
84fd995f43
time.c: include sys/time for gettimeofday.
...
* lib/linux/time.c: Include <sys/time.h>.
2022-05-05 23:26:46 +02:00
Jan (janneke) Nieuwenhuizen
77602c2cde
lib: linux/time: Remove SYS_time specialization.
...
* lib/linux/time.c (time)[SYS_time]: Remove specialization.
[!SYS_time && !SYS_gettimeofday]: Remove fallback.
2022-05-04 14:14:51 +02:00
Ekaitz Zarraga
761420ac31
mescc: Add X86_64 assembly defines for TinyCC compilation.
...
* lib/x86_64-mes/x86_64.M1 ( mov____%si,(%rdi), mov____%sil,(%rdi),
mov____(%rax),%si, mov____(%rax),%sil): New defines.
2022-09-21 09:43:43 +02:00
Jan (janneke) Nieuwenhuizen
074fa78f5e
lib/test: Cater for gcc-12.2.0.
...
These inexplicably avoid segfaults with gcc-12.2.0.
* lib/tests/posix/50-open-read.c (main)[__GNUC__ > 11]: Use malloc
instead of local allocated string.
* lib/tests/scaffold/7i-struct-struct.c (main)[__GNUC__ > 11]:
Initialize all fields of struct.
* lib/tests/scaffold/t.c (main): Likewise.
2022-09-15 13:56:38 +02:00
Rick Masters
fdac9fd3f2
lib: abtol: Fix number digits in hex number conversion.
...
After a letter based digit, number based digits are off.
* lib/mes/abtol.c (abtol): Reset "m" for number based digit.
* lib/tests/stdlib/70-strtoull.c (main): Test it.
* lib/tests/stdlib/90-strtol.c (main): Likewise.
2022-10-07 11:59:57 +02:00
Jan (janneke) Nieuwenhuizen
eee5398f3b
ARM: Fix unsigned modulo.
...
* lib/arm-mes/arm.M1 (mov____%esp,%r3): New macro.
* module/mescc/armv4/as.scm (armv4:r0%r1): Use it to avoid overwriting
%r0 before caling __mesabi_uldiv.
2022-09-12 09:47:28 +02:00
Jan (janneke) Nieuwenhuizen
dbec0c3845
test: Add 60-math-modulo.c.
...
* lib/tests/scaffold/60-math-modulo.c: New test.
* build-aux/check-mescc.sh (mes_tests): Add it.
2022-09-11 23:34:20 +02:00
Jan (janneke) Nieuwenhuizen
e64d763ccd
ARM: ntoab: Do not include __mesabi_uldiv for bootstrap tcc.
...
* lib/mes/ntoab.c (__mesabi_uldiv): Exclude for tinycc arm bootstrap.
2022-09-13 19:12:31 +02:00
Jan (janneke) Nieuwenhuizen
d1297688a8
ARM: build: Cater for M2-Planet.
...
* include/linux/arm/syscall.h: Add support for M2-Planet.
* lib/linux/arm-mes-m2/_exit.c,
lib/linux/arm-mes-m2/_write.c,
lib/linux/arm-mes-m2/crt1.M1,
lib/linux/arm-mes-m2/crt1.c,
lib/linux/arm-mes-m2/syscall.c,
lib/m2/arm/ELF-arm.hex2,
lib/m2/arm/arm_defs.M1: New files.
* build-aux/build.sh.in: Also allow kaem build for ARM.
2022-04-30 22:51:42 +02:00
Jan (janneke) Nieuwenhuizen
c45bd1bdd6
Mes C Library: memchr: Avoid compile warning.
...
* lib/string/memchr.c (memchr): Cast return to void*.
2022-04-30 16:40:57 +02:00
Jan (janneke) Nieuwenhuizen
9c2ba4829c
Revert "Mes C Library: m2/execve.c: Remove specialization."
...
This fixes
gcc-lib/libc+gnu.c: At top level:
gcc-lib/libc+gnu.c:2694:1: error: conflicting types for ‘execve’
execve (char const *file_name, char **argv, char **env)
^~~~~~
In file included from gcc-lib/libc+gnu.c:492:0:
include/unistd.h:66:5: note: previous declaration of ‘execve’ was here
int execve (char const *file, char *const argv[], char *const env[]);
^~~~~~
This reverts commit 828c27a073896facdc3a3b24265ee69f0033f58f.
2021-01-02 10:00:35 +01:00
Jan (janneke) Nieuwenhuizen
99fbb9b2e5
bootstrap: Update M2-Planet x86 definitions from 1.7.0-31-g358b6cf.
...
* lib/m2/x86/x86_defs.M1: Update.
2021-01-01 19:07:22 +01:00
Jan (janneke) Nieuwenhuizen
c881e18dae
Revert "Mes C Library: m2/getcwd.c: Remove specialization."
...
This reverts commit 37f44ce9453ef5589b1336c981360de16c154999.
2021-01-01 15:54:13 +01:00
Jan (janneke) Nieuwenhuizen
b23c6885a6
core: Move __getcwd_buf to Mes C Library.
...
* include/mes/mes.h (__getcwd_buf): Move to..
* lib/posix/getcwd.c (__getcwd_buf): ...here.
(getcwd): Refactor.
* src/posix.c (getcwd_): Do not use __getcwd_buf.
2021-01-01 15:43:43 +01:00
Jan (janneke) Nieuwenhuizen
0d337be8ff
bootstrap: Support building with M2-Planet 1.4.
...
* lib/m2/x86/x86_defs.M1 (NOP): New define.
2021-01-01 11:40:51 +01:00
Jan (janneke) Nieuwenhuizen
96e6ecaf7d
core: Add abort.
...
* lib/stub/__raise.c: New file.
* kaem.run: Use it.
* src/posix.c (__raise)[SYSTEM_LIBC]: New macro.
(abort_): New function: possibly use it.
* include/mes/builtins.h: Declare it.
* src/builtins.c (mes_builtins): Register it.
2019-11-10 16:04:25 +01:00
Jan (janneke) Nieuwenhuizen
d984618a48
Mes C Library: m2/execve.c: Remove specialization.
...
* lib/linux/execve.c (execve): Cater for M2-Planet.
* lib/m2/execve.c: Remove.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES): Likewise.
2020-12-29 19:13:02 +01:00
Jan (janneke) Nieuwenhuizen
f07856de0f
Mes C Library: m2/getcwd.c: Remove specialization.
...
* lib/posix/getcwd.c (getcwd): Cater for M2-Planet.
* lib/m2/getcwd.c: Remove.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES): Likewise.
2020-12-29 18:52:37 +01:00
Jan (janneke) Nieuwenhuizen
fca14d27ad
Mes C Library: m2/ioctl.c: Remove specialization.
...
* lib/stub/ioctl.c (ioctl3): Move to...
* lib/stub/ioctl3.c: ...new file.
* lib/m2/ioctl3.c: Move to...
* lib/linux/ioctl3.c: ...here.
* include/mes/lib.h (ioctl3): Declare it.
* lib/m2/isatty.c (isatty): Use it.
* build-aux/configure-lib.sh (libc_SOURCES): Include it; move
lib/linux/ioctl.c to ...
(libc_gnu_SOURCES): ... here.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES): Likewise.
* simple.sh (compiler): Likewise.
2020-12-29 18:41:45 +01:00
Jan (janneke) Nieuwenhuizen
a4e56aac56
Mes C Library: m2/ntoab.c: Remove specialization.
...
* lib/mes/ntoab.c (__mesabi_uldiv)[__M2_PLANET__ || !(__MESC__ &&
__arm__)]: New function.
* lib/mes/ntoab.c (ntoab): Use it to cater for M2-Planet.
* lib/m2/ntoab.c: Remove.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES, (M2_TODO): Likewise.
2020-12-29 15:39:33 +01:00
Jan (janneke) Nieuwenhuizen
41c126759e
mescc: Mes C Library: Prepare for M2-Planet 1.7.0.
...
* lib/m2/ntoab.c (ntoab): Declare variables at toplevel.
* lib/mes/abtol.c (abtol): Likewise.
* lib/posix/getenv.c (getenv): Likewise.
* lib/posix/setenv.c (setenv): Likewise.
2020-12-29 13:37:20 +01:00
Jan (janneke) Nieuwenhuizen
74d7d097e4
mescc: Mes C Library: isatty: Use fixed array size for M2-Planet.
...
* lib/m2/isatty.c (struct ktermios)[c_cc]: Hardcode to size 19.
2020-12-29 13:34:24 +01:00
Jan (janneke) Nieuwenhuizen
a87e014ed6
mescc: Mes C Library: Update M2-Planet macros.
...
* lib/m2/x86/x86_defs.M1: Update from M2-Planet 1.7.0.
2020-12-29 13:33:12 +01:00
Jan (janneke) Nieuwenhuizen
d06a13aee4
guix: Update M2-Planet to 1fc2aeab483208bd2ba117b21df3894c182470ec.
...
* guix/git/mes.scm (m2-planet): Update to 1fc2aeab483208bd2ba117b21df3894c182470ec.
(native-inputs): Add gcc-toolchain-7.
* lib/m2/x86/x86_defs.M1: Update from M2-Planet.
2020-10-18 23:29:15 +02:00
Jan (janneke) Nieuwenhuizen
8f2bc16e7a
core: Use casting functions.
...
Silence all casting errors by using casting functions.
* src/cc.c (cast_charp_to_scmp, cast_charp_to_scmpp,
cast_voidp_to_charp, cast_scmp_to_long, cast_scmp_to_charp): New function.
* src/m2.c (cast_charp_to_scmp, cast_charp_to_scmpp,
cast_voidp_to_charp, cast_scmp_to_long, cast_scmp_to_charp): New function.
* include/mes/mes.h: Declare them.
(struct scm): Add car_value, cdr_value, function.
(g_continuations): Change to long.
* src/mes.c: Silence all casting errors by using casting functions.
2020-10-18 15:44:49 +02:00
Jan (janneke) Nieuwenhuizen
ca8e9f0342
mescc: Mes C Library: Use casting functions.
...
Silence all casting errors by using casting functions.
* lib/mes/cast.c: New file.
* build-aux/configure-lib.sh (libmes_SOURCES): Add it.
* lib/m2/cast.c: New file.
* kaem.run: Add it.
* simple.make: Add them both.
* include/mes/lib.h: Add cast prototypes.
* include/m2/lib.h: Likewise.
* lib/linux/_getcwd.c (_getcwd): Use them.
* lib/linux/access.c (access): Likewise.
* lib/linux/brk.c (brk): Likewise.
* lib/linux/chmod.c (chmod): Likewise.
* lib/linux/clock_gettime.c (clock_gettime): Likewise.
* lib/linux/gettimeofday.c (gettimeofday): Likewise.
* lib/linux/unlink.c (unlink): Likewise.
* lib/mes/fdputc.c (fdputc): Likewise.
* lib/stdio/putchar.c (putchar): Likewise.
* lib/linux/malloc.c (malloc): Likewise.
2020-10-18 14:55:24 +02:00
Jan (janneke) Nieuwenhuizen
c58049d48d
mescc: Mes C Library: Add waitpid for M2-Planet.
...
* lib/m2/waitpid.c: New file.
2020-07-25 20:05:29 +02:00
Jan (janneke) Nieuwenhuizen
e103008c2e
mescc: Mes C Library: Add time for M2-Planet.
...
* lib/m2/time.c: New file.
2020-07-25 20:05:19 +02:00
Jan (janneke) Nieuwenhuizen
e25edc22f7
mescc: Mes C Library: Add ntoab for M2-Planet.
...
* lib/m2/ntoab.c: New file.
2020-07-25 20:04:35 +02:00
Jan (janneke) Nieuwenhuizen
d51c166364
mescc: Mes C Library: Add isatty for M2-Planet.
...
* lib/m2/isatty.c: New file.
2020-07-25 20:04:27 +02:00
Jan (janneke) Nieuwenhuizen
232d69befb
mescc: Mes C Library: Add ioctl for M2-Planet.
...
* lib/m2/ioctl.c: New file.
2020-07-25 20:04:19 +02:00
Jan (janneke) Nieuwenhuizen
38b14b20bf
mescc: Mes C Library: Add getcwd for M2-Planet.
...
* lib/m2/getcwd.c: New file.
2020-07-25 20:04:07 +02:00
Jan (janneke) Nieuwenhuizen
e1175b49ea
mescc: Mes C Library: Add exit for M2-Planet.
...
* lib/m2/exit.c: New file.
2020-07-25 20:03:58 +02:00
Jan (janneke) Nieuwenhuizen
f5f65a0c96
mescc: Mes C Library: Add execve for M2-Planet.
...
* lib/m2/execve.c: New file.
2020-07-25 20:03:47 +02:00
Jan (janneke) Nieuwenhuizen
8ebae4213e
mescc: Mes C Library: Add execv for M2-Planet.
...
* lib/m2/execv.c: New file.
2020-07-25 20:03:30 +02:00
Jan (janneke) Nieuwenhuizen
ec79b8a0ae
mescc: Mes C Library: Add clock_gettime for M2-Planet.
...
* lib/m2/clock_gettime.c: New file.
2020-07-25 20:03:17 +02:00
Jan (janneke) Nieuwenhuizen
67f0dc8ec4
mescc: Mes C Library: Add chmod for M2-Planet.
...
* lib/m2/chmod.c: New file.
2020-07-25 20:03:06 +02:00
Jan (janneke) Nieuwenhuizen
c94ac66095
mescc: Mes C Library: Prepare for M2-Planet: realloc.
...
* lib/stdlib/realloc.c (realloc): Prepare for M2-Planet.
2020-07-25 19:56:16 +02:00
Jan (janneke) Nieuwenhuizen
dbbc04172c
mescc: Mes C Library: Prepare for M2-Planet: fdputc.
...
* lib/mes/fdputc.c (fdputc): Prepare for M2-Planet.
2020-07-25 19:55:21 +02:00
Jan (janneke) Nieuwenhuizen
d7d3d398eb
mescc: Mes C Library: Prepare for M2-Planet: unlink.
...
* lib/linux/unlink.c (unlink): Prepare for M2-Planet.
2020-07-25 19:54:49 +02:00
Jan (janneke) Nieuwenhuizen
8aedfd8f5f
mescc: Mes C Library: Prepare for M2-Planet: read.
...
* lib/linux/read.c (read): Prepare for M2-Planet.
2020-07-25 19:54:40 +02:00
Jan (janneke) Nieuwenhuizen
eb28518a35
mescc: Mes C Library: Prepare for M2-Planet: gettimeofday.
...
* lib/linux/gettimeofday.c (gettimeofday): Prepare for M2-Planet.
2020-07-25 19:54:28 +02:00
Jan (janneke) Nieuwenhuizen
40f46eeb04
mescc: Mes C Library: Prepare for M2-Planet: dup2.
...
* lib/linux/dup2.c (dup2): Prepare for M2-Planet.
2020-07-25 19:54:16 +02:00
Jan (janneke) Nieuwenhuizen
4c6c73468a
mescc: Mes C Library: Prepare for M2-Planet: dup.
...
* lib/linux/dup.c (dup): Prepare for M2-Planet.
2020-07-25 19:54:02 +02:00
Jan (janneke) Nieuwenhuizen
4cef964aba
mescc: Mes C Library: Prepare for M2-Planet: clock_gettime.
...
* lib/linux/clock_gettime.c (clock_gettime): Prepare for M2-Planet.
2020-07-25 19:53:48 +02:00
Jan (janneke) Nieuwenhuizen
edb2e5c142
mescc: Mes C Library: Prepare for M2-Planet: chmod.
...
* lib/linux/chmod.c (chmod): Prepare for M2-Planet.
2020-07-25 19:53:37 +02:00
Jan (janneke) Nieuwenhuizen
1273e19587
mescc: Mes C Library: Prepare for M2-Planet: access.
...
* lib/linux/access.c (access): Prepare for M2-Planet.
2020-07-25 19:53:20 +02:00
Jan (janneke) Nieuwenhuizen
442cef4c12
mescc: Mes C Library: Prepare for M2-Planet: _getcwd.
...
* lib/linux/_getcwd.c (_getcwd): Prepare for M2-Planet.
2020-07-25 19:52:33 +02:00