From 4eb57ebe920958e2482a9fdfcdd5dd2bdf40c0fe Mon Sep 17 00:00:00 2001 From: alyaeanyx Date: Sun, 18 May 2025 16:09:22 +0200 Subject: [PATCH] ocamlPackages.ocaml_intrinsics: fix ARM CRC32 intrinsics This patch is needed because of an issue with the aarch64 CRC32 intrinsics that was introduced with ocaml_intrinsics v0.17. It should be removed as soon as https://github.com/janestreet/ocaml_intrinsics/pull/11 is merged. --- .../ocaml-modules/janestreet/0.17.nix | 7 +++++ ...rinsics-fix-aarch64-crc32-intrinsics.patch | 28 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 pkgs/development/ocaml-modules/janestreet/ocaml_intrinsics-fix-aarch64-crc32-intrinsics.patch diff --git a/pkgs/development/ocaml-modules/janestreet/0.17.nix b/pkgs/development/ocaml-modules/janestreet/0.17.nix index 0b5deb52d946..b16957cb8732 100644 --- a/pkgs/development/ocaml-modules/janestreet/0.17.nix +++ b/pkgs/development/ocaml-modules/janestreet/0.17.nix @@ -937,6 +937,13 @@ with self; dune-configurator ocaml_intrinsics_kernel ]; + patches = [ + # This patch is needed because of an issue with the aarch64 CRC32 + # intrinsics that was introduced with ocaml_intrinsics v0.17. It should + # be removed as soon as + # https://github.com/janestreet/ocaml_intrinsics/pull/11 is merged. + ./ocaml_intrinsics-fix-aarch64-crc32-intrinsics.patch + ]; }; ocaml_openapi_generator = janePackage { diff --git a/pkgs/development/ocaml-modules/janestreet/ocaml_intrinsics-fix-aarch64-crc32-intrinsics.patch b/pkgs/development/ocaml-modules/janestreet/ocaml_intrinsics-fix-aarch64-crc32-intrinsics.patch new file mode 100644 index 000000000000..cb3577322dc1 --- /dev/null +++ b/pkgs/development/ocaml-modules/janestreet/ocaml_intrinsics-fix-aarch64-crc32-intrinsics.patch @@ -0,0 +1,28 @@ +From fa7d611d326eaec5b34d8686975aaf2238a85996 Mon Sep 17 00:00:00 2001 +From: alyaeanyx +Date: Sun, 18 May 2025 15:46:31 +0200 +Subject: [PATCH] Fix aarch64 CRC32 intrinsics configure test program + +The test program was checking for the nonexistent __crc32ud and __crc32uw instead of +__crc32cd __crc32cw (as used in src/crc_stubs.c). + +Signed-off-by: alyaeanyx +--- + src/discover/discover.ml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/discover/discover.ml b/src/discover/discover.ml +index d2b4039..8fe89a4 100644 +--- a/src/discover/discover.ml ++++ b/src/discover/discover.ml +@@ -12,8 +12,8 @@ let prog_aarch64 = + int main() { + int64_t i64, d64; + int32_t i32, d32; +- __crc32ud(i64, d64); +- __crc32uw(i32, d32); ++ __crc32cd(i64, d64); ++ __crc32cw(i32, d32); + return 0; + }|} + ;;