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.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-10-06 10:33:55 +02:00
parent be87ada6b5
commit 84ff05a839
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
8 changed files with 43 additions and 21 deletions

View file

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# GNU Mes --- Maxwell Equations of Software # GNU Mes --- Maxwell Equations of Software
# Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # Copyright © 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# #
# This file is part of GNU Mes. # This file is part of GNU Mes.
# #
@ -36,6 +36,7 @@ lib/mes/oputs.c
if test $mes_libc = mes; then if test $mes_libc = mes; then
libc_mini_shared_SOURCES="$libc_mini_shared_SOURCES libc_mini_shared_SOURCES="$libc_mini_shared_SOURCES
lib/mes/globals.c
lib/$mes_kernel/$mes_cpu-mes-$compiler/mini.c lib/$mes_kernel/$mes_cpu-mes-$compiler/mini.c
lib/stdlib/exit.c lib/stdlib/exit.c
lib/stdlib/puts.c lib/stdlib/puts.c
@ -77,6 +78,7 @@ lib/mes/mini-write.c
fi fi
libmescc_SOURCES=" libmescc_SOURCES="
lib/mes/globals.c
lib/linux/$mes_cpu-mes-$compiler/syscall-internal.c lib/linux/$mes_cpu-mes-$compiler/syscall-internal.c
lib/mes/div.c lib/mes/div.c
" "

View file

@ -47,7 +47,7 @@ then
fi fi
if [ -z "${i/[012][0-9]-*/}" ]; then 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 elif [ -z "${i/[34][0-9]-*/}" ]; then
LIBS="-l c-mini ${MES_CHECKING_BUILTIN_LIBS} -l c-mini" LIBS="-l c-mini ${MES_CHECKING_BUILTIN_LIBS} -l c-mini"
elif [ -z "${i/[78][0-9a-z]-*/}" ]; then elif [ -z "${i/[78][0-9a-z]-*/}" ]; then

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2017,2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -31,10 +31,9 @@
#ifndef __MES_ERRNO_T #ifndef __MES_ERRNO_T
#define __MES_ERRNO_T 1 #define __MES_ERRNO_T 1
typedef int error_t; typedef int error_t;
int errno;
#endif // !__MES_ERRNO_T #endif // !__MES_ERRNO_T
int errno; extern int errno;
#define ENOENT 2 #define ENOENT 2
#define EINTR 4 #define EINTR 4
#define EIO 5 #define EIO 5

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -40,10 +40,10 @@
#define STDERR 2 #define STDERR 2
#endif #endif
char **environ; extern char **environ;
int __stdin; extern int __stdin;
int __stdout; extern int __stdout;
int __stderr; extern int __stderr;
int eputs (char const *s); int eputs (char const *s);
int puts (char const *s); int puts (char const *s);
@ -87,7 +87,7 @@ typedef long ssize_t;
#ifndef __MES_ERRNO_T #ifndef __MES_ERRNO_T
#define __MES_ERRNO_T 1 #define __MES_ERRNO_T 1
typedef int error_t; typedef int error_t;
int errno; extern int errno;
#endif // !__MES_ERRNO_T #endif // !__MES_ERRNO_T
size_t strlen (char const *s); size_t strlen (char const *s);

View file

@ -43,12 +43,6 @@ typedef struct
#endif #endif
typedef __jmp_buf jmp_buf[1]; typedef __jmp_buf jmp_buf[1];
#if __MESC__
__jmp_buf buf[1];
#else
jmp_buf buf;
#endif
void longjmp (jmp_buf env, int val); void longjmp (jmp_buf env, int val);
int setjmp (jmp_buf env); int setjmp (jmp_buf env);

View file

@ -18,7 +18,7 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <mes/lib.h> #include <mes/lib-mini.h>
#include <string.h> #include <string.h>
int int

27
lib/mes/globals.c Normal file
View file

@ -0,0 +1,27 @@
/*
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int errno;
char **environ;
int __stdin;
int __stdout;
int __stderr;

View file

@ -18,7 +18,7 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <mes/lib.h> #include <mes/lib-mini.h>
#include <string.h> #include <string.h>
int int