From f91a565fe3c392b909c6293198718c49ce35fb3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 4 Apr 2022 18:57:06 +0200 Subject: [PATCH] gnat*: fixup build with glibc-2.34 --- pkgs/development/compilers/gcc/6/default.nix | 1 + .../compilers/gcc/6/gnat-glibc234.patch | 30 +++++++++++++++++++ pkgs/development/compilers/gcc/9/default.nix | 5 ++++ 3 files changed, 36 insertions(+) create mode 100644 pkgs/development/compilers/gcc/6/gnat-glibc234.patch diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 5191c3b461be..a577c61bdf58 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -74,6 +74,7 @@ let majorVersion = "6"; ] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch ++ optional noSysDirs ../no-sys-dirs.patch ++ optional langAda ../gnat-cflags.patch + ++ optional langAda ./gnat-glibc234.patch ++ optional langFortran ../gfortran-driving.patch ++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch diff --git a/pkgs/development/compilers/gcc/6/gnat-glibc234.patch b/pkgs/development/compilers/gcc/6/gnat-glibc234.patch new file mode 100644 index 000000000000..2d29cd7fa77f --- /dev/null +++ b/pkgs/development/compilers/gcc/6/gnat-glibc234.patch @@ -0,0 +1,30 @@ +Fix build with glibc 2.34. Adapted from: +https://github.com/gcc-mirror/gcc/commit/331763de7d4850702a0f67298f36017c73cdb103 +--- a/gcc/ada/init.c ++++ b/gcc/ada/init.c +@@ -579,12 +579,8 @@ + + #ifndef __ia64__ + #define HAVE_GNAT_ALTERNATE_STACK 1 +-/* This must be in keeping with System.OS_Interface.Alternate_Stack_Size. +- It must be larger than MINSIGSTKSZ and hopefully near 2 * SIGSTKSZ. */ +-# if 16 * 1024 < MINSIGSTKSZ +-# error "__gnat_alternate_stack too small" +-# endif +-char __gnat_alternate_stack[16 * 1024]; ++/* This must be in keeping with System.OS_Interface.Alternate_Stack_Size. */ ++char __gnat_alternate_stack[32 * 1024]; + #endif + + #ifdef __XENO__ +--- a/gcc/ada/s-osinte-linux.ads ++++ b/gcc/ada/s-osinte-linux.ads +@@ -328,7 +328,7 @@ + oss : access stack_t) return int; + pragma Import (C, sigaltstack, "sigaltstack"); + +- Alternate_Stack_Size : constant := 16 * 1024; ++ Alternate_Stack_Size : constant := 32 * 1024; + -- This must be in keeping with init.c:__gnat_alternate_stack + + Alternate_Stack : aliased char_array (1 .. Alternate_Stack_Size); diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix index a96a23da2ced..dd1a53e172a4 100644 --- a/pkgs/development/compilers/gcc/9/default.nix +++ b/pkgs/development/compilers/gcc/9/default.nix @@ -83,6 +83,11 @@ let majorVersion = "9"; sha256 = ""; # TODO: uncomment and check hash when available. }) */ ++ optional langAda ../gnat-cflags.patch + ++ optional langAda (fetchpatch { + name = "gnat-glibc-234.diff"; + url = "https://github.com/gcc-mirror/gcc/commit/331763de7d4850702a0f67298f36017c73cdb103.diff"; + sha256 = "eS4B7vJasnv2N+5v5yB8/iDpKPX8CJDAy2xabWWj+aU="; + }) ++ optional langD ../libphobos.patch ++ optional langFortran ../gfortran-driving.patch ++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch