mes.git
7 weeks agoconfigure: Use GUILD_OPTIMIZE=-O1 for Guile-3. master
Jan (janneke) Nieuwenhuizen [Wed, 7 Oct 2020 11:55:06 +0000 (13:55 +0200)]
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.

7 weeks agomescc: Use signed division for x86, x86_64 when appropriate.
Jan (janneke) Nieuwenhuizen [Tue, 6 Oct 2020 17:41:14 +0000 (19:41 +0200)]
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.

7 weeks agobuild: Bump MESCC_STACK.
Jan (janneke) Nieuwenhuizen [Tue, 6 Oct 2020 13:58:01 +0000 (15:58 +0200)]
build: Bump MESCC_STACK.

This fixes running ./pre-inst-env mescc ...

* scripts/mescc.in (MES_STACK): Bump to 6000000.

7 weeks agoguix: nyacc: Update to 1.00.2.
Jan (janneke) Nieuwenhuizen [Tue, 6 Oct 2020 14:17:21 +0000 (16:17 +0200)]
guix: nyacc: Update to 1.00.2.

* guix/git/mes.scm (nyacc): Rename to...
(nyacc-0.99): ...this.
(nyacc): New variable.

7 weeks agoRevert "guix: nyacc: Update to 1.03.0."
Jan (janneke) Nieuwenhuizen [Tue, 6 Oct 2020 14:42:59 +0000 (16:42 +0200)]
Revert "guix: nyacc: Update to 1.03.0."

This does not work yet, sorry for the noise.

This reverts commit 70b2942286ecc0b40798ac4e1fdaa9cd56a48aaf.

7 weeks agoguix: nyacc: Update to 1.03.0.
Jan (janneke) Nieuwenhuizen [Tue, 6 Oct 2020 11:51:42 +0000 (13:51 +0200)]
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.

7 weeks agobuild: Support guile-3.0.
Jan (janneke) Nieuwenhuizen [Tue, 6 Oct 2020 11:43:11 +0000 (13:43 +0200)]
build: Support guile-3.0.

* configure (main): Prefer guile-3.

7 weeks agobuild: Support make check TESTS=... XFAIL=... for mescc tests.
Jan (janneke) Nieuwenhuizen [Tue, 6 Oct 2020 11:11:20 +0000 (13:11 +0200)]
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.

7 weeks agomes: Support for gcc-10.
Jan (janneke) Nieuwenhuizen [Tue, 6 Oct 2020 08:36:59 +0000 (10:36 +0200)]
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.

7 weeks agomescc: Mes C Library: Support gcc-10.
Jan (janneke) Nieuwenhuizen [Tue, 6 Oct 2020 08:33:55 +0000 (10:33 +0200)]
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.

7 weeks agobuild: Resurrect running mescc from elsewhere.
Jan (janneke) Nieuwenhuizen [Sun, 30 Aug 2020 13:00:26 +0000 (15:00 +0200)]
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.

7 weeks agomescc: Mes C Library: x86_64: Add syscall-internal.
Jan (janneke) Nieuwenhuizen [Sun, 30 Aug 2020 10:14:28 +0000 (12:14 +0200)]
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.

7 weeks agomescc: Mes C Library: x86_64: Introduce __sys_call and friends.
Jan (janneke) Nieuwenhuizen [Sun, 30 Aug 2020 10:11:51 +0000 (12:11 +0200)]
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.

7 weeks agomescc: Mes C Library: x86: Use long for syscalls.
Jan (janneke) Nieuwenhuizen [Sun, 30 Aug 2020 10:09:32 +0000 (12:09 +0200)]
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.

7 weeks agomescc: Mes C Library: Remove redundant prototypes.
Jan (janneke) Nieuwenhuizen [Sun, 30 Aug 2020 10:05:21 +0000 (12:05 +0200)]
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.

7 weeks agomescc: Mes C Library: Whitespace fixes.
Jan (janneke) Nieuwenhuizen [Sun, 30 Aug 2020 09:31:29 +0000 (11:31 +0200)]
mescc: Mes C Library: Whitespace fixes.

* lib/linux/signal.c (signal): Whitespace fixes.
* lib/linux/time.c (time): Likewise.

