From 4f03d62ec2dda2011e4843af277229318d21f517 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Thu, 28 Dec 2023 13:48:42 -0500 Subject: [PATCH 1/3] sbcl: 2.3.11 -> 2.4.0 --- pkgs/development/compilers/sbcl/2.x.nix | 6 +++--- pkgs/top-level/all-packages.nix | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkgs/development/compilers/sbcl/2.x.nix b/pkgs/development/compilers/sbcl/2.x.nix index 7e7c2d63fffe..85e0689b8638 100644 --- a/pkgs/development/compilers/sbcl/2.x.nix +++ b/pkgs/development/compilers/sbcl/2.x.nix @@ -18,12 +18,12 @@ let sha256 = "189gjqzdz10xh3ybiy4ch1r98bsmkcb4hpnrmggd4y2g5kqnyx4y"; }; - "2.3.10" = { - sha256 = "sha256-NYAzMV0H5MWmyDjufyLPxNSelISOtx7BOJ1JS8Mt0qs="; - }; "2.3.11" = { sha256 = "sha256-hL7rjXLIeJeEf8AoWtyz+k9IG9s5ECxPuat5aEGErSk="; }; + "2.4.0" = { + sha256 = "sha256-g9i3TwjSJUxZuXkLwfZp4JCZRXuIRyDs7L9F9LRtF3Y="; + }; }; # Collection of pre-built SBCL binaries for platforms that need them for # bootstrapping. Ideally these are to be avoided. If CLISP (or any other diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4a5a6f9df840..c5cf67578184 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26082,17 +26082,17 @@ with pkgs; }; # Steel Bank Common Lisp - sbcl_2_3_10 = wrapLisp { - pkg = callPackage ../development/compilers/sbcl/2.x.nix { version = "2.3.10"; }; - faslExt = "fasl"; - flags = [ "--dynamic-space-size" "3000" ]; - }; sbcl_2_3_11 = wrapLisp { pkg = callPackage ../development/compilers/sbcl/2.x.nix { version = "2.3.11"; }; faslExt = "fasl"; flags = [ "--dynamic-space-size" "3000" ]; }; - sbcl = sbcl_2_3_11; + sbcl_2_4_0 = wrapLisp { + pkg = callPackage ../development/compilers/sbcl/2.x.nix { version = "2.4.0"; }; + faslExt = "fasl"; + flags = [ "--dynamic-space-size" "3000" ]; + }; + sbcl = sbcl_2_4_0; sbclPackages = recurseIntoAttrs sbcl.pkgs; From d11f8b4c277f04873d6283a266d82a3a800422f6 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Tue, 2 Jan 2024 12:52:50 -0500 Subject: [PATCH 2/3] sbcl: use new GC and backport compilation fix --- pkgs/development/compilers/sbcl/2.x.nix | 10 +++-- .../sbcl/fix-2.4.0-aarch64-darwin.patch | 39 +++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/compilers/sbcl/fix-2.4.0-aarch64-darwin.patch diff --git a/pkgs/development/compilers/sbcl/2.x.nix b/pkgs/development/compilers/sbcl/2.x.nix index 85e0689b8638..751e365dbbba 100644 --- a/pkgs/development/compilers/sbcl/2.x.nix +++ b/pkgs/development/compilers/sbcl/2.x.nix @@ -7,6 +7,7 @@ # to get rid of ${glibc} dependency. , purgeNixReferences ? false , coreCompression ? lib.versionAtLeast version "2.2.6" +, markRegionGC ? lib.versionAtLeast version "2.4.0" , texinfo , version }: @@ -80,8 +81,10 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ texinfo ]; buildInputs = lib.optionals coreCompression [ zstd ]; - # There are no patches necessary for the currently enabled versions, but this - # code is left in place for the next potential patch. + patches = lib.optionals (stdenv.hostPlatform.system == "aarch64-darwin" && version == "2.4.0") [ + ./fix-2.4.0-aarch64-darwin.patch + ]; + postPatch = '' echo '"${version}.nixos"' > version.lisp-expr @@ -128,7 +131,8 @@ stdenv.mkDerivation rec { optional threadSupport "sb-thread" ++ optional linkableRuntime "sb-linkable-runtime" ++ optional coreCompression "sb-core-compression" ++ - optional stdenv.isAarch32 "arm"; + optional stdenv.isAarch32 "arm" ++ + optional markRegionGC "mark-region-gc"; disableFeatures = with lib; optional (!threadSupport) "sb-thread" ++ diff --git a/pkgs/development/compilers/sbcl/fix-2.4.0-aarch64-darwin.patch b/pkgs/development/compilers/sbcl/fix-2.4.0-aarch64-darwin.patch new file mode 100644 index 000000000000..cd344f0cbd19 --- /dev/null +++ b/pkgs/development/compilers/sbcl/fix-2.4.0-aarch64-darwin.patch @@ -0,0 +1,39 @@ +From aed233638604b46c9a0c51e08d096d47303375ca Mon Sep 17 00:00:00 2001 +From: Douglas Katzman +Date: Tue, 2 Jan 2024 09:20:48 -0500 +Subject: [PATCH] Fix multiple def error + +reported by Hraban Luyat +--- + src/runtime/gc-common.c | 1 + + src/runtime/gc.h | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/runtime/gc-common.c b/src/runtime/gc-common.c +index 51963b8ff..07536f628 100644 +--- a/src/runtime/gc-common.c ++++ b/src/runtime/gc-common.c +@@ -2999,6 +2999,7 @@ void recompute_gen_bytes_allocated() { + #endif + + #ifdef LISP_FEATURE_DARWIN_JIT ++_Atomic(char) *page_execp; + #include "sys_mmap.inc" + #include + /* darwin-jit has another reason to remap besides just zeroing, namely, +diff --git a/src/runtime/gc.h b/src/runtime/gc.h +index 804e6fce2..5fdc215c2 100644 +--- a/src/runtime/gc.h ++++ b/src/runtime/gc.h +@@ -151,7 +151,7 @@ extern void prepare_pages(bool commit, page_index_t start, page_index_t end, + * squeeze a bit into the 'type' field of the page table, but it's clearer to + * have this externally so that page type 0 remains as "free" */ + #ifdef LISP_FEATURE_DARWIN_JIT +-_Atomic(char) *page_execp; ++extern _Atomic(char) *page_execp; + static inline void set_page_executable(page_index_t i, bool val) { page_execp[i] = val; } + #endif + +-- +2.42.0 + From 51c0a89b26be77fd9f3a065499ee8d67f23dae80 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Sat, 6 Jan 2024 23:09:33 -0500 Subject: [PATCH 3/3] sbcl: apply 2.4.0 patch to all archs Upstream has mainlined this patch, the preprocessor macros take care of only applying the code where necessary. There is no need for nixpkgs to if-guard it further. --- pkgs/development/compilers/sbcl/2.x.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/sbcl/2.x.nix b/pkgs/development/compilers/sbcl/2.x.nix index 751e365dbbba..f91e5147cf6a 100644 --- a/pkgs/development/compilers/sbcl/2.x.nix +++ b/pkgs/development/compilers/sbcl/2.x.nix @@ -81,7 +81,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ texinfo ]; buildInputs = lib.optionals coreCompression [ zstd ]; - patches = lib.optionals (stdenv.hostPlatform.system == "aarch64-darwin" && version == "2.4.0") [ + patches = lib.optionals (version == "2.4.0") [ ./fix-2.4.0-aarch64-darwin.patch ];