1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
|
From 84ff05a839fa39f07fe5f3ccf8dda396eae305c7 Mon Sep 17 00:00:00 2001
From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
Date: Tue, 6 Oct 2020 10:33:55 +0200
Subject: [PATCH 1/2] 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.
---
build-aux/configure-lib.sh | 9 ++++++++-
build-aux/test-c.sh | 2 +-
include/errno.h | 9 ++++-----
include/mes/lib-mini.h | 12 ++++++------
include/setjmp.h | 6 ------
lib/mes/eputs.c | 2 +-
lib/mes/globals.c | 27 +++++++++++++++++++++++++++
lib/mes/oputs.c | 2 +-
8 files changed, 48 insertions(+), 21 deletions(-)
create mode 100644 lib/mes/globals.c
diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh
index ed0e23bb..9c66dacb 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 <janneke@gnu.org>
+# Copyright © 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# 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
@@ -76,6 +77,12 @@ 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
+"
+
libmes_SOURCES="
$libc_mini_shared_SOURCES
lib/ctype/isnumber.c
diff --git a/build-aux/test-c.sh b/build-aux/test-c.sh
index 00844075..10bd498b 100755
--- a/build-aux/test-c.sh
+++ b/build-aux/test-c.sh
@@ -41,7 +41,7 @@ CC=${CC-gcc}
i=$(basename "$t" .c)
if [ -z "${i/[012][0-9]-*/}" ]; then
- LIBS=
+ LIBS="${MES_CHECKING_BUILTIN_LIBS} -l c-mini"
elif [ -z "${i/[34][0-9]-*/}" ]; then
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 <janneke@gnu.org>
+ * Copyright © 2017,2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* 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 <janneke@gnu.org>
+ * Copyright © 2016,2017,2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* 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 512ea111..7c3ead74 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -33,12 +33,6 @@ typedef struct
} __jmp_buf;
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 <http://www.gnu.org/licenses/>.
*/
-#include <mes/lib.h>
+#include <mes/lib-mini.h>
#include <string.h>
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 <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;
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 <http://www.gnu.org/licenses/>.
*/
-#include <mes/lib.h>
+#include <mes/lib-mini.h>
#include <string.h>
int
--
2.20.1
|