7 weeks agocommand line: Support "mescc --print-libgcc-file-name".
Danny Milosavljevic [Sat, 29 Aug 2020 21:24:31 +0000 (23:24 +0200)]
command line: Support "mescc --print-libgcc-file-name".

* module/mescc.scm (parse-opts): Add "--print-libgcc-file-name".

7 weeks agoDistinguish between gcc and mescc; select LIBS accordingly.
Danny Milosavljevic [Sat, 29 Aug 2020 13:24:48 +0000 (15:24 +0200)]
Distinguish between gcc and mescc; select LIBS accordingly.

* build-aux/check.sh.in: Distinguish between gcc and mescc;
add MES_CHECKING_BUILTIN_LIBS.
* build-aux/test-c.sh: Use it to select LIBS accordingly.

7 weeks agoMake "raise" available for gcc use.
Danny Milosavljevic [Sat, 29 Aug 2020 10:52:12 +0000 (12:52 +0200)]
Make "raise" available for gcc use.

* build-aux/configure-lib.sh (libc_tcc_SOURCES): Move lib/posix/raise.c,
lib/linux/getpid.c, lib/linux/kill.c to...
(libc_SOURCES): ...here.

7 weeks agobuild: Use libgcc.a instead of libmescc.a for gcc.
Danny Milosavljevic [Sat, 29 Aug 2020 10:50:34 +0000 (12:50 +0200)]
build: Use libgcc.a instead of libmescc.a for gcc.

7 weeks agodiv: Remove libgcc-compatible API.
Danny Milosavljevic [Thu, 27 Aug 2020 08:06:48 +0000 (10:06 +0200)]
div: Remove libgcc-compatible API.

* lib/mes/div.c (__aeabi_idiv): Delete procedure.
(__aeabi_idivmod): Delete procedure.
(__aeabi_uidivmod): Delete procedure.
(__aeabi_uidiv): Delete procedure.

7 weeks agoRevert syscall split (of commit 55d38162be9ebd5b90b2550d0331a030c446c001);
Danny Milosavljevic [Tue, 25 Aug 2020 09:08:20 +0000 (11:08 +0200)]
Revert syscall split (of commit 55d38162be9ebd5b90b2550d0331a030c446c001);
just copy the two syscalls I need for __raise instead.

* lib/linux/arm-mes-gcc/syscall-internal.c (__sys_call_internal): New procedure.
(__sys_call2_internal): New procedure.
(__raise): Use them.
(__sys_call, __sys_call2, __sys_call3, __sys_call4, __sys_call6): Move to...
* lib/linux/arm-mes-gcc/syscall.c: ...here.
* lib/linux/arm-mes-mescc/syscall-internal.c (__sys_call_internal): New procedure.
(__sys_call2_internal): New procedure.
(__raise): Use them.
(__sys_call, __sys_call2, __sys_call3, __sys_call4, __sys_call6): Move to...
* lib/linux/arm-mes-mescc/syscall.c: ...here.
* lib/linux/x86-mes-gcc/syscall-internal.c (__sys_call_internal): New procedure.
(__sys_call2_internal): New procedure.
(__raise): Use them.
(__sys_call, __sys_call2, __sys_call3, __sys_call4, __sys_call6): Move to...
* lib/linux/x86-mes-gcc/syscall.c: ...here.
* lib/linux/x86-mes-mescc/syscall-internal.c (__sys_call_internal): New procedure.
(__sys_call2_internal): New procedure.
(__raise): Use them.
(__sys_call, __sys_call2, __sys_call3, __sys_call4, __sys_call6): Move to...
* lib/linux/x86-mes-mescc/syscall.c: ...here.

7 weeks agodiv: Add comment about __aeabi_idiv.
Danny Milosavljevic [Sun, 23 Aug 2020 14:15:09 +0000 (16:15 +0200)]
div: Add comment about __aeabi_idiv.

* lib/mes/div.c (__aeabi_idiv): Add comment.

7 weeks agodiv: Move __aeabi_idiv to __GNUC__; introduce __mesabi_idiv.
Danny Milosavljevic [Sun, 23 Aug 2020 14:08:57 +0000 (16:08 +0200)]
div: Move __aeabi_idiv to __GNUC__; introduce __mesabi_idiv.

* lib/mes/div.c (__aeabi_idiv): Move for conditional compilation.
(__mesabi_idiv): New procedure.
* module/mescc/armv4/as.scm (armv4:r0/r1): Use __mesabi_idiv.

7 weeks agobuild: Make raise available in libc+tcc for libgcc.
Danny Milosavljevic [Sun, 23 Aug 2020 13:55:17 +0000 (15:55 +0200)]
build: Make raise available in libc+tcc for libgcc.

* build-aux/configure-lib.sh (libc_gnu_SOURCES): Remove raise, getpid, kill.
(libc_tcc_SOURCES): Add raise, getpid, kill.

7 weeks agomescc: Add signed char.
Jan (janneke) Nieuwenhuizen [Sun, 23 Aug 2020 10:37:18 +0000 (12:37 +0200)]
mescc: Add signed char.

* module/mescc/armv4/info.scm (armv4:type-alist): Add signed char.
* module/mescc/i386/info.scm (i386:type-alist): Likewise.
* module/mescc/x86_64/info.scm (x86_64:type-alist): Likewise.

7 weeks agoARM: Add missing instruction.
Jan (janneke) Nieuwenhuizen [Sun, 23 Aug 2020 09:07:50 +0000 (11:07 +0200)]
ARM: Add missing instruction.

* lib/arm-mes/arm.M1: Add missing define.

7 weeks agoARM: as: Fix ldrsb_ typo.
Jan (janneke) Nieuwenhuizen [Sun, 23 Aug 2020 09:06:06 +0000 (11:06 +0200)]
ARM: as: Fix ldrsb_ typo.

(armv4:byte-r0-mem->r1-mem): : Add missing "_" to ldrsb_.

7 weeks agoARM: as: Fix strh__ typo.
Jan (janneke) Nieuwenhuizen [Sun, 23 Aug 2020 08:14:56 +0000 (10:14 +0200)]
ARM: as: Fix strh__ typo.

* module/mescc/armv4/as.scm (armv4:word-r0-mem->r1-mem): Add missing "_"
to strh__.

7 weeks agomescc: Do not crash when attemting to link files without extension.
Jan (janneke) Nieuwenhuizen [Sun, 23 Aug 2020 07:52:01 +0000 (09:52 +0200)]
mescc: Do not crash when attemting to link files without extension.

* module/mescc/mescc.scm (replace-suffix): Add ELSE clause to IF for
base; add IF for old-suffix.

7 weeks agodoc: Fix typos in `HACKING`.
Jan (janneke) Nieuwenhuizen [Sat, 22 Aug 2020 18:32:02 +0000 (20:32 +0200)]
doc: Fix typos in `HACKING`.

* HACKING (SETUP): Typos.

3 months agoARM: as: Guile compile fix.
Jan (janneke) Nieuwenhuizen [Sat, 22 Aug 2020 18:24:47 +0000 (20:24 +0200)]
ARM: as: Guile compile fix.

* module/mescc/armv4/as.scm (optimize-immediate): Do not unquote compare
functions (and numbers).

3 months agotest: Make 7l-struct-any-size-array-simple compatible with default ARM gcc.
Danny Milosavljevic [Sat, 22 Aug 2020 18:59:37 +0000 (20:59 +0200)]
test: Make 7l-struct-any-size-array-simple compatible with default ARM gcc.

* lib/tests/scaffold/7l-struct-any-size-array-simple.c: Make "signed"
explicit in signed char types.

3 months agotest: Make 7r-sign-extend compatible with default ARM gcc.
Danny Milosavljevic [Sat, 22 Aug 2020 18:39:14 +0000 (20:39 +0200)]
test: Make 7r-sign-extend compatible with default ARM gcc.

* lib/tests/scaffold/7r-sign-extend.c: Make "signed" explicit in
signed char types.

3 months agobuild: Fixup cleaning of armv4.
Danny Milosavljevic [Sat, 22 Aug 2020 12:09:54 +0000 (14:09 +0200)]
build: Fixup cleaning of armv4.

* build-aux/GNUmakefile.in (clean): Clean armv4 go files.

5 months agoARM: Support comparing 32 bit values.
Danny Milosavljevic [Thu, 18 Jun 2020 21:34:49 +0000 (23:34 +0200)]
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.

5 months agoARM: Handle signed values in r-byte-mem-add, r-word-mem-add.
Danny Milosavljevic [Thu, 18 Jun 2020 18:40:38 +0000 (20:40 +0200)]
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.

