Commit 71a076af authored by Adam Wujek's avatar Adam Wujek

[BUG: #269] WIP patches/buildroot: fix build errors on ubuntu 22.04

Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 1f2ef410
From 39ecbca2538a092f6fb04b82990721185e4287e4 Mon Sep 17 00:00:00 2001
From: Adam Wujek <dev_public@wujek.eu>
Date: Thu, 26 Jan 2023 14:59:28 +0100
Subject: [PATCH] fix compilation error of m4 on ubuntu 22.04
Signed-off-by: Adam Wujek <dev_public@wujek.eu>
---
...x-compilation-of-m4-for-ubuntu-22.04.patch | 109 ++++++++++++++++++
1 file changed, 109 insertions(+)
create mode 100644 package/m4/0002-fix-compilation-of-m4-for-ubuntu-22.04.patch
diff --git a/package/m4/0002-fix-compilation-of-m4-for-ubuntu-22.04.patch b/package/m4/0002-fix-compilation-of-m4-for-ubuntu-22.04.patch
new file mode 100644
index 0000000..9c7886a
--- /dev/null
+++ b/package/m4/0002-fix-compilation-of-m4-for-ubuntu-22.04.patch
@@ -0,0 +1,109 @@
+From 49c981e6a06d0ec902f3880f178051597c3bd1bd Mon Sep 17 00:00:00 2001
+From: Adam Wujek <dev_public@wujek.eu>
+Date: Thu, 26 Jan 2023 14:57:17 +0100
+Subject: [PATCH] fix compilation of m4 for ubuntu 22.04
+
+https://raw.githubusercontent.com/keyfour/openwrt/2722d51c5cf6a296b8ecf7ae09e46690403a6c3d/tools/m4/patches/011-fix-sigstksz.patch
+
+Signed-off-by: Adam Wujek <dev_public@wujek.eu>
+---
+ lib/c-stack.c | 45 +++++++++++++++++----------------------------
+ lib/c-stack.h | 2 +-
+ 2 files changed, 18 insertions(+), 29 deletions(-)
+
+diff --git a/lib/c-stack.c b/lib/c-stack.c
+index 03db242..b2a7b41 100644
+--- a/lib/c-stack.c
++++ b/lib/c-stack.c
+@@ -50,15 +50,16 @@
+ #if ! HAVE_STACK_T && ! defined stack_t
+ typedef struct sigaltstack stack_t;
+ #endif
+-#ifndef SIGSTKSZ
+-# define SIGSTKSZ 16384
+-#elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
+-/* libsigsegv 2.6 through 2.8 have a bug where some architectures use
+- more than the Linux default of an 8k alternate stack when deciding
+- if a fault was caused by stack overflow. */
+-# undef SIGSTKSZ
+-# define SIGSTKSZ 16384
+-#endif
++/* Storage for the alternate signal stack.
++ * 64 KiB is not too large for Gnulib-using apps, and is large enough
++ * for all known platforms. Smaller sizes may run into trouble.
++ * For example, libsigsegv 2.6 through 2.8 have a bug where some
++ * architectures use more than the Linux default of an 8 KiB alternate
++ * stack when deciding if a fault was caused by stack overflow. */
++static max_align_t alternate_signal_stack[(64 * 1024
++ + sizeof (max_align_t) - 1)
++ / sizeof (max_align_t)];
++
+
+ #include <stdlib.h>
+ #include <string.h>
+@@ -129,18 +130,6 @@ die (int signo)
+ #if (HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK \
+ && HAVE_STACK_OVERFLOW_HANDLING) || HAVE_LIBSIGSEGV
+
+-/* Storage for the alternate signal stack. */
+-static union
+-{
+- char buffer[SIGSTKSZ];
+-
+- /* These other members are for proper alignment. There's no
+- standard way to guarantee stack alignment, but this seems enough
+- in practice. */
+- long double ld;
+- long l;
+- void *p;
+-} alternate_signal_stack;
+
+ static void
+ null_action (int signo __attribute__ ((unused)))
+@@ -206,8 +195,8 @@ c_stack_action (void (*action) (int))
+
+ /* Always install the overflow handler. */
+ if (stackoverflow_install_handler (overflow_handler,
+- alternate_signal_stack.buffer,
+- sizeof alternate_signal_stack.buffer))
++ alternate_signal_stack,
++ sizeof alternate_signal_stack))
+ {
+ errno = ENOTSUP;
+ return -1;
+@@ -280,14 +269,14 @@ c_stack_action (void (*action) (int))
+ stack_t st;
+ struct sigaction act;
+ st.ss_flags = 0;
++ st.ss_sp = alternate_signal_stack;
++ st.ss_size = sizeof alternate_signal_stack;
+ # if SIGALTSTACK_SS_REVERSED
+ /* Irix mistakenly treats ss_sp as the upper bound, rather than
+ lower bound, of the alternate stack. */
+- st.ss_sp = alternate_signal_stack.buffer + SIGSTKSZ - sizeof (void *);
+- st.ss_size = sizeof alternate_signal_stack.buffer - sizeof (void *);
+-# else
+- st.ss_sp = alternate_signal_stack.buffer;
+- st.ss_size = sizeof alternate_signal_stack.buffer;
++ st.ss_size -= sizeof (void *);
++ char *ss_sp = st.ss_sp;
++ st.ss_sp = ss_sp + st.ss_size;
+ # endif
+ r = sigaltstack (&st, NULL);
+ if (r != 0)
+diff --git a/lib/c-stack.h b/lib/c-stack.h
+index 2e61bdf..08719de 100644
+--- a/lib/c-stack.h
++++ b/lib/c-stack.h
+@@ -34,7 +34,7 @@
+ A null ACTION acts like an action that does nothing.
+
+ ACTION must be async-signal-safe. ACTION together with its callees
+- must not require more than SIGSTKSZ bytes of stack space. Also,
++ must not require more than 64 KiB of stack space. Also,
+ ACTION should not call longjmp, because this implementation does
+ not guarantee that it is safe to return to the original stack.
+
+--
+2.25.1
+
--
2.25.1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment