Commit graph

476 commits

Author SHA1 Message Date
Ekaitz Zarraga 5d6041b780 DRAFT test: 16-cast.c: Fix for riscv64.
RISC-V64 has `unsigned char` for `char`, so it failed to build. In amd64
`char` is `signed char`, so the code wasn't portable. We have to be
explicit about the sign of the `char`.

* lib/test/scaffold/16-cast.c: Add `signed` to `char`.
2023-11-05 09:45:31 +01:00
Ekaitz Zarraga 90a1684b89 lib: Add setjmp/longjmp for riscv64.
Note about the -tcc file:

    HAVE_FLOAT_ASM defines if there's assembly support for float
    instructions.

    HAVE_FLOAT defines if there's floating point arithmetic support.

    This is important for TinyCC because the assembler and the C
    compiler are split. TinyCC can HAVE_FLOAT but no assembler support
    for them.

* lib/riscv64-mes-gcc/setjmp.c,
lib/riscv64-mes-tcc/setjmp.c: New files.
2023-11-05 09:45:31 +01:00
Andrius Štikonas f49689d31a DRAFT riscv64: Fix arguments of main function in tcc.
* lib/linux/riscv64-mes-tcc/crt1.c

Co-authored-by: Ekaitz Zarraga <ekaitz@elenq.tech>.
2023-11-05 09:45:31 +01:00
Andrius Štikonas 958da104e5 DRAFT riscv64: simplify assembly constructs not supported by tcc.
At the moment tcc does not support assembler instructions
with C expression operands. As a workaround read values
directly from stack.

* lib/linux/riscv64-mes-tcc/_exit.c
* lib/linux/riscv64-mes-tcc/_write.c
* lib/linux/riscv64-mes-tcc/syscall.c
2023-11-05 09:45:31 +01:00
Ekaitz Zarraga 10054b2f17 riscv64: add support for tcc
Adapted from -gcc but make assembly match tcc style assembly where the
offsets are received as an extra input argument:

  sw a0, 9(t0)

Becomes:

  sw a0, t0, 9

* lib/linux/riscv64-mes-tcc/_exit.c,
lib/linux/riscv64-mes-tcc/_write.c,
lib/linux/riscv64-mes-tcc/crt1.c,
lib/linux/riscv64-mes-tcc/exit-42.S,
lib/linux/riscv64-mes-tcc/hello-mes.S,
lib/linux/riscv64-mes-tcc/syscall-internal.c,
lib/linux/riscv64-mes-tcc/syscall.c: New files.
2023-11-05 09:45:31 +01:00
Ekaitz Zarraga 85f97b6881 lib/tests: 44-switch-body-fallthrough-not-default.c: Add test.
This test detects if the fallthrough in a switch statement falls to the
next case (good) or to the default case (bad).

* lib/tests/scaffold/44-switch-body-fallthrough-not-default.c: New file.
* build-aux/check-mescc.sh (mes_tests): Add it.
2023-11-05 09:45:31 +01:00
Ekaitz Zarraga 72ec66bd86 lib/tests: 50-compare-rotated-weird.c: Add test for RV reloc
We detected the value in off64 in the test is not -1 as it should but 56
ones. This is because the rotation is applied as unsigned even with the
signed cast. This breaks many things in tcc.