5 months agontoab: Simplify LONG_MIN case.
Danny Milosavljevic [Tue, 16 Jun 2020 22:21:57 +0000 (00:21 +0200)]
ntoab: Simplify LONG_MIN case.

* lib/mes/ntoab.c (ntoab): Simplify LONG_MIN case.

Co-Authored-By: Nathalie Kopaczewski <natkopa@gmail.com>
5 months agoARM: Factor out optimize-immediate.
Danny Milosavljevic [Tue, 16 Jun 2020 18:59:45 +0000 (20:59 +0200)]
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.

5 months agoARM: Avoid using (abs INT_MIN) and (- INT_MIN).
Danny Milosavljevic [Tue, 16 Jun 2020 12:08:58 +0000 (14:08 +0200)]
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.

5 months agobuild-aux: Increase test timeout to 20 s.
Danny Milosavljevic [Tue, 16 Jun 2020 12:00:10 +0000 (14:00 +0200)]
build-aux: Increase test timeout to 20 s.

5 months agontoab: Handle LONG_MIN case.
Danny Milosavljevic [Sun, 14 Jun 2020 23:05:35 +0000 (01:05 +0200)]
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.

5 months agocore: Fix unreadchar on string port when unreading EOF.
Danny Milosavljevic [Sun, 14 Jun 2020 20:41:31 +0000 (22:41 +0200)]
core: Fix unreadchar on string port when unreading EOF.

* src/posix.c (unreadchar): Fix on string port when unreading EOF.

5 months agoAdd ARM gcc scaffold assembly.
Danny Milosavljevic [Sat, 13 Jun 2020 17:44:29 +0000 (19:44 +0200)]
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.

5 months agomescc: Add modules for armv4.
Danny Milosavljevic [Sat, 13 Jun 2020 17:07:32 +0000 (19:07 +0200)]
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.

5 months agoImplement setjmp for ARM mescc.
Danny Milosavljevic [Thu, 4 Jun 2020 21:00:10 +0000 (23:00 +0200)]
Implement setjmp for ARM mescc.

* include/setjmp.h: Add ARM case.
* lib/arm-mes-mescc/setjmp.c: New file.

5 months agotest: Test signed division.
Danny Milosavljevic [Wed, 10 Jun 2020 15:04:55 +0000 (17:04 +0200)]
test: Test signed division.

* lib/tests/scaffold/36-compare-arithmetic.c (main): Test signed division.

5 months agoldiv: Work around missing struct return feature.
Danny Milosavljevic [Wed, 10 Jun 2020 11:16:08 +0000 (13:16 +0200)]
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.

5 months agoguix: mescc-tools: Update to 0.7.0, adding ARM support.
Jan Nieuwenhuizen [Sat, 8 Feb 2020 11:28:22 +0000 (12:28 +0100)]
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.

5 months agodir-locals.el: Add indentation for Guix keywords.
Jan (janneke) Nieuwenhuizen [Wed, 10 Jun 2020 13:30:04 +0000 (15:30 +0200)]
dir-locals.el: Add indentation for Guix keywords.

* .dir-locals.el (scheme-mode): Add indentation rules for Guix package
definitions.

5 months agomescc: Mes C Library: Hang at the end if necessary.
Danny Milosavljevic [Tue, 9 Jun 2020 17:31:22 +0000 (19:31 +0200)]
mescc: Mes C Library: Hang at the end if necessary.

* lib/linux/arm-mes-mescc/crt1.c (_start): Hang at the end if necessary.

5 months agoAdd ARM backend.
Danny Milosavljevic [Sat, 6 Jun 2020 17:51:45 +0000 (19:51 +0200)]
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.

5 months agodoc: Post-release update.
Jan Nieuwenhuizen [Thu, 23 Jan 2020 16:00:05 +0000 (17:00 +0100)]
doc: Post-release update.

* NEWS: Add v0.22 hash.
* doc/announce/ANNOUNCE-0.22: Add gen-announce checksums; update NEWS,
typos.

