at master 1.0 kB view raw
1From dfb5e954a04f59b0456cc4c0ddf3acaf22e0ff07 Mon Sep 17 00:00:00 2001 2From: Richard W.M. Jones <rjones@redhat.com> 3Date: Feb 28 2021 20:45:47 +0000 4Subject: Workaround for glibc non-constant SIGSTKSZ 5 6 7https://github.com/ocaml/ocaml/issues/10250 8 9Signed-off-by: Richard W.M. Jones <rjones@redhat.com> 10 11--- 12 13diff --git a/runtime/signals_nat.c b/runtime/signals_nat.c 14index 8b64ab4..7f0a975 100644 15--- a/runtime/signals_nat.c 16+++ b/runtime/signals_nat.c 17@@ -181,7 +181,19 @@ DECLARE_SIGNAL_HANDLER(trap_handler) 18 #error "CONTEXT_SP is required if HAS_STACK_OVERFLOW_DETECTION is defined" 19 #endif 20 21+#ifndef __GLIBC__ 22 static char sig_alt_stack[SIGSTKSZ]; 23+#else 24+/* glibc 2.34 has non-constant SIGSTKSZ */ 25+static char *sig_alt_stack; 26+ 27+static void allocate_sig_alt_stack(void) __attribute__((constructor)); 28+static void 29+allocate_sig_alt_stack(void) 30+{ 31+ sig_alt_stack = malloc(SIGSTKSZ); 32+} 33+#endif 34 35 /* Code compiled with ocamlopt never accesses more than 36 EXTRA_STACK bytes below the stack pointer. */ 37