* lib/tests/scaffold/50-compare-rotated-weird.c: New file.
* build-aux/check-mescc.sh (mes_tests): Add it.
2023-11-05 09:45:31 +01:00
Ekaitz Zarraga 63beaa3dfe mescc: Add support for signed rotation.
* module/mescc/compile.scm (expr->register)[rshift, assn-expr]: Add
signed right-rotation support.
* lib/arm-mes/arm.M1 (asr): Add instruction.
* lib/x86-mes/x86.M1 (sar): Add instruction.
* lib/x86_64-mes/x86_64.M1 (sar): Add instruction.
* module/mescc/armv4/as.scm (armv4:r0>>r1-signed): New procedure.
(armv4:instructions): Register it.
* module/mescc/i386/as.scm (i386:r0>>r1-signed): New procedure.
(i386:instructions): Register it.
* module/mescc/riscv64/as.scm (riscv64:r0>>r1-signed): New procedure.
(riscv64:instructions): Register it.
* module/mescc/x86_64/as.scm (x86_64:r0>>r1-signed): New procedure.
(x86_64:instructions): Register it.
(
2023-11-05 09:45:31 +01:00
Ekaitz Zarraga a99a274992 lib: Make objdump work on binaries in riscv64
* lib/linux/riscv64-mes/elf32-header.hex2: Fix header sizes for objdump.
2023-11-05 09:45:31 +01:00
Janneke Nieuwenhuizen 4a0bb97d70 Revert "crt1: Move main declaration to mes/lib-mini.h."
This reverts commit 5b55627e0ccf7c798284a380a20a2eb4d6b9c4c0.
2023-11-05 09:45:31 +01:00
Janneke Nieuwenhuizen ad6c02076f crt1: Move main declaration to mes/lib-mini.h.
* include/mes/lib-mini.h (main): New declaration.
lib/freebsd/x86-mes-gcc/crt1.c (main): Remove declaration.
lib/freebsd/x86-mes-mescc/crt1.c (main): Remove declaration.
lib/gnu/x86-mes-gcc/crt1.c (main): Remove declaration.
lib/linux/arm-mes-gcc/crt1.c (main): Remove declaration.
lib/linux/arm-mes-m2/crt1.c (main): Remove declaration.
lib/linux/arm-mes-mescc/crt1.c (main): Remove declaration.
lib/linux/riscv64-mes-gcc/crt1.c (main): Remove declaration.
lib/linux/riscv64-mes-m2/crt1.c (main): Remove declaration.
lib/linux/riscv64-mes-mescc/crt1.c (main): Remove declaration.
lib/linux/x86-mes-gcc/crt1.c (main): Remove declaration.
lib/linux/x86-mes-m2/crt1.c (main): Remove declaration.
lib/linux/x86-mes-mescc/crt1.c (main): Remove declaration.
lib/linux/x86_64-mes-gcc/crt0.c (main): Remove declaration.
lib/linux/x86_64-mes-gcc/crt1.c (main): Remove declaration.
lib/linux/x86_64-mes-m2/crt1.c (main): Remove declaration.
lib/linux/x86_64-mes-mescc/crt1.c (main): Remove declaration.
2023-11-05 09:45:31 +01:00
Ekaitz Zarraga 1fb7ade93c mescc: Initialize missing struct fields to 0.
This is a follow-up to commits
    7a8a2fc517
    mescc: x86_64 support: Refactor to abstracted assembly, add x86_64.

and

    c9ba7a619b
    mescc: Refactor variable declaration.

There was a debug "22" leaking in compile.scm.  It should be a "0".

* module/mescc/compile.scm (init-local): Replace "22" with "0".
* lib/tests/scaffold/7v-struct-initialize-zeroes.c: New test.
* build-aux/check-mescc.sh (tcc_tests): Add it.
(xfail-tests): Remove lib/tests/scaffold/72-typedef-struct-def-local.c.
2023-11-05 09:40:38 +01:00
Janneke Nieuwenhuizen 0637c13c72 lib/tests: 76-pointer-arithmetic: Cater for RISC-V64.
* lib/tests/scaffold/76-pointer-arithmetic.c (struct
foo)[__riscv_xlen==64]: Add __align.
2023-11-05 09:40:38 +01:00
Andrius Štikonas 16f4fc3263 riscv64: Port to word based mescc-tools.
* module/mescc/M1.scm (riscv:i-format, riscv:j-format, riscv:u-format):
New procedures for RISC-V instruction formats.
(info->M1): Use them to switch from !0xAB to M1
weird strings 'AB'.
* module/mescc/riscv64/as.scm,
lib/linux/riscv64-mes-m2/_exit.c
ib/linux/riscv64-mes-m2/_write.c,.
lib/linux/riscv64-mes-m2/crt1.M1,.
lib/linux/riscv64-mes-m2/syscall.c,.
lib/linux/riscv64-mes-mescc/_exit.c,.
lib/linux/riscv64-mes-mescc/_write.c,.
lib/linux/riscv64-mes-mescc/crt1.c,.
lib/linux/riscv64-mes-mescc/syscall-internal.c,.
lib/linux/riscv64-mes-mescc/syscall.c,.
lib/m2/riscv64/riscv64_defs.M1,.
lib/riscv64-mes-mescc/setjmp.c,.
lib/riscv64-mes/riscv64.M1: Switch to riscv64 word-based macros.
* lib/linux/open.c (open)[!SYS_open]: Add support using openat syscall.
* include/linux/riscv64/syscall.h (MAKESTRING, MAKESTRING2,
RISCV_SYSCALL): New macros.
2023-11-05 09:40:38 +01:00
Janneke Nieuwenhuizen f2009e70f9 gnu: Update main prototype.
* lib/gnu/x86-mes-gcc/crt1.c (main): Add parameters.
2023-11-05 09:40:37 +01:00
Janneke Nieuwenhuizen aa97000027 riscv64: lib: Use __init_io.
* lib/linux/riscv64-mes-gcc/crt1.c (_start): Replace manual initialization
of __stdin, __stdout, __stderr, and environ with __init_io ().
* lib/linux/riscv64-mes-mescc/crt1.c (_start): Likewise.
2023-11-05 09:40:37 +01:00
Janneke Nieuwenhuizen 368ddbcd4f arm: lib: Use __init_io.
* lib/linux/arm-mes-gcc/crt1.c (_start): Replace manual initialization
of __stdin, __stdout, __stderr, and environ with __init_io ().
* lib/linux/arm-mes-m2/crt1.M1 (_start): Likewise.
* lib/linux/arm-mes-mescc/crt1.c (_start): Likewise.
2023-11-05 09:40:37 +01:00
Janneke Nieuwenhuizen 3502ad4f73 freebsd: lib: Use __init_io.
* * lib/freebsd/x86-mes-gcc/crt1.c (_start): Replace manual initialization
of __stdin, __stdout, __stderr, and environ with __init_io ().
* lib/freebsd/x86-mes-mescc/crt1.c (_start): Likewise.
* lib/freebsd/x86-mes-gcc/_write.c (SYS_exit): Remove.
(SYS_write): New define.
2023-11-05 09:40:37 +01:00
Janneke Nieuwenhuizen 88eb90dd38 x86_64: lib: Use __init_io.
* lib/linux/x86_64-mes-gcc/crt1.c (_start): Replace manual initialization
of __stdin, __stdout, __stderr, and environ with __init_io ().
* lib/linux/x86_64-mes-m2/crt1.M1 (_start): Likewise.
* lib/linux/x86_64-mes-mescc/crt1.c (_start): Likewise.
2023-11-05 09:40:37 +01:00
Janneke Nieuwenhuizen 1e898ea312 x86: lib: Use __init_io.
* build-aux/configure-lib.sh (libc_mini_shared_SOURCES): Add init_io.c.
* include/mes/lib-mini.h (__init_io): Declare it.
* lib/linux/x86-mes-gcc/crt1.c (_start): Replace manual initialization
of __stdin, __stdout, __stderr, and environ with __init_io ().
* lib/linux/x86-mes-m2/crt1.M1 (_start): Likewise.
* lib/linux/x86-mes-mescc/crt1.c (_start): Likewise.
2023-11-05 09:40:37 +01:00
Jan (janneke) Nieuwenhuizen 141688a865 riscv64: Cater for M2-Planet.
* kaem.riscv64: New file.

* lib/linux/riscv64-mes-m2/crt1.M1,
lib/m2/riscv64/ELF-riscv64.hex2,
lib/m2/riscv64/riscv64_defs.M1: New files, imported from M2Lib.c
* lib/linux/riscv64-mes-m2/_exit.c,
lib/linux/riscv64-mes-m2/_write.c,
lib/linux/riscv64-mes-m2/crt1.c,
lib/linux/riscv64-mes-m2/syscall.c: New files, adapted for M2-Planet
calling convention from ...
* lib/linux/riscv64-mes-mescc: ...here
* kaem.run: Move fcntl.h up.  Include signal.h.
* build-aux/build.sh.in: Also allow kaem build for riscv64.
2023-11-05 09:40:37 +01:00
W. J. van der Laan a1bc54bce8 lib: Linux riscv64-mes-mescc support.
* lib/linux/riscv64-mes-mescc/_exit.c,
lib/linux/riscv64-mes-mescc/_write.c,
lib/linux/riscv64-mes-mescc/crt1.c,
lib/linux/riscv64-mes-mescc/syscall-internal.c,
lib/linux/riscv64-mes-mescc/syscall.c: New files.  These add support for
building for riscv64-mes-mescc and make it self-hosting.
2023-11-05 09:40:37 +01:00
W. J. van der Laan e7aac5e8ba lib: Base riscv64-mes-mescc support.
* lib/riscv64-mes-mescc/setjmp.c: New file.
(setjmp, longjmp): Implement for RV64.
2023-11-05 09:40:37 +01:00
W. J. van der Laan 8f0cb67078 lib: Add RISCV64 instruction macros for M1.
* lib/riscv64-mes/riscv64.M1: New file.  Add set of instruction macros
for RV64.  These are all potentially needed by the code generation.  I
have made no effort yet to minimize the list of instructions for mes+tcc
compile.
2023-11-05 09:40:37 +01:00
W. J. van der Laan 9d7360cca6 lib/tests: Take RISC-V into account in size conditionals.
* lib/tests/scaffold/76-pointer-arithmetic.c (main): Use the right sizes
in the test for RISC-V architectures.
* lib/tests/scaffold/7k-for-each-elem.c (main): Same.
* lib/tests/scaffold/85-sizeof.c: Same.
2023-11-05 09:39:29 +01:00
W. J. van der Laan 04e6fdad13 lib: General Linux RISC-V64 syscall support.
* include/linux/riscv32/kernel-stat.h,
include/linux/riscv64/kernel-stat.h: New files.
* include/fcntl.h (AT_FDCWD, AT_SYMLINK_NOFOLLOW, AT_REMOVEDIR): Add
necessary constants.
* include/stdint.h: Integer size defines for RISC-V.
* include/sys/stat.h: "stat" struct for RISC-V.
* lib/linux/_open3.c (_open3)[!SYS_open]: Use SYS_openat.
* lib/linux/access.c (access)[!SYS_access]: Use SYS_faccessat.
* lib/linux/chmod.c (chmod)[!SYS_chmod]: Use SYS_fchmodat.
* lib/linux/dup2.c (dup2)[!SYS_dup2]: Use if SYS_dup3.
* lib/linux/fork.c (fork)[!SYS_fork]: Use SYS_clone.
* lib/linux/getdents.c (getdents)[!SYS_getdents]: Use SYS_getdents64.
* lib/linux/link.c (link)[!SYS_link]: Use SYS_linkat.
* lib/linux/lstat.c (lstat)[!SYS_lstat]: Use SYS_newfstatat.
* lib/linux/mkdir.c (mkdir)[!SYS_mkdir]: Use SYS_mkdirat.
* lib/linux/mknod.c (mknod)[!SYS_mknod]: Use SYS_mknodat.
* lib/linux/pipe.c (pipe)[!SYS_pipe]: Use SYS_pipe2.
* lib/linux/readlink.c (readlink)[!SYS_readlinkat]: Use SYS_readlinkat.
* lib/linux/rename.c (rename)[!SYS_rename]: Use SYS_renameat2.
* lib/linux/rmdir.c (rmdir)[!SYS_rmdir]: Use SYS_unlinkat.
* lib/linux/signal.c (_restorer_for_siginfo): Remove unused function
that causes compilation issue.
* lib/linux/stat.c (stat)[!SYS_stat]: Use SYS_newfstatat.
* lib/linux/symlink.c (symlink)[!SYS_symlinkat]: Use SYS_symlink.
* lib/linux/unlink.c (unlink)[!SYS_unlink]: Use SYS_unlinkat.
2023-11-05 09:39:29 +01:00
W. J. van der Laan e07d1052aa lib: Add _sys_call_5 for Linux RISC-V64.
* include/linux/syscall.h (_sys_call5): Declare 5-argument syscall needed
for SYS_renameat2, currently only used on RISC-V64.
* lib/linux/riscv64-mes-gcc/syscall.c (__sys_call5, _sys_call5):
Implement it.
2023-11-05 09:39:29 +01:00
W. J. van der Laan f5d6a7b100 lib: Linux riscv64-mes-gcc support.
* lib/linux/riscv64-mes-gcc/_exit.c,
lib/linux/riscv64-mes-gcc/_write.c,
lib/linux/riscv64-mes-gcc/crt1.c,
lib/linux/riscv64-mes-gcc/syscall-internal.c,
lib/linux/riscv64-mes-gcc/syscall.c: New files to make it possible
to compile mes for riscv64-mes-gcc.
2023-11-05 09:39:29 +01:00
W. J. van der Laan 6051a6e91e lib: Base riscv64-mes-gcc support (dummy setjmp).
* lib/riscv64-mes-gcc/setjmp.c: New file.
(setjmp, longjmp): Add dummy implementations. Implementing these for gcc
would be very involved, and does not seem necessary to get mescc to
work.
2023-11-05 09:39:29 +01:00
W. J. van der Laan 2848cf6a18 lib: Make Linux scaffold work for RISC-V64.
* lib/linux/riscv64-mes-gcc/exit-42.S,
lib/linux/riscv64-mes-gcc/hello-mes.S,
lib/linux/riscv64-mes/elf64-0exit-42.hex2,
lib/linux/riscv64-mes/elf64-0header.hex2,
lib/linux/riscv64-mes/elf64-0hello-mes.hex2,
lib/linux/riscv64-mes/elf64-body-exit-42.hex2,
lib/linux/riscv64-mes/elf64-body-hello-mes.hex2,
lib/linux/riscv64-mes/elf64-footer-single-main.hex2,
lib/linux/riscv64-mes/elf64-header.hex2: New files.  Makes basic
scaffold pass on RISC-V64.
2023-11-05 09:39:29 +01:00
Ekaitz Zarraga acfead04ed DRAFT lib: Make objdump work on binaries in x86-linux.
* lib/linux/x86-mes/elf32-header.hex2: Fix header sizes for objdump.
2023-11-05 09:39:06 +01:00
Ekaitz Zarraga 1120073d8d DRAFT lib: Make objdump work on binaries in x86_64-linux.
* lib/linux/x86_64-mes/elf64-header.hex2: Fix header sizes for objdump.
2023-11-05 09:39:00 +01:00
Janneke Nieuwenhuizen 83f26445b0 DRAFT test: Add 68-truncate-shift.
* lib/tests/scaffold/68-truncate-shift.c: New file.
* build-aux/check-mescc.sh (mes_tests): Add it.
2023-11-05 09:38:57 +01:00
Andrius Štikonas 05e945c0a8 mescc: Do not overflow M1 64bit immediates.
M1 immediates are limited to 31-bit before they become negative.

* module/mescc/x86_64/as.scm (x86_64:value->r, x86_64:r-cmp-value,
x86_64:r-long-mem-add, x86_64:r-and): Limit M1 immediate to #x80000000.

* lib/tests/scaffold/67-m1-overflow-check.c: New test.
* build-aux/check-mescc.sh (mes_tests): Add it.
2023-11-05 09:36:26 +01:00
Andrius Štikonas 1650f0caae lib: Fix x86_64 M2 elf header to work with debug info.
* lib/m2/x86_64/ELF-x86_64.hex2: Fix e_shoff, e_shentsize, e_shstrndx.
2023-11-05 09:36:26 +01:00
Janneke Nieuwenhuizen 73acbc37b1 m2: Add new style x86_64 defines to support M2-Planet 1.11.0.
* lib/m2/x86_64/x86_64_defs.M1: Add new M1 defines.
2023-11-05 09:36:26 +01:00
Jan (janneke) Nieuwenhuizen 189ea8eb9d x86_64: build: Cater for M2-Planet.
* build-aux/cflags.sh: Set cc_cpu.
* build-aux/config.sh.in (cc_cpu): Export.
* build-aux/export.make (cc_cpu): Likewise.
* kaem.arm (cc_cpu): New variable.
* kaem.x86 (cc_cpu): New variable.
* kaem.run (cc_cpu): New variable.  Define __<cc_cpu>__.
* scaffold/argv.kaem (cc_cpu): Likewise.  Define __linux__
* scaffold/global-array.kaem (cc_cpu): Likewise.
* scaffold/hello.kaem (cc_cpu): Likewise.
* scaffold/local-array.kaem (cc_cpu): Likewise.
* scaffold/local-static-array.kaem (cc_cpu): Likewise.
* scaffold/main.kaem (cc_cpu): Likewise.
* scaffold/read.kaem (cc_cpu): Likewise.
* kaem.x86_64: New file.
lib/m2/x86_64/ELF-x86_64.hex2,
lib/m2/x86_64/x86_64_defs.M1: New files, imported from M2Libc.
lib/linux/x86_64-mes-m2/_exit.c,
lib/linux/x86_64-mes-m2/_write.c,
lib/linux/x86_64-mes-m2/crt1.M1,
lib/linux/x86_64-mes-m2/crt1.c,
lib/linux/x86_64-mes-m2/syscall.c: New files, adapted for M2-Planet
calling convention from ...
* lib/linux/x86_64-mes-mescc: ... here.
* build-aux/build.sh.in: Also allow kaem build for x86_64.
* include/mes/lib-mini.h[__M2__]: Define as sizeof (void*).
* include/mes/mes.h[__M2__](M2_CELL_SIZE): Define as sizeof (struct scm).
* lib/x86_64-mes/x86_64.M1 (add____$i8,%rbp, mov____%rdi,%rbp): New
defines.
* src/posix.c (TIME_UNITS_PER_SECOND): Cater for 64bit M2-Planet.
2023-11-05 09:36:26 +01:00
Janneke Nieuwenhuizen 6aa77fe162 DRAFT lib: tests: 17-compare-unsigned-le: Add case from 7s-unsigned-compare.
* lib/tests/scaffold/17-compare-unsigned-le.c: Add case from
7s-unsigned-compare; rewrite to avoid gcc-optimize.
2023-11-05 09:36:11 +01:00
Janneke Nieuwenhuizen a0c9c0aedb DRAFT lib: tests: 17-compare-unsigned-short-le.c: Avoid gcc optimize.
* lib/tests/scaffold/17-compare-unsigned-short-le.c (main): Change
comparison with immediate to comparison with variable.
2023-11-05 09:36:11 +01:00
Janneke Nieuwenhuizen 0f0dad6436 DRAFT lib: tests: 17-compare-unsigned-char-le.c: Avoid gcc optimize.
* lib/tests/scaffold/17-compare-unsigned-char-le.c (main): Change
comparison with immediate to comparison with variable.
2023-11-05 09:36:11 +01:00
Ekaitz Zarraga 2be2de827f lib: tests: Add 17-compare-rotated.
* lib/tests/scaffold/17-compare-rotated.c: Add file.
* build-aux/check-mescc.sh (mes_tests): Add it.
2023-11-05 09:36:11 +01:00
Ekaitz Zarraga 4134285e8e lib: tests: Add 16-cast.
* lib/tests/scaffold/16-cast.c: Add file.
* build-aux/check-mescc.sh (mes_tests): Add it.
2023-11-05 09:36:11 +01:00
Janneke Nieuwenhuizen 96ad09dbfd lib: tests: 63-struct-cell: Avoid segfault by array overflow with gcc >= 10.
* lib/tests/scaffold/63-struct-cell.c (g_functions]: Use size 3.
2023-08-29 22:07:01 +02:00
Janneke Nieuwenhuizen ab9946d8ef lib/tests: Initialize local variable.
Reuported by Andrius Štikonas <andrius@stikonas.eu> via IRC.

* lib/tests/assert/50-assert.c (main): Initialize local f.
* lib/tests/scaffold/21-char-array.c (main): Likewise.
2023-07-08 15:10:05 +02:00
Andrius Štikonas 762200b65a m2: Add new style x86 defines to support M2-Planet 1.11.0.
* lib/m2/x86/x86_defs.M1: Add new M1 defines.
2023-05-03 08:04:32 +02:00
Jan (janneke) Nieuwenhuizen 640bdd027b lib: __assert_fail: Remove M2-Planet workarounds.
* lib/mes/__assert_fail.c (__assert_fail): Use *file, *function.
2023-05-03 08:04:32 +02:00
Jan (janneke) Nieuwenhuizen 6bc6e8354e lib: linux: Add wait4.
* lib/linux/waitpid.c (waitpid): Factor-out wait4 call to...
* lib/linux/wait4.c: ...new file here.
* include/sys/wait.h (wait4): Add prototype.  Include sys/resource.h.
* include/sys/resource.h (struct rusage): Remove gratuitous "int" for
M2-Planet.
* build-aux/configure-lib.sh (libc_SOURCES): Add it.
* kaem.run,
simple.make (M2_SOURCES),
simple.sh: Likewise.  Also add resource.h.
2023-05-03 08:04:32 +02:00
Jan (janneke) Nieuwenhuizen cbea14f843 core: Move M2_PTR_SIZE, M2_CELL_SIZE to include file.
* lib/posix/getenv.c (M2_PTR_SIZE),
lib/posix/setenv.c (M2_PTR_SIZE): Move definition...
* include/mes/lib-mini.h (M2_PTR_SIZE): ...here.
* src/gc.c (M2_CELL_SIZE),
src/symbol.c (M2_CELL_SIZE),
src/test/gc.c (M2_CELL_SIZE),
src/vector.c (M2_CELL_SIZE): Move definition...
* include/mes/mes.h (M2_CELL_SIZE): ...here.
2023-05-03 08:04:32 +02:00
Jan (janneke) Nieuwenhuizen dad460189f kaem.run: Remove --bootstrap-mode.
* include/linux/arm/syscall.h,
include/linux/x86/syscall.h,
include/mes/constants.h: Remove CONSTANTs.
* lib/m2/open.c: Move to...
* lib/linux/open.c: ...here.  Update to make gcc-compatible.
* scaffold/argv.kaem: Update accordingly.
* lib/linux/lseek.c (_leek, lseek): Suport M2-Planet.
* lib/linux/_open3.c (_open3): Fix cast.
* lib/linux/waitpid.c (waitpid): Suport M2-Planet.
* lib/m2/getcwd.c (PATH_MAX): Remove CONSTANT.
* lib/m2/isatty.c (TCGETS): Remove CONSTANT.
* lib/mes/ntoab.c: Support M2-Planet.
* lib/posix/getcwd.c (__getcwd_buf): Remove.
* lib/posix/getenv.c (M2_PTR_SIZE)[__M2__]: Update to #define.
* lib/posix/setenv.c: Likewise.
* lib/stub/__raise.c (SIGABRT): Remove CONSTANT.
* src/core.c (error): Use __M2__ instead of __M2_PLANET__.
* src/gc.c (M2_CELL_SIZE)[__M2__]: Update to #define.  Support
non-bootstrap-mode.
* src/symbol.c: Likewise.
* src/vector.c: Likewise.
* src/posix.c: Likewise.
(__raise): Move to...
* include/mes/lib-cc.h (__raise): ...this new file to avoid M2-Planet crash.
* include/sys/types.h: Include it.
* lib/mes/div.c (__raise): Remove prototype.
[__TINYC__ || SYSTEM_LIBC] (__raise): Remove macro.
* include/mes/lib.h (__raise)[SYSTEM_LIBC]: Remove prototype.
* kaem.run: Remove --botstrap-mode.  Update source list accordingly.
* simple.make (M2_PLANET_FLAGS): Remove --bootstrap-mode.
* simple.make (M2_SOURCES, M2_PLANET_INCLUDES): Update source list
accordingly.
* include/sys/types.h (EOF): Move to...
* include/mes/lib-cccc.h (EOF): ...here, and...
* include/m2/types.h (EOF): ...here, to avoid M2-Planet crash.
2023-05-03 08:03:48 +02:00
Jan (janneke) Nieuwenhuizen e354d912ef lib: posix/open: Support M2-Planet.
* lib/posix/open.c (open)[__M2__]: New function.
2023-05-02 10:22:45 +02:00