5 months agoARM: Mes C Library: Support gcc-sans-libc.
Jan Nieuwenhuizen [Thu, 4 Jun 2020 11:48:25 +0000 (13:48 +0200)]
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>
5 months agoguix: mes: Add armhf-linux, aarch64-linux support.
Jan Nieuwenhuizen [Thu, 4 Jun 2020 11:22:39 +0000 (13:22 +0200)]
guix: mes: Add armhf-linux, aarch64-linux support.

* guix/git/mes.scm (mes): Add armhf-linux, aarch64-linux support.

5 months agontoab: Make sure not to get stuck on base 1.
Danny Milosavljevic [Wed, 3 Jun 2020 18:56:51 +0000 (20:56 +0200)]
ntoab: Make sure not to get stuck on base 1.

* lib/mes/ntoab.c (ntoab): Make sure not to get stuck on base 1.

5 months agomescc: Mes C Library: Add crt1, mini.
Danny Milosavljevic [Tue, 2 Jun 2020 22:49:53 +0000 (00:49 +0200)]
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.

5 months agoARM: Mes C Library: Add comment.
Danny Milosavljevic [Wed, 3 Jun 2020 09:24:03 +0000 (11:24 +0200)]
ARM: Mes C Library: Add comment.

* lib/linux/time.c: Add comment.

5 months agoARM: Mes C Library: Add compile stub for time.
Jan Nieuwenhuizen [Tue, 2 Jun 2020 19:26:36 +0000 (21:26 +0200)]
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.

5 months agoAdd ARM syscall numbers.
Danny Milosavljevic [Tue, 2 Jun 2020 19:14:13 +0000 (21:14 +0200)]
Add ARM syscall numbers.

* include/linux/arm/syscall.h: New file.

5 months agowaitpid: Support ARM.
Danny Milosavljevic [Mon, 1 Jun 2020 22:23:12 +0000 (00:23 +0200)]
waitpid: Support ARM.

* lib/linux/waitpid.c (waitpid): Support ARM.

5 months agoAdd ARM linker support files.
Danny Milosavljevic [Tue, 2 Jun 2020 18:27:52 +0000 (20:27 +0200)]
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.

5 months agoRaise SIGABRT on abort().
Danny Milosavljevic [Tue, 2 Jun 2020 13:02:50 +0000 (15:02 +0200)]
Raise SIGABRT on abort().

* lib/stdlib/abort.c (abort): Raise SIGABRT.

5 months agoIntroduce libmescc.a; Put division by integer in there; split syscalls' errno off.
Danny Milosavljevic [Mon, 1 Jun 2020 21:47:49 +0000 (23:47 +0200)]
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.

5 months agoPrepare header files for ARMv4.
Danny Milosavljevic [Mon, 1 Jun 2020 21:48:12 +0000 (23:48 +0200)]
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.

5 months agoSupport and pass "-marm".
Danny Milosavljevic [Mon, 1 Jun 2020 22:03:03 +0000 (00:03 +0200)]
Support and pass "-marm".

* build-aux/cflags.sh,
build-aux/check.sh.in: Pass "-marm" for ARM.
* module/mescc/mescc.scm: Accept it.

5 months agoPrepare tests for ARMv4.
Danny Milosavljevic [Mon, 1 Jun 2020 21:54:21 +0000 (23:54 +0200)]
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.

10 months agoRelease 0.22. v0.22
Jan Nieuwenhuizen [Sun, 19 Jan 2020 07:31:38 +0000 (08:31 +0100)]
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.

10 months agobuild: Update release process.
Jan Nieuwenhuizen [Sun, 19 Jan 2020 10:27:53 +0000 (11:27 +0100)]
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.

10 months agodoc: Release update.
Jan Nieuwenhuizen [Mon, 9 Dec 2019 06:26:16 +0000 (07:26 +0100)]
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.

10 months agomescc: Mes C Library: Fix execlp, execvp for file names with slash.
Jan Nieuwenhuizen [Sun, 29 Dec 2019 13:25:40 +0000 (14:25 +0100)]
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.

10 months agobuild: Support bootstrapping using build.sh.
Jan Nieuwenhuizen [Thu, 19 Dec 2019 06:13:06 +0000 (07:13 +0100)]
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.

10 months agomescc: Mes C Library: lseek: Be careful clearing read buffer.
Jan Nieuwenhuizen [Tue, 17 Dec 2019 21:44:24 +0000 (22:44 +0100)]
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.

