diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh index 1b30c4dc..84e1283e 100644 --- a/build-aux/configure-lib.sh +++ b/build-aux/configure-lib.sh @@ -1,7 +1,7 @@ #! /bin/sh # GNU Mes --- Maxwell Equations of Software -# Copyright © 2019 Jan (janneke) Nieuwenhuizen +# Copyright © 2019, 2020 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # @@ -36,6 +36,7 @@ lib/mes/oputs.c if test $mes_libc = mes; then libc_mini_shared_SOURCES="$libc_mini_shared_SOURCES +lib/mes/globals.c lib/$mes_kernel/$mes_cpu-mes-$compiler/mini.c lib/stdlib/exit.c lib/stdlib/puts.c @@ -77,6 +78,7 @@ lib/mes/mini-write.c fi libmescc_SOURCES=" +lib/mes/globals.c lib/linux/$mes_cpu-mes-$compiler/syscall-internal.c lib/mes/div.c " diff --git a/build-aux/test-c.sh b/build-aux/test-c.sh index 5d7875f7..723764cb 100755 --- a/build-aux/test-c.sh +++ b/build-aux/test-c.sh @@ -47,7 +47,7 @@ then fi if [ -z "${i/[012][0-9]-*/}" ]; then - LIBS="${MES_CHECKING_BUILTIN_LIBS}" + LIBS="${MES_CHECKING_BUILTIN_LIBS} -l c-mini" elif [ -z "${i/[34][0-9]-*/}" ]; then LIBS="-l c-mini ${MES_CHECKING_BUILTIN_LIBS} -l c-mini" elif [ -z "${i/[78][0-9a-z]-*/}" ]; then diff --git a/include/errno.h b/include/errno.h index 7ac1ebe9..b191c410 100644 --- a/include/errno.h +++ b/include/errno.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2018,2020 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -31,10 +31,9 @@ #ifndef __MES_ERRNO_T #define __MES_ERRNO_T 1 typedef int error_t; -int errno; #endif // !__MES_ERRNO_T -int errno; +extern int errno; #define ENOENT 2 #define EINTR 4 #define EIO 5 @@ -58,8 +57,8 @@ int errno; #define ERANGE 34 #define ENAMETOOLONG 36 -#define ENOSYS 38 -#define ELOOP 40 +#define ENOSYS 38 +#define ELOOP 40 #if !__MESC__ //extern char const *const sys_errlist[]; diff --git a/include/mes/lib-mini.h b/include/mes/lib-mini.h index 4cc8d96d..2874d527 100644 --- a/include/mes/lib-mini.h +++ b/include/mes/lib-mini.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2020 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -40,10 +40,10 @@ #define STDERR 2 #endif -char **environ; -int __stdin; -int __stdout; -int __stderr; +extern char **environ; +extern int __stdin; +extern int __stdout; +extern int __stderr; int eputs (char const *s); int puts (char const *s); @@ -87,7 +87,7 @@ typedef long ssize_t; #ifndef __MES_ERRNO_T #define __MES_ERRNO_T 1 typedef int error_t; -int errno; +extern int errno; #endif // !__MES_ERRNO_T size_t strlen (char const *s); diff --git a/include/setjmp.h b/include/setjmp.h index a725bb19..a283cd61 100644 --- a/include/setjmp.h +++ b/include/setjmp.h @@ -43,12 +43,6 @@ typedef struct #endif typedef __jmp_buf jmp_buf[1]; -#if __MESC__ -__jmp_buf buf[1]; -#else -jmp_buf buf; -#endif - void longjmp (jmp_buf env, int val); int setjmp (jmp_buf env); diff --git a/lib/mes/eputs.c b/lib/mes/eputs.c index 4ffcbc96..26bb3e01 100644 --- a/lib/mes/eputs.c +++ b/lib/mes/eputs.c @@ -18,7 +18,7 @@ * along with GNU Mes. If not, see . */ -#include +#include #include int diff --git a/lib/mes/globals.c b/lib/mes/globals.c new file mode 100644 index 00000000..f5c63e3f --- /dev/null +++ b/lib/mes/globals.c @@ -0,0 +1,27 @@ +/* + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2020 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include + +int errno; +char **environ; +int __stdin; +int __stdout; +int __stderr; diff --git a/lib/mes/oputs.c b/lib/mes/oputs.c index 3d1e4382..cc00528c 100644 --- a/lib/mes/oputs.c +++ b/lib/mes/oputs.c @@ -18,7 +18,7 @@ * along with GNU Mes. If not, see . */ -#include +#include #include int