diff options
| author | Maxim Cournoyer <maxim@guixotic.coop> | 2025-10-24 16:06:12 +0900 |
|---|---|---|
| committer | Maxim Cournoyer <maxim@guixotic.coop> | 2025-10-30 16:13:03 +0900 |
| commit | 2c1fe0df11ae0f66392b8abb6f62430d79305538 (patch) | |
| tree | 44117a2d06d583f7378ddec5d475baeceddc7564 /gnu/packages | |
| parent | e1994a021437b3fd73089c08d7e8db876fad698d (diff) | |
Use mmap for the elf parser, reducing memory usage.
The `file->bytevector' new procedure uses a memory mapped bytevector, so
parsing the ELF file reads only the sections needed, not the whole file.
* guix/scripts/pack.scm (wrapped-package): Use file->bytevector.
* guix/build/gremlin.scm (file-dynamic-info): Likewise.
(validate-needed-in-runpath): Likewise.
(strip-runpath): Likewise, and write to bytevector directly, avoiding a port.
(set-file-runpath): Likewise.
* tests/gremlin.scm (read-elf): Delete procedure.
("elf-dynamic-info-needed, executable"): Use file-dynamic-info.
("strip-runpath"): Likewise.
("elf-dynamic-info-soname"): Likewise.
guix/build/debug-link.scm (set-debuglink-crc): Use file->bytevector.
* tests/debug-link.scm (read-elf): Delete procedure.
("elf-debuglink"): Rename to...
("elf-debuglink, no .gnu_debuglink section"): ... this.
("elf-debuglink", "set-debuglink-crc"): Use external store, and adjust to use
file->bytevector.
* gnu/packages/gnuzilla.scm (icecat-minimal) [#:phases]
{build-sandbox-whitelist}: Use `file-runpath'.
* gnu/packages/librewolf.scm (librewolf): Likewise.
Fixes: <https://issues.guix.gnu.org/59365>
Fixes: #1262
Change-Id: I43b77ed0cdc38994ea89d3d401e0d136aa6b187a
Diffstat (limited to 'gnu/packages')
| -rw-r--r-- | gnu/packages/gnuzilla.scm | 8 | ||||
| -rw-r--r-- | gnu/packages/librewolf.scm | 6 |
2 files changed, 2 insertions, 12 deletions
diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm index 259f9a6fc6e..d24797b85a0 100644 --- a/gnu/packages/gnuzilla.scm +++ b/gnu/packages/gnuzilla.scm @@ -996,16 +996,10 @@ preferences/advanced-scripts.dtd" (search-input-file inputs "lib/libavcodec.so"))))) (add-after 'fix-ffmpeg-runtime-linker 'build-sandbox-whitelist (lambda* (#:key inputs #:allow-other-keys) - (define (runpath-of lib) - (call-with-input-file lib - (compose elf-dynamic-info-runpath - elf-dynamic-info - parse-elf - get-bytevector-all))) (define (runpaths-of-input label) (let* ((dir (string-append (assoc-ref inputs label) "/lib")) (libs (find-files dir "\\.so$"))) - (append-map runpath-of libs))) + (append-map file-runpath libs))) ;; Populate the sandbox read-path whitelist as needed by ffmpeg. (let* ((whitelist (map (cut string-append <> "/") diff --git a/gnu/packages/librewolf.scm b/gnu/packages/librewolf.scm index f8800b19252..6c852d7f1c2 100644 --- a/gnu/packages/librewolf.scm +++ b/gnu/packages/librewolf.scm @@ -530,15 +530,11 @@ ;; The following two functions are from Guix's icecat package in ;; (gnu packages gnuzilla). See commit ;; b7a0935420ee630a29b7e5ac73a32ba1eb24f00b. - (define (runpath-of lib) - (call-with-input-file lib - (compose elf-dynamic-info-runpath elf-dynamic-info - parse-elf get-bytevector-all))) (define (runpaths-of-input label) (let* ((dir (string-append (assoc-ref inputs label) "/lib")) (libs (find-files dir "\\.so$"))) - (append-map runpath-of libs))) + (append-map file-runpath libs))) (let* ((out (assoc-ref outputs "out")) (lib (string-append out "/lib")) (libs (map |