10 months agobuild: Have configure respect GUILE_LOAD_PATH for mes to find Nyacc.
Jan Nieuwenhuizen [Sun, 15 Dec 2019 09:10:23 +0000 (10:10 +0100)]
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.

10 months agobuild: Have configure prefer $CC over gcc; tcc over gcc, gcc over cc.
Jan Nieuwenhuizen [Fri, 13 Dec 2019 16:21:53 +0000 (17:21 +0100)]
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.

10 months agomescc: Opt for reproducible builds with Guile and Mes.
Jan Nieuwenhuizen [Thu, 12 Dec 2019 11:04:15 +0000 (12:04 +0100)]
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.

10 months agobuild: Resurrect compiling with TinyCC.
Jan Nieuwenhuizen [Thu, 12 Dec 2019 05:55:43 +0000 (06:55 +0100)]
build: Resurrect compiling with TinyCC.

   ./configure CC=tcc --host=i686-unknown-linux-gnu --with-courage

* configure: Cater for tcc.

11 months agobuild: Cater for FreeBSD.
Jan Nieuwenhuizen [Wed, 11 Dec 2019 13:04:27 +0000 (13:04 +0000)]
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.

11 months agofreebsd: Initial x86 scaffold.
Jan Nieuwenhuizen [Wed, 11 Dec 2019 08:21:51 +0000 (08:21 +0000)]
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.

11 months agofreebsd: Initial configure support.
Jan Nieuwenhuizen [Wed, 11 Dec 2019 00:10:22 +0000 (00:10 +0000)]
freebsd: Initial configure support.

* configure: Initial FreeBSD configure support.
* configure.sh: Likewise.  Run without bash.

11 months agobuild: Prepare for kernel variants.
Jan Nieuwenhuizen [Wed, 11 Dec 2019 07:16:46 +0000 (07:16 +0000)]
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.

11 months agomescc: Mes C Library: Add ioctl3 stub.
Jan Nieuwenhuizen [Wed, 11 Dec 2019 15:41:41 +0000 (10:41 -0500)]
mescc: Mes C Library: Add ioctl3 stub.

11 months agomescc: Mes C Library: Fix access stub.
Jan Nieuwenhuizen [Sat, 16 Mar 2019 15:36:00 +0000 (16:36 +0100)]
mescc: Mes C Library: Fix access stub.

* lib/stub/access.c (access): Use _open3 to give more meaningful
behaviour.  Fixes hanging of mes.

11 months agohurd: Fixes for upgrade to debian-hurd-20190220.img.
Jan Nieuwenhuizen [Fri, 15 Mar 2019 23:14:05 +0000 (19:14 -0400)]
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.

11 months agohurd: Add malloc.
Jan Nieuwenhuizen [Tue, 12 Mar 2019 22:58:52 +0000 (23:58 +0100)]
hurd: Add malloc.

* include/gnu/syscall.h (__vm_allocate): New value.
(__vm_allocate): Declare.
* lib/gnu/malloc.c: New file.
* lib/stdlib/malloc.c[__GNU__]: Disable.  See FIXME.
* lib/gnu/vm-allocate.c: New file.
* build-aux/configure-lib.sh (libc_SOURCES): Add it.

11 months agohurd: Add open.
Jan Nieuwenhuizen [Wed, 13 Mar 2019 23:08:35 +0000 (00:08 +0100)]
hurd: Add open.

* include/fcntl.h (O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_APPEND,
O_TRUNC)[__GNU__]: Specialize for GNU.
* lib/gnu/dir-lookup.c: New file.
* lib/stdio/fopen.c (fopen): Use O_RDONLY.
* lib/tests/posix/50-open-read.c (main): Likewise.
* lib/tests/stdio/90-fseek.c (main): Likewise.
* include/gnu/syscall.h (SYS__dir_lookup): New value.
* lib/gnu/_open3.c: New file.
* build-aux/configure-lib.sh (libc_SOURCES): Build them.

11 months agohurd: Add argv and environ.
Jan Nieuwenhuizen [Wed, 13 Mar 2019 07:51:44 +0000 (03:51 -0400)]
hurd: Add argv and environ.

