Commit Graph

2268 Commits

Author SHA1 Message Date
Jan (janneke) Nieuwenhuizen e5573ec23c
ARM: Add fake asm for syscall.c.
* lib/linux/arm-mes-gcc/syscall.c (__sys_call, __sys_call1, __sys_call2,
__sys_call3, __sys_call4) [__TINYC__]: Add fake asm.
2021-01-23 08:43:44 +01:00
Jan (janneke) Nieuwenhuizen 40f270f3d7
ARM: Add fake asm for mini.c.
* lib/linux/arm-mes-gcc/mini.c (_exit, _write)[__TINYC__]: Add fake asm.
2021-01-23 08:43:44 +01:00
Jan (janneke) Nieuwenhuizen 420d422e34
ARM: Add fake asm for crt1.c.
* lib/linux/arm-mes-gcc/crt1.c (_start)[__TINYC__]: Use fake asm.
2021-01-23 08:43:44 +01:00
Jan (janneke) Nieuwenhuizen ed59c243a8
mescc: Mes C Library: Support ARM tcc: Add crti.c, crtn.c.
* lib/linux/arm-mes-gcc/crti.c: New file.
* lib/linux/arm-mes-gcc/crtn.c: New file.
2021-01-23 08:43:44 +01:00
Jan (janneke) Nieuwenhuizen 5951148255
ARM: libtcc1: Add div.c, __memcpy, __memmove, __memset.
* build-aux/configure-lib.sh (libtcc1_SOURCES)[arm]: Add div.c,
__memcpy, __memmove, __memset.
* build-aux/build-source-lib.sh: Generate libtcc1.
2021-01-23 08:43:44 +01:00
Jan (janneke) Nieuwenhuizen e82a53a40f
mescc: Mes C Library: Support ARM tcc: Add __memset.
* lib/string/__memset.c: New file.
* include/mes/lib.h (__memset): Add prototype.
2021-01-23 08:43:43 +01:00
Jan (janneke) Nieuwenhuizen 82a2388db2
mescc: Mes C Library: Support ARM tcc: Add __memmove.
* lib/string/__memmove.c: New file.
* include/mes/lib.h (__memmove): Add prototype.
2021-01-23 08:43:43 +01:00
Jan (janneke) Nieuwenhuizen bebb8dabfb
mescc: Mes C Library: Support ARM tcc: Add __memcpy.
* lib/string/__memcpy.c: New file.
* include/mes/lib.h (__memcpy): Add prototype.
2021-01-23 08:43:43 +01:00
Jan (janneke) Nieuwenhuizen 6a9e9838f0
mescc: Mes C Library: abort: Avoid __raise for TinyCC.
* lib/stdlib/abort.c: Use "raise" instead of __raise.
2021-01-23 08:43:43 +01:00
Jan (janneke) Nieuwenhuizen b6cadb876f
doc: Update 'AUTHORS'.
* AUTHORS: Add Natalie Kopaczewski.
2021-01-23 08:43:43 +01:00
Jan (janneke) Nieuwenhuizen 98965c8807
test: Split-off scaffold/60-math-itoa.c.
* lib/tests/scaffold/60-math.c (main): Move itoa tests to...
* lib/tests/scaffold/60-math-itoa.c: ...this new file.
* build-aux/check-mescc.sh (mes_tests): Add it.
2021-01-23 08:43:43 +01:00
Jan (janneke) Nieuwenhuizen af2353dd23
test: Split-off 36-compare-arithmetic-negative.c.
* lib/tests/scaffold/36-compare-arithmetic.c (main): Move negative
divisions to...
* lib/tests/scaffold/36-compare-arithmetic-negative.c: ...new file here.
* build-aux/check-mescc.sh (mes_tests): Add it.
2021-01-23 08:43:43 +01:00
Jan (janneke) Nieuwenhuizen cd6131bc21
test: ARM: 08-assign.c: Avoid assembly for tcc.
* lib/tests/scaffold/08-assign.c (main)[__arm__ && __TINYC__]: Avoid assembly.
2021-01-23 08:43:42 +01:00
Jan (janneke) Nieuwenhuizen 691d25699c
test: Split-off 50-strcmp-itoa.c
* lib/tests/string/50-strcmp.c (main): Move itoa tests to...
* lib/tests/string/50-strcmp-itoa.c: ...this new file.
* build-aux/check-mescc.sh (mes_tests): Add it.
2021-01-23 08:43:42 +01:00
Jan (janneke) Nieuwenhuizen 4a9d7a1f33
ARM: libtcc1: Add __divsi3, __modsi3, __udivsi3, __umodsi3.
* lib/libtcc1.c (__divsi3, __modsi3, __udivsi3, __umodsi3): New functions.
2021-01-23 08:43:42 +01:00
Jan (janneke) Nieuwenhuizen 04afe3e238
ARM: libtcc1: Add stubs __floatundidf, __fixunsdfdi, __fixunsdfsi.
* lib/libtcc1.c (__floatdisf, __floatdidf)[__arm__]: New stubs.
2021-01-23 08:43:42 +01:00
Jan (janneke) Nieuwenhuizen e07e731dfd
libtcc1: Add stubs __floatundidf, __fixunsdfdi, __fixunsdfsi.
* lib/libtcc1.c (__floatundidf, __fixunsdfdi, __fixunsdfsi): New stubs.
2021-01-23 08:43:42 +01:00
Jan (janneke) Nieuwenhuizen 8c53e22434
ARM: libtcc1: Add support for TinyCC.
* lib/libtcc1.c: (__udivdi3, __umoddi3, __lshrdi3, __ashldi3,
__fixunsxfdi)[__arm__ && __TINYC__]: Use __mesabi functions.
2021-01-23 08:43:42 +01:00
Jan (janneke) Nieuwenhuizen 553539ad75
libtcc1: Remove mesabi dependencies for TinyCC.
* lib/libtcc1.c (__divdi3, __moddi3, __udivdi3, __umoddi3, __lshrdi3,
__ashldi3, __ashrdi3, __floatundixf, __fixunsxfdi, __fixxfdi,
__fixsfdi)[__TINYC__]: No stub printing.
2021-01-23 08:43:41 +01:00
Jan (janneke) Nieuwenhuizen ddd8349827
mescc: Mes C Library: div: Avoid __raise for TinyCC.
* lib/mes/div.c (__raise)[__TINYC__]: New macro.
2021-01-23 08:43:41 +01:00
Jan (janneke) Nieuwenhuizen ede49daabb
mescc: Mes C Library: Add __mesabi_umod, __mesabi_udiv.
* lib/mes/div.c (__mesabi_umod, __mesabi_udiv): New functions.
* include/mes/lib.h: Add prototypes.
2021-01-23 08:43:41 +01:00
Danny Milosavljevic c1dcdc5d7e
ARM: Implement long division.
* lib/mes/div.c (__mesabi_log2i): New procedure.
(__mesabi_uldiv1): New procedure.
(__mesabi_uldiv): Use it.

