all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#53601] [PATCH 1/2] gnu: Add mimalloc.
@ 2022-01-28 10:50 phodina via Guix-patches via
  0 siblings, 0 replies; only message in thread
From: phodina via Guix-patches via @ 2022-01-28 10:50 UTC (permalink / raw)
  To: 53601


[-- Attachment #1.1: Type: text/plain, Size: 554 bytes --]

Hi,

here is a patch set to add mold linker.

I've temporarily put the package definition into gnu/packages/raspberry-pi.scm as I'm unsure if it should go to gnu/packages/commencement.scm or somewhere else.

It would be be interesting to test it as a new default linker on such a large scale project.

Also there is currently one test failing so I've disabled the tests for now:

Testing mold-wrapper ... execl: No such file or directory
make[1]: *** [Makefile.linux:6: elf/mold-wrapper.sh] Error 1
make[1]: *** Waiting for unfinished jobs....

----
Petr

[-- Attachment #1.2: Type: text/html, Size: 1170 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-mimalloc.patch --]
[-- Type: text/x-patch; name=0001-gnu-Add-mimalloc.patch, Size: 1940 bytes --]

From 67fd2d0a9ffa2a13e5b289c9f4cd7f9dd85a91c6 Mon Sep 17 00:00:00 2001
From: Petr Hodina <phodina@protonmail.com>
Date: Wed, 29 Dec 2021 22:41:47 +0100
Subject: [PATCH 1/2] gnu: Add mimalloc.

* gnu/packages/WIP (mimalloc): Add new variable.

diff --git a/gnu/packages/raspberry-pi.scm b/gnu/packages/raspberry-pi.scm
index bb38b8b218..a0142c2333 100644
--- a/gnu/packages/raspberry-pi.scm
+++ b/gnu/packages/raspberry-pi.scm
@@ -29,6 +29,7 @@ (define-module (gnu packages raspberry-pi)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages embedded)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system cmake)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module ((guix licenses) #:prefix license:)
@@ -42,6 +43,37 @@ (define-module (gnu packages raspberry-pi)
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match))
 
+(define-public mimalloc
+  (package
+    (name "mimalloc")
+    (version "2.0.3")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/microsoft/mimalloc")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0avamijn2dcrkba291rmdiv6z0kjzkhc1vigcwmhk9h0cvsc0q44"))))
+    (build-system cmake-build-system)
+    (synopsis "Compact general purpose allocator")
+    (description "This package provides a drop-in replacement for malloc.
+It provides the following benefits:
+@enumerate
+@item small and consistent
+@item free list sharding
+@item free list multi-sharding
+@item eager page reset
+@item secure
+@item first-class heaps
+@item bounded
+@item fast
+@end enumerate
+")
+    (home-page "https://github.com/microsoft/mimalloc")
+    (license license:expat)))
+
 (define-public bcm2835
   (package
     (name "bcm2835")
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-Add-mold.patch --]
[-- Type: text/x-patch; name=0002-gnu-Add-mold.patch, Size: 3919 bytes --]

From a1928e92512915a6d041da0195d6c2bb164f505d Mon Sep 17 00:00:00 2001
From: Petr Hodina <phodina@protonmail.com>
Date: Wed, 29 Dec 2021 22:42:48 +0100
Subject: [PATCH 2/2] gnu: Add mold.

* gnu/packages/WIP (mold): New variable.

diff --git a/gnu/packages/raspberry-pi.scm b/gnu/packages/raspberry-pi.scm
index a0142c2333..b59ec822c9 100644
--- a/gnu/packages/raspberry-pi.scm
+++ b/gnu/packages/raspberry-pi.scm
@@ -22,11 +22,21 @@ (define-module (gnu packages raspberry-pi)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages commencement)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages cross-base)
+  #:use-module (gnu packages digest)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages file)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages tbb)
+  #:use-module (gnu packages tls)
+  #:use-module (gnu packages perl)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages embedded)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system cmake)
@@ -74,6 +84,57 @@ (define-public mimalloc
     (home-page "https://github.com/microsoft/mimalloc")
     (license license:expat)))
 
+(define-public mold
+  (package
+    (name "mold")
+    (version "1.0.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/rui314/mold")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (modules '((guix build utils)))
+              (snippet '(begin
+                          (delete-file-recursively "third-party")))
+              (sha256
+               (base32
+                "08iiycbzb4324mnzph6m4y5kf700zhr66c0sq93k5sajm3xy8dfi"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags (list "SYSTEM_MIMALLOC=true" "SYSTEM_TBB=true"
+                          "SYSTEM_XXHASH=true"
+                          (string-append "PREFIX=" %output))
+       #:tests? #f ; failing test mold-wrapper
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-reference-to-cc
+           ;; This prevents errors like 'error: linker `cc` not found' when
+           ;; "cc" is not found on PATH.
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (let ((gcc (assoc-ref inputs "gcc")) (util-linux (assoc-ref
+                                                               inputs
+                                                               "util-linux")))
+               (substitute* "test/elf/exception.sh"
+                 (("`pwd`/../../mold") (string-append (getcwd) "/mold")))
+               (substitute* "test/elf/gc-sections.sh"
+                 (("`pwd`/../../mold") (string-append (getcwd) "/mold")))
+               (substitute* "test/elf/filler.sh"
+                 (("hexdump") (string-append util-linux "/bin/hexdump")))
+               (mkdir-p "/tmp/bin")
+               (symlink (string-append gcc "/bin/gcc") "/tmp/bin/cc")
+               (setenv "PATH"
+                       (string-append "/tmp/bin:"
+                                      (getenv "PATH"))))))
+         (delete 'configure))))
+    (native-inputs (list clang-12 gcc grep pkg-config util-linux xxhash))
+    (inputs (list mimalloc openssl python tbb zlib))
+    (synopsis "Modern Linker")
+    (description "This package provides a faster drop-in replacement for
+existing Unix linkers.")
+    (home-page "https://savannah.gnu.org/projects/patch/")
+    (license license:gpl3+)))
+
 (define-public bcm2835
   (package
     (name "bcm2835")
-- 
2.34.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-28 10:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28 10:50 [bug#53601] [PATCH 1/2] gnu: Add mimalloc phodina via Guix-patches via

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.