* include/gnu/hurd.h (struct hurd_startup_data): Add argp, envp.
* lib/gnu/hurd-start.c (__argv, __env): Define them.
* lib/gnu/exec-startup-get-data.c (mach_startup_info2hurd_startup_data):
Set them.
* lib/gnu/x86-mes-gcc/crt1.c (_start): Use them.
* build-aux/configure-lib.sh (libc_mini_SOURCES): Add argz-extract.c.
* include/argz.h: Build fix.
* lib/string/argz-count.c: Likewise.
* lib/string/argz-extract.c: Likewise.

11 months agohurd: Add stubs for missing libc+tcc functions.
Jan Nieuwenhuizen [Sat, 27 Apr 2019 10:21:10 +0000 (06:21 -0400)]
hurd: Add stubs for missing libc+tcc functions.

* lib/stub/close.c: New file.
* lib/stub/rmdir.c: New file.
* lib/stub/stat.c: New file.
* build-aux/configure-lib.sh (libc_tcc_SOURCES)[gnu]: Add them.

11 months agohurd: Add stubs for missing libc functions.
Jan Nieuwenhuizen [Tue, 12 Mar 2019 21:14:25 +0000 (22:14 +0100)]
hurd: Add stubs for missing libc functions.

* lib/stub/_getcwd.c: New file.
* lib/stub/_getcwd.c: New file.
* lib/stub/_open3.c: New file.
* lib/stub/access.c: New file.
* lib/stub/brk.c: New file.
* lib/stub/chmod.c: New file.
* lib/stub/clock_gettime.c: New file.
* lib/stub/dup.c: New file.
* lib/stub/dup2.c: New file.
* lib/stub/execve.c: New file.
* lib/stub/fork.c: New file.
* lib/stub/gettimeofday.c: New file.
* lib/stub/ioctl.c: New file.
* lib/stub/time.c: New file.
* lib/stub/unlink.c: New file.
* lib/stub/waitpid.c: New file.
* build-aux/configure-lib.sh (libc_SOURCES)[gnu]: Add them.

11 months agohurd: Add stubs for missing libmes functions.
Jan Nieuwenhuizen [Sat, 27 Apr 2019 10:59:43 +0000 (12:59 +0200)]
hurd: Add stubs for missing libmes functions.

* lib/stub/lseek.c: New file.
* build-aux/configure-lib.sh (libmes_SOURCES)[gnu]: Add it.

11 months agohurd: Add _read.
Jan Nieuwenhuizen [Tue, 12 Mar 2019 20:15:30 +0000 (21:15 +0100)]
hurd: Add _read.

* include/gnu/hurd.h (fd_read): Declare.
* include/gnu/syscall.h (SYS__io_read): New value.
* lib/gnu/_read.c: New file.
* lib/gnu/fd-read.c: New file.
* lib/gnu/io-read.c: New file.
* build-aux/configure-lib.sh (libc_SOURCES): Add _read sources.

11 months agohurd: Add _write.
Jan Nieuwenhuizen [Mon, 11 Mar 2019 21:45:56 +0000 (17:45 -0400)]
hurd: Add _write.

* include/gnu/syscall.h (SYS__io_write): Add enum field.
(_hurd_dtable, _hurd_dtable_size): Declare variable.
(fd_get, fd_write, __io_write, __syscall_put): Declare.
* lib/gnu/hurd-start.c (_hurd_dtable, _hurd_dtable_size): Define
variable.
* lib/gnu/_write.c: New file.
* lib/gnu/fd-get.c (fd_get): New file.
* lib/gnu/fd-write.c (fd_write): New file.
* lib/gnu/io-write.c: New file.
* lib/gnu/syscall.c (__syscall_put): New function.
* build-aux/cofnigure-lib.sh (libc_mini_SOURCES): Add write sources.
* lib/tests/mes/30-oputs.c (main): Update.
* lib/tests/mes/30-oputs.stdout: New file.
* lib/tests/mes/30-eputs.c: New test.
* lib/tests/mes/30-eputs.stderr: New file.
* build-aux/check-mescc.sh (TESTS): Add it.

11 months agohurd: Initial support.
Jan Nieuwenhuizen [Sun, 10 Mar 2019 20:52:05 +0000 (16:52 -0400)]
hurd: Initial support.

This adds minimal Hurd support by implementing the _exit function.