Co-Authored-By: Nathalie Kopaczewski <natkopa@gmail.com>
2021-01-23 08:43:41 +01:00
Danny Milosavljevic a5f30ee27b
ARM: Special-case setjmp struct for gcc with mes libc.
* include/setjmp.h (__jmp_buf): Special-case setjmp struct for gcc with mes
libc.
2021-01-23 08:43:41 +01:00
Jan (janneke) Nieuwenhuizen 13b69f4b9b
tests: Add 70-ternary-arithmetic-argument.c.
* lib/tests/scaffold/70-ternary-arithmetic-argument.c: New file.
* build-aux/check-mescc.sh (tcc_tests, xfail_tests): Add it.
2021-01-23 08:43:41 +01:00
Danny Milosavljevic 10bcb3709b
ARM: Speed up __mesabi_uldiv for powers-of-two divisors.
* lib/mes/div.c (__mesabi_uldiv): Speed up division for powers-of-two
divisors.
2021-01-23 08:43:41 +01:00
Jan (janneke) Nieuwenhuizen bfd6792d07
ARM: Revert to 4 byte types only.
* module/mescc/armv4/info.scm (armv4:type-alist): Use size 4 for long
longs too.
2021-01-23 08:43:40 +01:00
Paul Dersey 4492173466
Mes C Library: stdlib/qsort.c: Fix qswap segfault.
* stdlib/qsort.c (qswap): Remove hard coded buffer size.  Allow
swapping of objects of arbitrary size.
2021-01-23 08:43:05 +01:00
Jan (janneke) Nieuwenhuizen d3a039949b
doc: Update to bug-mes@gnu.org.
* doc/mes.texi (Submitting Patches): Use bug-gnu instead of
guix-patches, guix-devel.
2021-01-23 08:42:26 +01:00
Jan (janneke) Nieuwenhuizen 49b4a0f144
build: Update guix package version too.
* guix/git/mes.scm (mes, mes.git)[version]: Mark fields.
* build-aux/GNUmakefile.in (update-hash): Update mes version too.
(release): Remove gen-announce, guix-build dependencies.
2021-01-23 08:41:38 +01:00
Jan (janneke) Nieuwenhuizen 3f70993dd2
mescc: Update -g help text.
* module/mescc.scm (parse-opts): Remove TODO, mention call stack.
2021-01-23 08:41:13 +01:00
Jan (janneke) Nieuwenhuizen 3aecca4bdc
bootstrap: Resurrect.
* build-aux/bootstrap.sh.in (AM_CFLAGS): Use -L ${srcdest}lib.
Build libmescc.a and use it to link mes.
2021-01-23 08:40:58 +01:00
Jan (janneke) Nieuwenhuizen 8b2c4d48a9
mescc: Make sure includedir, libdir are set.
* scripts/mescc.in (prefix): New variable.
2021-01-23 08:40:55 +01:00
Jan (janneke) Nieuwenhuizen 7198c2d7ea
build: Make mescc more verbose on V=2, V=3.
* build-aux/cflags.sh (AM_CFLAGS): Add -v, -v -v for V=2, V=3
respectively.
2021-01-23 08:40:35 +01:00
Jan (janneke) Nieuwenhuizen e488ba3daf
guix: Switch to guile-3.0-latest.
* guix/git/mes.scm (nyacc)[inputs]: New field.
(mes)[inputs]: Update to guile-latest.
2020-12-29 14:24:03 +01:00
Jan (janneke) Nieuwenhuizen b601eb64af
mescc: Mes C Library: ntoab: Use unsigned base.
This fixes 60-math, 60-math-itoa, 70-printf-simple, 70-printf.

