summary refs log tree commit diff
path: root/gnu/packages/jemalloc.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/jemalloc.scm')
-rw-r--r--gnu/packages/jemalloc.scm42
1 files changed, 26 insertions, 16 deletions
diff --git a/gnu/packages/jemalloc.scm b/gnu/packages/jemalloc.scm
index c4b87b540d..21a315303b 100644
--- a/gnu/packages/jemalloc.scm
+++ b/gnu/packages/jemalloc.scm
@@ -1,7 +1,8 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
-;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2021 Ryan Sundberg <ryan@arctype.co>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +22,7 @@
 (define-module (gnu packages jemalloc)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
+  #:use-module (ice-9 match)
   #:use-module ((guix licenses) #:select (bsd-2))
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -29,10 +31,10 @@
   #:use-module (gnu packages perl)
   #:use-module (guix build-system gnu))
 
-(define-public jemalloc
+(define-public jemalloc-4.5.0
   (package
     (name "jemalloc")
-    (version "5.2.1")
+    (version "4.5.0")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -40,7 +42,7 @@
                     version "/jemalloc-" version ".tar.bz2"))
               (sha256
                (base32
-                "1xl7z0vwbn5iycg7amka9jd6hxd8nmfk7nahi4p9w2bnw9f0wcrl"))))
+                "10373xhpc10pgmai9fkc1z0rs029qlcb3c0qfnvkbwdlcibdh2cl"))))
     (build-system gnu-build-system)
     (arguments
      `(#:phases
@@ -52,13 +54,14 @@
              (substitute* "Makefile.in"
                (("\\$\\(srcroot\\)test/unit/pages.c \\\\") "\\"))
              #t)))
-       ,@(if (any (cute string-prefix? <> (or (%current-target-system)
-                                              (%current-system)))
-                 '("x64_64" "i686"))
-           ;; Transparent huge pages are only enabled by default on Intel processors
-           '()
-           '(#:configure-flags (list "--disable-thp")))))
-    (inputs `(("perl" ,perl)))
+       #:configure-flags
+       '(,@(match (%current-system)
+             ((or "i686-linux" "x86_64-linux")
+              '())
+             ("powerpc-linux"
+              (list "--disable-thp" "CPPFLAGS=-maltivec"))
+             (_
+              (list "--disable-thp"))))))
     ;; Install the scripts to a separate output to avoid referencing Perl and
     ;; Bash in the default output, saving ~75 MiB on the closure.
     (outputs '("out" "bin"))
@@ -69,10 +72,10 @@
 fragmentation avoidance and scalable concurrency support.")
     (license bsd-2)))
 
-(define-public jemalloc-4.5.0
+(define-public jemalloc
   (package
-    (inherit jemalloc)
-    (version "4.5.0")
+    (inherit jemalloc-4.5.0)
+    (version "5.2.1")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -80,5 +83,12 @@ fragmentation avoidance and scalable concurrency support.")
                     version "/jemalloc-" version ".tar.bz2"))
               (sha256
                (base32
-                "10373xhpc10pgmai9fkc1z0rs029qlcb3c0qfnvkbwdlcibdh2cl"))))
-    (inputs '())))
+                "1xl7z0vwbn5iycg7amka9jd6hxd8nmfk7nahi4p9w2bnw9f0wcrl"))))
+    (arguments
+      (substitute-keyword-arguments (package-arguments jemalloc-4.5.0)
+        ;; Disable the thread local storage model in jemalloc 5 to prevent
+        ;; shared libraries linked to libjemalloc from crashing on dlopen()
+        ;; https://github.com/jemalloc/jemalloc/issues/937
+        ((#:configure-flags base-configure-flags '())
+         `(cons "--disable-initial-exec-tls" ,base-configure-flags))))
+    (inputs `(("perl" ,perl)))))