* AUTHORS: Update.
* .gitignore: Ignore a.out, core, .config.
* include/sys/wait.h (W_EXITCODE): New define.
* lib/gnu/x86-mes-gcc/crt1.c: New file.
* lib/gnu/x86-mes-gcc/mini.c: New file.
* lib/gnu/hurd-start.c: New file.
* lib/gnu/_exit.c: New file.
* include/gnu/syscall.h: New file.
* include/gnu/hurd.h: New file.
* lib/gnu/_exit.c: New file.
* lib/gnu/exec-startup-get-data.c: New file.
* lib/gnu/hurd-start.c: New file.
* lib/gnu/proc-mark-exit.c: New file.
* lib/gnu/syscall.c: New file.
* lib/gnu/task-get-special-port.c: New file.
* lib/gnu/task-terminate.c: New file.
* lib/gnu/vm-statistics.c: New file.
* build-aux/configure-lib.sh (libc_mini_SOURCES): Add Hurd sources.
* build-aux/build.sh.in (CPPFLAGS): Add lib to includes, to find linux
crt1.c.
* build-aux/test-c.sh: Always use at least -l c+mini for GNU.
* lib/tests/scaffold/30-exit-42.exit: New file.
* lib/tests/scaffold/30-exit-42.c: New test.
* build-aux/check-mescc.sh (TESTS): Add it.
* lib/tests/scaffold/30-exit-0.c (main): Move from 00-exit-0.c; Rewrite,
use _exit.
* include/gnu/hurd-types.h: Import from GNU C Library.
* include/mach/mach-init.h: Likewise.
* lib/mach/mach-init.c: Likewise.
* lib/mach/mach_host_self.S: Likewise.
* lib/mach/mach_msg_trap.S: Likewise.
* lib/mach/mach_reply_port.S: Likewise.
* lib/mach/mach_task_self.S: Likewise.
* lib/mach/mach_thread_self.S: Likewise.
* lib/mach/msg.c: Likewise.

11 months agobuild: Generate ChangeLog reproducibly. Thanks, Timothy!
Jan Nieuwenhuizen [Sun, 8 Dec 2019 20:13:48 +0000 (21:13 +0100)]
build: Generate ChangeLog reproducibly.  Thanks, Timothy!

* build-aux/gitlog-to-changelog (git_dir_option): Avoid non-reproducible
localtime.

11 months agobuild: Make guild optional for bootstrap builds.
Jan Nieuwenhuizen [Sun, 8 Dec 2019 15:39:53 +0000 (16:39 +0100)]
build: Make guild optional for bootstrap builds.

* configure: Use `true' for guild when it is not available.

11 months agobuild: Clean-out .gitignore.
Jan Nieuwenhuizen [Sun, 8 Dec 2019 21:05:14 +0000 (22:05 +0100)]
build: Clean-out .gitignore.

.gitignore: Remove obsolete cross build patterns.

11 months agobuild: Cater for bootstrap build.
Jan Nieuwenhuizen [Sun, 3 Nov 2019 21:15:11 +0000 (22:15 +0100)]
build: Cater for bootstrap build.

* build-aux/build.sh.in: Build bin/mes.  Update scripts and users.
* build-aux/bootstrap.sh.in: Update.
* build-aux/install.sh.in: Install all built bin/mes-* flavours.
* configure: Drop SEED, support --bootstrap.
* configure.sh: Likewise.

11 months agobuild: Oops, have configure honor --host.
Jan Nieuwenhuizen [Sun, 8 Dec 2019 14:48:27 +0000 (15:48 +0100)]
build: Oops, have configure honor --host.

This allows

    ./configure --host=i686-unknown-linux-gnu

instead of

    CC=i686-unknown-linux-gnu-gcc ./configure

* configure (main): Honor --host.

11 months agobootstrap: Default to mesar for mescc build.
Jan Nieuwenhuizen [Sun, 8 Dec 2019 14:15:07 +0000 (15:15 +0100)]
bootstrap: Default to mesar for mescc build.

* configure.sh: Default to mesar for mescc build.

11 months agobootstrap: Fix configure.sh's host detection.
Jan Nieuwenhuizen [Sun, 8 Dec 2019 14:13:37 +0000 (15:13 +0100)]
bootstrap: Fix configure.sh's host detection.

* configure.sh: Avoid setting host="" and not running $CC.