Danny Milosavljevic
047014e704
build: Fixup cleaning of armv4.
...
* build-aux/GNUmakefile.in (clean): Clean armv4 go files.
2020-08-22 14:09:54 +02:00
Danny Milosavljevic
acf86208ed
ARM: Support comparing 32 bit values.
...
* lib/arm-mes/arm.M1 (cmp____$i32,%r0): New macro.
(cmp____$i32,%r1): New macro.
(cmp____$i32,%r2): New macro.
2020-06-19 02:45:51 +02:00
Danny Milosavljevic
d9bda45853
ARM: Handle signed values in r-byte-mem-add, r-word-mem-add.
...
* lib/arm-mes/arm.M1 (ldrb___%r0,(%r1)): Delete macro.
(ldrh___%r0,(%r0)): Delete macro.
(ldrsh__%r0,(%r0)): New macro.
(ldrh___%r0,(%r1)): Delete macro.
(ldrsh__%r0,(%r1)): New macro.
(ldrh___%r1,(%r1)): Delete macro.
(ldrsh__%r1,(%r1)): New macro.
(ldrh___%r2,(%r2)): Delete macro.
(ldrsh__%r2,(%r2)): New macro.
(ldrh___%r3,(%r3)): Delete macro.
(ldrsh__%r3,(%r3)): New macro.
(ldrsb__%r0,(%r1)): New macro.
* module/mescc/armv4/as.scm (armv4:r-byte-mem-add): Use ldrsb.
(armv4:r-word-mem-add): Use ldrsh, add____$i32,(%r0).
(armv4:word-mem->r): Use ldrsh.
2020-06-19 02:45:33 +02:00
Danny Milosavljevic
821d1b8fe9
ntoab: Simplify LONG_MIN case.
...
* lib/mes/ntoab.c (ntoab): Simplify LONG_MIN case.
Co-Authored-By: Nathalie Kopaczewski <natkopa@gmail.com>
2020-06-17 00:21:57 +02:00
Danny Milosavljevic
aaa174382e
ARM: Factor out optimize-immediate.
...
* module/mescc/armv4/as.scm (optimize-immediate): New macro.
(immediate->r0): Use it.
(armv4:value->r): Use it.
(armv4:local->r): Use it.
(armv4:r->local+n): Use it.
(armv4:r-byte-mem-add): Use it.
(armv4:r-word-mem-add): Use it.
(armv4:local-ptr->r): Use it.
(armv4:r+value): Use it.
(armv4:r-cmp-value): Use it.
(armv4:r0+value): Use it.
(armv4:byte-r->local+n): Use it.
(armv4:word-r->local+n): Use it.
2020-06-16 21:07:23 +02:00
Danny Milosavljevic
341682f474
ARM: Avoid using (abs INT_MIN) and (- INT_MIN).
...
* module/mescc/armv4/as.scm (immediate->r0): Inline abs.
(armv4:value->r): Inline abs.
(armv4:local->r): Inline abs.
(armv4:r->local+n): Inline abs.
(armv4:r-byte-mem-add): Inline abs.
(armv4:r-word-mem-add): Inline abs.
(armv4:local-ptr->r): Inline abs.
(armv4:r+value): Inline abs.
(armv4:r-cmp-value): Inline abs.
(armv4:r0+value): Inline abs.
(armv4:byte-r->local+n): Inline abs.
(armv4:word-r->local+n): Inline abs.
2020-06-16 17:31:59 +02:00
Danny Milosavljevic
073cfca2b4
build-aux: Increase test timeout to 20 s.
2020-06-16 14:00:10 +02:00
Danny Milosavljevic
b11510f4da
ntoab: Handle LONG_MIN case.
...
* lib/mes/ntoab.c (ntoab): Handle LONG_MIN case.
* lib/tests/scaffold/60-math.c (main): Add test for INT_MIN and hex.
2020-06-15 11:26:43 +02:00
Danny Milosavljevic
3b312ca983
core: Fix unreadchar on string port when unreading EOF.
...
* src/posix.c (unreadchar): Fix on string port when unreading EOF.
2020-06-14 22:41:31 +02:00
Danny Milosavljevic
449f3c7e00
Add ARM gcc scaffold assembly.
...
* lib/linux/arm-mes-gcc/exit-42.S: New file.
* lib/linux/arm-mes-gcc/hello-mes.S: New file.
2020-06-13 19:44:29 +02:00
Danny Milosavljevic
451274bc80
mescc: Add modules for armv4.
...
* mes/module/mescc/armv4/as.mes: New file.
* mes/module/mescc/armv4/info.mes: New file.
* mes/module/mescc/mescc.mes: Use them.
2020-06-13 19:07:32 +02:00
Danny Milosavljevic
6478476ed7
Implement setjmp for ARM mescc.
...
* include/setjmp.h: Add ARM case.
* lib/arm-mes-mescc/setjmp.c: New file.
2020-06-12 23:20:17 +02:00
Danny Milosavljevic
48ecb2f29e
test: Test signed division.
...
* lib/tests/scaffold/36-compare-arithmetic.c (main): Test signed division.
2020-06-10 17:04:55 +02:00
Danny Milosavljevic
3f03574050
ldiv: Work around missing struct return feature.
...
* lib/mes/div.c (__mesabi_ldiv): Remove return type.
(__mesabi_imod): Adapt call site.
(__aeabi_idiv): Adapt call site and move it to conditional compilation.
(__aeabi_idivmod): Adapt call site.
2020-06-10 15:46:12 +02:00
Jan Nieuwenhuizen
40aa190459
guix: mescc-tools: Update to 0.7.0, adding ARM support.
...
This brings arm-linux-gnueabihf, aarch64-linux-gnu support.
* guix/git/mes.scm (mescc-tools): Update to 0.7.0.
2020-06-10 15:36:18 +02:00
Jan (janneke) Nieuwenhuizen
e9672324f3
dir-locals.el: Add indentation for Guix keywords.
...
* .dir-locals.el (scheme-mode): Add indentation rules for Guix package
definitions.
2020-06-10 15:34:06 +02:00
Danny Milosavljevic
d42f99e6cf
mescc: Mes C Library: Hang at the end if necessary.
...
* lib/linux/arm-mes-mescc/crt1.c (_start): Hang at the end if necessary.
2020-06-10 13:14:33 +02:00
Danny Milosavljevic
040220acee
Add ARM backend.
...
* build-aux/build-guile.sh: Add ARM backend.
* lib/arm-mes/arm.M1: New file.
* module/mescc/armv4/as.scm: New file.
* module/mescc/armv4/info.scm: New file.
* module/mescc/mescc.scm: Use it.
* module/mescc/M1.scm (info->M1): Support ARM symbolic instructions,
including little endian instructions. Align functions.
2020-06-10 13:11:07 +02:00
Jan Nieuwenhuizen
70e7232831
doc: Post-release update.
...
* NEWS: Add v0.22 hash.
* doc/announce/ANNOUNCE-0.22: Add gen-announce checksums; update NEWS,
typos.
2020-06-07 10:49:07 +02:00
Jan Nieuwenhuizen
80419817e6
ARM: Mes C Library: Support gcc-sans-libc.
...
* lib/linux/arm-mes-gcc/crt1.c: New file.
* lib/linux/arm-mes-gcc/mini.c: New file.
* lib/arm-mes-gcc/setjmp.c: New file.
Co-Authored-By: Danny Milosavljevic <dannym@scratchpost.org>
2020-06-04 21:59:30 +02:00
Jan Nieuwenhuizen
a44544bae9
guix: mes: Add armhf-linux, aarch64-linux support.
...
* guix/git/mes.scm (mes): Add armhf-linux, aarch64-linux support.
2020-06-04 21:54:42 +02:00
Danny Milosavljevic
b0347bf53d
ntoab: Make sure not to get stuck on base 1.
...
* lib/mes/ntoab.c (ntoab): Make sure not to get stuck on base 1.
2020-06-03 20:56:51 +02:00
Danny Milosavljevic
1f47a76e7a
mescc: Mes C Library: Add crt1, mini.
...
* lib/linux/arm-mes-mescc/crt1.c: New file.
* lib/linux/arm-mes-mescc/mini.c: New file.
2020-06-03 20:46:41 +02:00
Danny Milosavljevic
85e690ea64
ARM: Mes C Library: Add comment.
...
* lib/linux/time.c: Add comment.
2020-06-03 11:24:03 +02:00
Jan Nieuwenhuizen
be1ff7e625
ARM: Mes C Library: Add compile stub for time.
...
* lib/linux/time.c (time)[SYS_gettimeofday]: Implement using gettimeofday.
(time)[!SYS_time && !SYS_gettimeofday]: Compile stub.
2020-06-03 10:41:37 +02:00
Danny Milosavljevic
d8f5699d76
Add ARM syscall numbers.
...
* include/linux/arm/syscall.h: New file.
2020-06-03 08:52:10 +02:00
Danny Milosavljevic
a944400112
waitpid: Support ARM.
...
* lib/linux/waitpid.c (waitpid): Support ARM.
2020-06-03 00:55:07 +02:00
Danny Milosavljevic
65013db594
Add ARM linker support files.
...
* lib/linux/arm-mes/elf32-0exit-42.hex2,
lib/linux/arm-mes/elf32-0header.hex2,
lib/linux/arm-mes/elf32-0hello-mes.hex2,
lib/linux/arm-mes/elf32-body-exit-42.hex2,
lib/linux/arm-mes/elf32-body-hello-mes.hex2,
lib/linux/arm-mes/elf32-footer-single-main.hex2,
lib/linux/arm-mes/elf32-header.hex2: New files.
2020-06-02 20:27:52 +02:00
Danny Milosavljevic
4775de0021
Raise SIGABRT on abort().
...
* lib/stdlib/abort.c (abort): Raise SIGABRT.
2020-06-02 15:05:12 +02:00
Danny Milosavljevic
55d38162be
Introduce libmescc.a; Put division by integer in there; split syscalls' errno off.
...
* build-aux/configure-lib.sh (libmescc_SOURCES): Add lib/mes/div.c,
lib/linux/*/syscall-internal.c.
* build-aux/build-lib.sh: Add libmescc.a.
* build-aux/build-mes.sh: On gcc, add "-lmescc".
* build-aux/test-c.sh: Add "-lmescc".
* build-aux/check.sh.in: Add mescc to LIBS.
* module/mescc/mescc.scm (mescc:link): Add "mescc".
* module/mescc.scm (mescc:main): Update documentation of "-nodefaultlibs"
and "-nostdlib".
* lib/mes/div.c (ldiv): Rename to...
(__mesabi_ldiv): ...this. Avoid assert.
(__mesabi_div0): Avoid assert.
(__aeabi_idivmod): New procedure.
(__aeabi_idiv): New procedure.
(__aeabi_uidivmod): New procedure.
(__aeabi_uidiv): New procedure.
* lib/linux/x86-mes-gcc/syscall.c (__sys_call, __sys_call1, __sys_call2,
__sys_call3, __sys_call4): Move to...
* lib/linux/x86-mes-gcc/syscall-internal.c: ...here.
(__raise): New procedure.
* lib/linux/x86-mes-mescc/syscall.c (__sys_call, __sys_call1, __sys_call2,
__sys_call3, __sys_call4): Move to...
* lib/linux/x86-mes-mescc/syscall-internal.c: ...here.
(__raise): New procedure.
* lib/linux/arm-mes-gcc/syscall.c: New file.
* lib/linux/arm-mes-gcc/syscall-internal.c: New file.
* lib/linux/arm-mes-mescc/syscall.c: New file.
* lib/linux/arm-mes-mescc/syscall-internal.c: New file.
* lib/gnu/syscall.c (__syscall, __syscall2, __syscall_get, __syscall_put):
Move to...
* lib/gnu/syscall-internal.c: ...here.
2020-06-02 15:04:13 +02:00
Danny Milosavljevic
2b69460894
Prepare header files for ARMv4.
...
* include/fcntl.h (O_DIRECTORY): Add ARM case.
* include/signal.h (struct sigaction): Add uapi case.
* include/stdint.h: Add ARM case.
* include/sys/stat.h (struct stat): Add ARM case.
2020-06-02 14:37:55 +02:00
Danny Milosavljevic
6183816f83
Support and pass "-marm".
...
* build-aux/cflags.sh,
build-aux/check.sh.in: Pass "-marm" for ARM.
* module/mescc/mescc.scm: Accept it.
2020-06-02 14:35:16 +02:00
Danny Milosavljevic
fbc249832c
Prepare tests for ARMv4.
...
* lib/tests/io/90-stat.c,
lib/tests/scaffold/76-pointer-arithmetic.c,
lib/tests/scaffold/7k-for-each-elem.c,
lib/tests/scaffold/85-sizeof.c: Prepare tests for ARMv4.
2020-06-02 14:30:02 +02:00
Jan Nieuwenhuizen
52fb6cdbfc
Release 0.22.
...
* configure (VERSION): Update to 0.22.
(main): Likewise.
* build-aux/GNUmakefile.in: Likewise.
* configure.sh (VERSION): Likewise.
* guix/git/mes.scm (mes, mes.git): Likewise.
2020-01-20 22:47:53 +01:00
Jan Nieuwenhuizen
c575069b62
build: Update release process.
...
* build-aux/GNUmakefile.in: Update documentation.
(sign-dist): Rename from `sign'.
* configure: Remove version check for Guix; support GUIX=guix ./configure.
2020-01-20 22:47:52 +01:00
Jan Nieuwenhuizen
34feefa559
doc: Release update.
...
* BOOTSTRAP: Release update.
* HACKING: Likewise.
* INSTALL: Likewise.
* NEWS: Likewise.
* PORTING: Likewise.
* README: Likewise.
* ROADMAP: Likewise.
* doc/mes.texi: Likewise.
* doc/announce/ANNOUNCE-0.22: New file.
2020-01-20 22:47:52 +01:00
Jan Nieuwenhuizen
d8fca8321e
mescc: Mes C Library: Fix execlp, execvp for file names with slash.
...
Reported by mid-kid.
* lib/posix/execlp.c (execlp): Do not use search_path when file name
contains a slash (WAS: when file name starts with slash).
* lib/posix/execvp.c (execvp): Likewise.
2020-01-20 22:47:52 +01:00
Jan Nieuwenhuizen
62193aa1db
build: Support bootstrapping using build.sh.
...
* build-aux/build.sh.in: Oops, use $compiler = bootstrap concept does
not exist yet. Gash cp does not support -p; drop it.
* configure.sh: Oops, set bootstrap to `true' instead of yes.
2020-01-20 22:47:52 +01:00
Jan Nieuwenhuizen
3abd3e0bcc
mescc: Mes C Library: lseek: Be careful clearing read buffer.
...
* lib/linux/lseek.c (_lseek): New function.
* lib/linux/lseek.c (lseek): Use it to check if we should reset read
buffer.
* lib/mes/__buffered_read.c (__read_buffer_max): New variable.
(__buffered_read_init): Add environment override: MES_READ_BUFFER.
(__buffered_read): Use it.
2020-01-20 22:47:52 +01:00
Jan Nieuwenhuizen
2f72303e6c
build: Have configure respect GUILE_LOAD_PATH for mes to find Nyacc.
...
* configure: Substitute GUILE_LOAD_PATH from %load-path.
* configure.sh: Likewise.
* build-aux/config.make.in: Add GUILE_LOAD_PATH as subtitution variable.
* build-aux/config.sh.in: Likewise.
* mes/module/mes/guile.mes (%load-path): New variable.
2020-01-20 22:47:52 +01:00
Jan Nieuwenhuizen
e984f7213f
build: Have configure prefer $CC over gcc; tcc over gcc, gcc over cc.
...
Reported by Vagrant Cascadian.
* configure (string->version): Prefer for most-dotted string. Fixes
makeinfo version.
(check-program-version): Prefer displaying of command, if single word.
(main): Check for $CC --version, $CC -v. Prefer $CC over gcc; tcc over
gcc, gcc over cc.
2020-01-20 22:47:52 +01:00
Jan Nieuwenhuizen
36b2857d5b
mescc: Opt for reproducible builds with Guile and Mes.
...
* module/mescc/compile.scm (mes-or-reproducible?): New variable.
(ast->comment): Use it.
* module/mescc/preprocess.scm (mes-or-reproducible?): New variable.
(c99-input->full-ast): Use it.
2020-01-20 22:47:51 +01:00
Jan Nieuwenhuizen
720f224a08
build: Resurrect compiling with TinyCC.
...
./configure CC=tcc --host=i686-unknown-linux-gnu --with-courage
* configure: Cater for tcc.
2020-01-20 22:47:51 +01:00
Jan Nieuwenhuizen
e354d8b165
build: Cater for FreeBSD.
...
* build-aux/bootstrap.sh.in: Add test ! -e -o to satisfy FreeBSD test.
Fixes skipping over all compilations.
* build-aux/cc.sh (compile): Likewise.
2019-12-17 21:08:18 +01:00
Jan Nieuwenhuizen
ec9aecea07
freebsd: Initial x86 scaffold.
...
* lib/freebsd/x86-mes-gcc/crt1.c: New file.
* lib/freebsd/x86-mes-gcc/exit-42.S: New file.
* lib/freebsd/x86-mes-gcc/hello-mes.S: New file.
* lib/freebsd/x86-mes-gcc/mini.c: New file.
* lib/freebsd/x86-mes-mescc/crt1.c: New file.
* lib/freebsd/x86-mes-mescc/mini.c: New file.
* lib/freebsd/x86-mes/elf32-0exit-42.hex2: New file.
* lib/freebsd/x86-mes/elf32-0header.hex2: New file.
* lib/freebsd/x86-mes/elf32-0hello-mes.hex2: New file.
* lib/freebsd/x86-mes/elf32-body-exit-42.hex2: New file.
* lib/freebsd/x86-mes/elf32-body-hello-mes.hex2: New file.
* lib/freebsd/x86-mes/elf32-footer-single-main.hex2: New file.
* lib/freebsd/x86-mes/elf32-header.hex2: New file.
2019-12-17 21:08:18 +01:00
Jan Nieuwenhuizen
e4f293afdd
freebsd: Initial configure support.
...
* configure: Initial FreeBSD configure support.
* configure.sh: Likewise. Run without bash.
2019-12-17 21:08:18 +01:00
Jan Nieuwenhuizen
34106fc420
build: Prepare for kernel variants.
...
* configure: Fix detection of Arch, FreeBSD.
* lib/linux/x86-mes-gcc/exit-42.S: Move from ...
* lib/x86-mes-gcc/exit-42.S: ... here.
* lib/linux/x86-mes-gcc/hello-mes.S: Move from ...
* lib/x86-mes-gcc/hello-mes.S: ... here.
* lib/linux/x86-mes-mescc/exit-42.S: Move from ...
* lib/x86-mes-mescc/exit-42.S: ... here.
* lib/linux/x86-mes-mescc/hello-mes.S: Move from ...
* lib/x86-mes-mescc/hello-mes.S: ... here.
* lib/linux/x86-mes/elf32-0exit-42.hex2: Move from ...
* lib/x86-mes/elf32-0exit-42.hex2: ... here.
* lib/linux/x86-mes/elf32-0header.hex2: Move from ...
* lib/x86-mes/elf32-0header.hex2: ... here.
* lib/linux/x86-mes/elf32-0hello-mes.hex2: Move from ...
* lib/x86-mes/elf32-0hello-mes.hex2: ... here.
* lib/linux/x86-mes/elf32-body-exit-42.hex2: Move from ...
* lib/x86-mes/elf32-body-exit-42.hex2: ... here.
* lib/linux/x86-mes/elf32-body-hello-mes.hex2: Move from ...
* lib/x86-mes/elf32-body-hello-mes.hex2: ... here.
* lib/linux/x86-mes/elf32-footer-single-main.hex2: Move from ...
* lib/x86-mes/elf32-footer-single-main.hex2: ... here.
* lib/linux/x86-mes/elf32-header.hex2: Move from ...
* lib/x86-mes/elf32-header.hex2: ... here.
* lib/linux/x86_64-mes-gcc/exit-42.S: Move from ...
* lib/x86_64-mes-gcc/exit-42.S: ... here.
* lib/linux/x86_64-mes-gcc/hello-mes.S: Move from ...
* lib/x86_64-mes-gcc/hello-mes.S: ... here.
* lib/linux/x86_64-mes-mescc/exit-42.S: Move from ...
* lib/x86_64-mes-mescc/exit-42.S: ... here.
* lib/linux/x86_64-mes-mescc/hello-mes.S: Move from ...
* lib/x86_64-mes-mescc/hello-mes.S: ... here.
* lib/linux/x86_64-mes/elf64-0exit-42.hex2: Move from ...
* lib/x86_64-mes/elf64-0exit-42.hex2: ... here.
* lib/linux/x86_64-mes/elf64-0header.hex2: Move from ...
* lib/x86_64-mes/elf64-0header.hex2: ... here.
* lib/linux/x86_64-mes/elf64-0hello-mes.hex2: Move from ...
* lib/x86_64-mes/elf64-0hello-mes.hex2: ... here.
* lib/linux/x86_64-mes/elf64-body-exit-42.hex2: Move from ...
* lib/x86_64-mes/elf64-body-exit-42.hex2: ... here.
* lib/linux/x86_64-mes/elf64-body-hello-mes.hex2: Move from ...
* lib/x86_64-mes/elf64-body-hello-mes.hex2: ... here.
* lib/linux/x86_64-mes/elf64-footer-single-main.hex2: Move from ...
* lib/x86_64-mes/elf64-footer-single-main.hex2: ... here.
* lib/linux/x86_64-mes/elf64-header.hex2: Move from ...
* lib/x86_64-mes/elf64-header.hex2: ... here.
* module/mescc.scm (parse-opts): Support --kernel.
* module/mescc/mescc.scm (kernel-find): New function.
* module/mescc/mescc.scm (hex2->elf): Use it to find kernel-specific ELF
snippets.
* build-aux/install.sh.in: Install it.
2019-12-17 21:07:35 +01:00
Jan Nieuwenhuizen
c673c9d303
mescc: Mes C Library: Add ioctl3 stub.
2019-12-13 21:52:31 +01:00
Jan Nieuwenhuizen
f5bf3f4cf6
mescc: Mes C Library: Fix access stub.
...
* lib/stub/access.c (access): Use _open3 to give more meaningful
behaviour. Fixes hanging of mes.
2019-12-13 21:52:31 +01:00
Jan Nieuwenhuizen
7c6da0c213
hurd: Fixes for upgrade to debian-hurd-20190220.img.
...
* include/mach/mach-init.h (__mach_host_self, __mach_task_self):
Remove macro magic.
(mach_host_self, mach_task_self): Remove macro magic; declare as function.
* lib/mach/mach-init.c (mach_host_self, mach_task_self): New function.
(mach_init): Use them.
* lib/gnu/hurd-start.c (_hurd_start): Use mach_task_self ().
* lib/gnu/_exit.c (_exit): Likewise.
2019-12-13 21:52:31 +01:00