build: cancel -fhardened; fix termcap for GCC 16; regenerate pam-redbear lock
Three GCC 16 gaps found by the redbear-full build.
-fhardened (seatd and other meson recipes, 24 errors)
-fhardened is a host-glibc hardening bundle x86_64-unknown-redox cannot
implement, but GCC accepts it on the command line, so meson's
cc.has_argument('-fhardened') probe answers YES and meson adds it to
every compile. GCC then refuses it for real:
cc1: error: '-fhardened' not supported for this target [-Werror]
Note the tag is [-Werror], not [-Werror=hardened] -- it is an
unconditional warning, so -Wno-hardened does not silence it (tried, and
it did not). The flag has to be cancelled instead; -fno-hardened does
that cleanly and the cookbook's flags are appended after the project's
own, so it wins. Nothing is weakened: the compiler is telling us the
option is inert on this target.
termcap (two independent defects, both latent until now)
1. Makefile.in hardcoded 'CFLAGS = -g' and has no @CFLAGS@ substitution
at all, so nothing configure resolved ever reached the compiler --
including the toolchain's default C dialect. termcap is pre-ANSI
code, so being compiled as GCC 16's default C23 failed at once with
'too many arguments to function malloc; expected 0, have 1'.
Substituting @CFLAGS@ is what a normal autotools Makefile.in does.
2. With CFLAGS flowing, the remaining errors were implicit declarations
of strlen/memcpy/exit/write, which GCC 14+ makes errors regardless of
-std. Cause: autoconf 2.70+ removed AC_HEADER_STDC, so STDC_HEADERS
is never defined and termcap.c/tparam.c took their pre-ANSI branch,
declaring 'char *malloc ();' instead of including <stdlib.h>.
Autoconf's guidance on dropping AC_HEADER_STDC is to assume those
headers exist, which holds for every target Red Bear builds.
pam-redbear
Cargo.lock missed by the earlier sweep; regenerated for the 0.3.2 fork
versions.
termcap and seatd now cook clean.
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
Second half: autoconf 2.70+ removed AC_HEADER_STDC, so STDC_HEADERS is never
|
||||
defined and termcap.c/tparam.c fell through to their pre-ANSI branch --
|
||||
declaring `char *malloc ();` instead of including <stdlib.h>/<string.h>.
|
||||
GCC 14+ makes implicit declarations an error, so even with -std=gnu17 the
|
||||
build fails on strlen/memcpy/exit/strcpy/strcmp/write. Autoconf's own
|
||||
guidance on dropping AC_HEADER_STDC is to assume those headers exist, which
|
||||
holds for every target Red Bear builds, so include them unconditionally.
|
||||
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -31,7 +31,10 @@
|
||||
|
||||
DEFS = @DEFS@ -DTERMCAP_FILE=\"$(termcapfile)\"
|
||||
|
||||
-CFLAGS = -g
|
||||
+# Red Bear: was hardcoded to `-g`, which discarded everything configure
|
||||
+# computed. Substitute what configure resolved, as a normal autotools
|
||||
+# Makefile.in does.
|
||||
+CFLAGS = @CFLAGS@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
--- a/termcap.c
|
||||
+++ b/termcap.c
|
||||
@@ -36,17 +36,20 @@
|
||||
|
||||
#else /* not emacs */
|
||||
|
||||
-#ifdef STDC_HEADERS
|
||||
+/* Red Bear: autoconf 2.70+ removed AC_HEADER_STDC, so STDC_HEADERS is never
|
||||
+ defined any more and this fell through to the pre-ANSI branch. Under GCC 14+
|
||||
+ that is fatal -- implicit declarations are errors -- giving
|
||||
+ error: implicit declaration of function 'strlen'
|
||||
+ error: implicit declaration of function 'memcpy'
|
||||
+ and the K&R `char *malloc ();` declarations conflict with the real
|
||||
+ prototypes. Autoconf's own guidance on dropping AC_HEADER_STDC is to assume
|
||||
+ these headers exist, which is true for every target Red Bear builds. */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
-#else
|
||||
-char *getenv ();
|
||||
-char *malloc ();
|
||||
-char *realloc ();
|
||||
-#endif
|
||||
+#include <unistd.h>
|
||||
|
||||
/* Do this after the include, in case string.h prototypes bcopy. */
|
||||
-#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
|
||||
+#if !defined(bcopy) /* Red Bear: <string.h> is now unconditional */
|
||||
#define bcopy(s, d, n) memcpy ((d), (s), (n))
|
||||
#endif
|
||||
|
||||
--- a/tparam.c
|
||||
+++ b/tparam.c
|
||||
@@ -25,16 +25,20 @@
|
||||
#include "lisp.h" /* for xmalloc */
|
||||
#else
|
||||
|
||||
-#ifdef STDC_HEADERS
|
||||
+/* Red Bear: autoconf 2.70+ removed AC_HEADER_STDC, so STDC_HEADERS is never
|
||||
+ defined any more and this fell through to the pre-ANSI branch. Under GCC 14+
|
||||
+ that is fatal -- implicit declarations are errors -- giving
|
||||
+ error: implicit declaration of function 'strlen'
|
||||
+ error: implicit declaration of function 'memcpy'
|
||||
+ and the K&R `char *malloc ();` declarations conflict with the real
|
||||
+ prototypes. Autoconf's own guidance on dropping AC_HEADER_STDC is to assume
|
||||
+ these headers exist, which is true for every target Red Bear builds. */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
-#else
|
||||
-char *malloc ();
|
||||
-char *realloc ();
|
||||
-#endif
|
||||
+#include <unistd.h>
|
||||
|
||||
/* Do this after the include, in case string.h prototypes bcopy. */
|
||||
-#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
|
||||
+#if !defined(bcopy) /* Red Bear: <string.h> is now unconditional */
|
||||
#define bcopy(s, d, n) memcpy ((d), (s), (n))
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
||||
|
||||
[[package]]
|
||||
name = "pam"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
dependencies = [
|
||||
"redbear-login-protocol",
|
||||
"serde_json",
|
||||
@@ -42,7 +42,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redbear-login-protocol"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
||||
@@ -186,6 +186,7 @@ static_assert(std::is_signed_v<qint128>,
|
||||
#include <assert.h>
|
||||
#include <assert.h>
|
||||
#include <assert.h>
|
||||
#include <assert.h>
|
||||
#ifndef static_assert
|
||||
#define static_assert _Static_assert
|
||||
#endif
|
||||
|
||||
@@ -1141,6 +1141,7 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
|
||||
#ifdef IPV6_HOPLIMIT
|
||||
#ifdef IPV6_HOPLIMIT
|
||||
#ifdef IPV6_HOPLIMIT
|
||||
#ifdef IPV6_HOPLIMIT
|
||||
#ifdef IPV6_HOPLIMIT
|
||||
if (header.hopLimit != -1) {
|
||||
msg.msg_controllen += CMSG_SPACE(sizeof(int));
|
||||
@@ -1157,6 +1158,7 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
if (header.ifindex != 0 || !header.senderAddress.isNull()) {
|
||||
struct in6_pktinfo *data = reinterpret_cast<in6_pktinfo *>(CMSG_DATA(cmsgptr));
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/termcap/01-honour-configure-cflags.patch
|
||||
@@ -5,6 +5,9 @@ version = "1.3.1"
|
||||
[source]
|
||||
tar = "https://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz"
|
||||
blake3 = "57c095e0bb6e60e7b4a0597f51f7ac15b501ca0f95d37424d8d13978d28b8da3"
|
||||
patches = [
|
||||
"01-honour-configure-cflags.patch"
|
||||
]
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
|
||||
@@ -136,6 +136,23 @@ export CPPFLAGS="${CPPFLAGS:+$CPPFLAGS }-I${COOKBOOK_SYSROOT}/include"
|
||||
# (std::ranges::to), which is the reason for the GCC 16 upgrade.
|
||||
export CFLAGS="${CFLAGS:+$CFLAGS }-std=gnu17"
|
||||
|
||||
# -fhardened is a host-glibc hardening bundle that x86_64-unknown-redox
|
||||
# cannot implement. GCC still *accepts* the flag on the command line, so a
|
||||
# meson project's cc.has_argument('-fhardened') probe answers YES and meson
|
||||
# adds it to every compile; GCC then refuses it for real:
|
||||
# cc1: error: '-fhardened' not supported for this target [-Werror]
|
||||
# and the project's -Werror makes it fatal. seatd died on this 24 times.
|
||||
#
|
||||
# Note the diagnostic is tagged [-Werror], not [-Werror=hardened]: it is an
|
||||
# unconditional warning, so -Wno-hardened does NOT silence it (verified).
|
||||
# The flag itself has to be cancelled, and -fno-hardened does that cleanly.
|
||||
# The cookbook's flags are appended after the project's own, so this wins.
|
||||
#
|
||||
# This does not weaken anything: -fhardened is inert on this target by
|
||||
# construction — the compiler is telling us it cannot honour it.
|
||||
export CFLAGS="${CFLAGS} -fno-hardened"
|
||||
export CXXFLAGS="${CXXFLAGS:+$CXXFLAGS }-fno-hardened"
|
||||
|
||||
# This adds the sysroot libraries and compiles binaries statically for most C compilation
|
||||
#TODO: check paths for spaces!
|
||||
USER_LDFLAGS="${LDFLAGS:+$LDFLAGS }"
|
||||
|
||||
Reference in New Issue
Block a user