* lib/mes/ntoab.c (ntoab): Use unsigned base.
* include/mes/lib.h: Update prototype.
2020-12-13 22:19:06 +01:00
Jan (janneke) Nieuwenhuizen a0560aff67
configure: Use GUILD_OPTIMIZE=-O1 for Guile-3.
* configure (main): Set guild_optimize to "-O1" for Guile-3.
* build-aux/config.make.in (GUILD_OPTIMIZE): New variable.
* build-aux/export.make (GUILD_OPTIMIZE): Export if set.
* build-aux/config.sh.in (GUILD_OPTIMIZE): New variable.
* build-aux/build-guile.sh: Use it.
2020-10-07 14:09:24 +02:00
Jan (janneke) Nieuwenhuizen fa4147a284
mescc: Use signed division for x86, x86_64 when appropriate.
This fixes 36-compare-arithmetic.c

* module/mescc/i386/as.scm (i386:r0/r1, i386:r0%r1): Do not reset
signed?.
* module/mescc/x86_64/as.scm (x86_64:r0/r1, x86_64:r0%r1): Likewise.
* lib/tests/scaffold/36-compare-arithmetic.c (main): Use unique exit
value per failure.
2020-10-06 19:53:02 +02:00
Jan (janneke) Nieuwenhuizen 8429a4b0b6
build: Bump MESCC_STACK.
This fixes running ./pre-inst-env mescc ...

* scripts/mescc.in (MES_STACK): Bump to 6000000.
2020-10-06 16:45:52 +02:00
Jan (janneke) Nieuwenhuizen 252a0df25a
guix: nyacc: Update to 1.00.2.
* guix/git/mes.scm (nyacc): Rename to...
(nyacc-0.99): ...this.
(nyacc): New variable.
2020-10-06 16:45:51 +02:00
Jan (janneke) Nieuwenhuizen 14caa774f7
Revert "guix: nyacc: Update to 1.03.0."
This does not work yet, sorry for the noise.

This reverts commit 70b2942286.
2020-10-06 16:43:12 +02:00
Jan (janneke) Nieuwenhuizen 70b2942286
guix: nyacc: Update to 1.03.0.
* guix/git/mes.scm (nyacc): Rename to...
(nyacc-0.99): ...this.
(nyacc): New variable.
(mes): Update to guile-3.0.
2020-10-06 13:58:33 +02:00
Jan (janneke) Nieuwenhuizen fe60f9a3f7
build: Support guile-3.0.
* configure (main): Prefer guile-3.
2020-10-06 13:54:09 +02:00
Jan (janneke) Nieuwenhuizen 0db5bc48f5
build: Support make check TESTS=... XFAIL=... for mescc tests.
* build-aux/config.sh.in (TESTS, XFAIL_TESTS): Export.
* build-aux/export.make (TESTS, XFAIL_TESTS): Export if set.
* build-aux/check-mescc.sh (TESTS, XFAIL_TESTS): Allow user override.
2020-10-06 13:54:09 +02:00
Jan (janneke) Nieuwenhuizen 9a1c50c1cf
mes: Support for gcc-10.
Fixes <https://lists.gnu.org/archive/html/bug-mes/2020-07/msg00000.html>.

