about summary refs log tree commit diff
path: root/pkgs/development/libraries/jemalloc
diff options
context:
space:
mode:
authorDmitry Ivankov <divanorama@gmail.com>2022-09-29 23:50:19 +0200
committerDmitry Ivankov <divanorama@gmail.com>2022-11-14 10:52:37 +0100
commite3a7c410a77fb7ddcd24755ce1406e2994f068bc (patch)
tree942ad50c4a091581701789dafb917d5f2e24982b /pkgs/development/libraries/jemalloc
parent801d535fab9d7dacbe1b79a6dfff0ededa71f194 (diff)
jemalloc: fix aarch64-darwin build
Switch to default clang11 and apply a patch to fix tests.

The issue is compiler optimizations for unused `malloc` calls
being applied to jemalloc tests with empty `--with-jemalloc-prefix=`.
Tests want to test bad arguments to malloc and optimization broke
such assertions in some of tests, so patch is applied to disable
builtin functions optimizations (only for tests code).

Fixes https://github.com/NixOS/nixpkgs/issues/152056

Patch submission upstream
https://github.com/jemalloc/jemalloc/pull/2340
Diffstat (limited to 'pkgs/development/libraries/jemalloc')
-rw-r--r--pkgs/development/libraries/jemalloc/default.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkgs/development/libraries/jemalloc/default.nix b/pkgs/development/libraries/jemalloc/default.nix
index cb734508b3407..c505dc6db55ad 100644
--- a/pkgs/development/libraries/jemalloc/default.nix
+++ b/pkgs/development/libraries/jemalloc/default.nix
@@ -1,6 +1,7 @@
 { lib
 , stdenv
 , fetchurl
+, fetchpatch
 # By default, jemalloc puts a je_ prefix onto all its symbols on OSX, which
 # then stops downstream builds (mariadb in particular) from detecting it. This
 # option should remove the prefix and give us a working jemalloc.
@@ -19,6 +20,14 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-LbgtHnEZ3z5xt2QCGbbf6EeJvAU3mDw7esT3GJrs/qo=";
   };
 
+  patches = [
+    # fix tests under --with-jemalloc-prefix=, see https://github.com/jemalloc/jemalloc/pull/2340
+    (fetchpatch {
+      url = "https://github.com/jemalloc/jemalloc/commit/d00ecee6a8dfa90afcb1bbc0858985c17bef6559.patch";
+      hash = "sha256-N5i4IxGJ4SSAgFiq5oGRnrNeegdk2flw9Sh2mP0yl4c=";
+    })
+  ];
+
   # see the comment on stripPrefix
   configureFlags = []
     ++ lib.optional stripPrefix "--with-jemalloc-prefix="