From 2b6ba2ca90e3f1263cafe8925b6115b717d5e785 Mon Sep 17 00:00:00 2001 From: John Millikin Date: Thu, 28 Apr 2022 12:49:49 +0900 Subject: [PATCH] Stub out `SIGSTKSZ` to fix build on GNU libc >= 2.34. Fixes https://github.com/jmillikin/rules_m4/issues/9 GitOrigin-RevId: f64e7cbadc158e169f4e234feea7bff1b1acb12d --- m4/internal/gnulib/gnulib.bzl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/m4/internal/gnulib/gnulib.bzl b/m4/internal/gnulib/gnulib.bzl index 53d5ff5..85d19d9 100644 --- a/m4/internal/gnulib/gnulib.bzl +++ b/m4/internal/gnulib/gnulib.bzl @@ -133,6 +133,18 @@ static const char * _replaced_get_charset_aliases (void) "static _Noreturn void": "static _Noreturn __attribute_noreturn__ void", }) + # If _GNU_SOURCE is defined, some versions of GNU libc define SIGSTKSZ to + # be a function call. This breaks an assumption in gnulib that SIGSTKSZ is + # a macro constant. + # + # If undefined, gnulib sets it to a reasonable default instead of failing + # to compile. + # + # https://github.com/jmillikin/rules_m4/issues/9 + ctx.template("gnulib/lib/c-stack.c", "gnulib/lib/c-stack.c", substitutions = { + "SIGSTKSZ": "GNULIB_SIGSTKSZ", + }) + _WINDOWS_STDLIB_SHIMS = [ "alloca", "errno",