Reported by Vagrant Cascadian <vagrant@reproducible-builds.org>.

* src/string.c (MAX_STRING): Remove duplicate definition.
2020-10-06 13:14:22 +02:00
Jan (janneke) Nieuwenhuizen 84ff05a839
mescc: Mes C Library: Support gcc-10.
See <https://lists.gnu.org/archive/html/bug-mes/2020-07/msg00000.html>.

Reported by Vagrant Cascadian <vagrant@reproducible-builds.org>.

* include/setjmp.h (jmp_buf): Remove.
* include/errno.h (errno): Mark extern.
* include/mes/lib-mini.h (environ, errno, __stdin, __stdout, __stderr):
Likewise.
* lib/mes/globals.c: New file; define them.
* build-aux/configure-lib.sh (libc_mini_shared_SOURCES,
libmescc_SOURCES): Add it.
* build-aux/test-c.sh: Always use -l c-mini as a minimum.
2020-10-06 13:13:44 +02:00
Jan (janneke) Nieuwenhuizen be87ada6b5
build: Resurrect running mescc from elsewhere.
After setting-up a buld environment, running something like

   ~/src/mes/wip/pre-inst-env mescc -v -v ~/src/mes/wip/scaffold/main.c

works again.

TODO: Make this less complex.

 * The mescc-lib (and gcc-lib) build directories do not help;
   these were introduced to support `wip-autotools'.
 * We used to opt for short *PATH variables: "." rather than
   /gnu/store/.... or /home/janneke/src/mes/master to avoid
   filling the MES arena. XXX Has this been solved?
 * In the Guix bootstrap, we run module/mescc.scm directly
       $MES -e '(mescc)' module/mescc.scm

   ...so that's why these overrides started to appear in multiple
   places.

* build-aux/pre-inst-env.in (MES_UNINSTALLED): New variable.
* scripts/mescc.in (includedir,libdir): Use it to override these.
* module/mescc/mescc.scm (arch-find): Use it to add <lib>-messc.
2020-10-06 10:44:50 +02:00
Jan (janneke) Nieuwenhuizen 0650e08744
mescc: Mes C Library: x86_64: Add syscall-internal.
This resurrects the x86_64 build.

* lib/linux/x86_64-mes-gcc/syscall-internal.c (__sys_call_internal),
lib/linux/x86_64-mes-mescc/syscall-internal.c: New file.
2020-10-06 10:05:33 +02:00
Jan (janneke) Nieuwenhuizen e16d1e469a
mescc: Mes C Library: x86_64: Introduce __sys_call and friends.
This prepares for x86_64 syscall-internal.

* lib/linux/x86_64-mes-gcc/syscall.c (__sys_call, __sys_call1,
__sys_call2, __sys_call3, __sys_call4): New functions, copied from ...
(_sys_call, _sys_call1, _sys_call2, _sys_call3, _sys_call4): ... these.
Use them, handle errno only.
2020-10-06 10:05:33 +02:00
Jan (janneke) Nieuwenhuizen 1c128c7a9f
mescc: Mes C Library: x86: Use long for syscalls.
The Linux signature uses long, also this allows for making
_sys_call and friends architecture-independent.

* lib/linux/x86-mes-mescc/syscall-internal.c (__sys_call_internal,
__sys_call2_internal): Use long.  Update callers.
* lib/linux/x86-mes-mescc/syscall.c (__sys_call, __sys_call1,
__sys_call2, __sys_call3, __sys_call4, _sys_call, _sys_call1,
_sys_call2, _sys_call3, _sys_call4): Likewise.
2020-10-06 10:05:33 +02:00
Jan (janneke) Nieuwenhuizen 5f8a424328
mescc: Mes C Library: Remove redundant prototypes.
* lib/linux/x86-mes-gcc/syscall.c(__sys_call, __sys_call1, __sys_call2,
__sys_call3, __sys_call4): Remove prototype.
2020-10-06 10:05:33 +02:00