elf: Remove bundled Guile source.

This module has been included in Guile as (system vm elf) since around version
2.1.

* guix/elf.scm: Delete file.
* CODEOWNERS: De-register module.
* Makefile.am (MODULES): Likewise.
* etc/teams.scm (core): Likewise.
* gnu/build/linux-modules.scm: Adjust imports.
* gnu/packages/gnuzilla.scm (icecat-minimal) [modules]: Likewise.
* gnu/packages/librewolf.scm (librewolf): Likewise.
* gnu/packages/sequoia.scm (sequoia): Likewise.
* gnu/packages/tor-browsers.scm (make-torbrowser): Likewise.
* gnu/packages/version-control.scm (hg-commitsigs): Likewise.
* guix/build/debug-link.scm: Likewise.
* guix/build/meson-build-system.scm: Likewise.
* guix/grafts.scm (graft-derivation/shallow): Likewise.
* guix/scripts/pack.scm (wrapped-package): Likewise.
* tests/debug-link.scm: ("elf-debuglink", "set-debuglink-crc"): Likewise.
* tests/gremlin.scm: Likewise.
* guix/build/syscalls.scm (has-access-to-libc-shared-library?): New procedure.
* guix/build-system/gnu.scm (%default-gnu-imported-modules): Remove (guix elf).
* guix/build/gnu-build-system.scm: Lazily load (system vm elf).
(has-elf-editing-support?): New variable.
(strip) [!has-elf-editing-support?] <guile-bytecode?>: Do not check ELF
section.
(compress-debug-info): [!has-elf-editing-support?]: Skip phase.
(validate-runpath): Likewise.
(make-dynamic-linker-cache): Likewise.
* guix/build/gremlin.scm: Lazily load (system vm elf).

Change-Id: I86ac4237fdd820a6b54dc0fe7a7d10403a290ef9
This commit is contained in:
Maxim Cournoyer 2025-10-28 21:50:34 +09:00
parent 9f8a93b955
commit 1029981e70
No known key found for this signature in database
GPG key ID: 1260E46482E63562
20 changed files with 62 additions and 1082 deletions

View file

@ -54,7 +54,6 @@ guix/diagnostics\.scm @guix/core
guix/discovery\.scm @guix/core
guix/docker\.scm @guix/core
guix/download\.scm @guix/core
guix/elf\.scm @guix/core
guix/ftp-client\.scm @guix/core
guix/gexp\.scm @guix/core
guix/git-authenticate\.scm @guix/core

View file

@ -202,7 +202,6 @@ MODULES = \
guix/ftp-client.scm \
guix/http-client.scm \
guix/gnupg.scm \
guix/elf.scm \
guix/profiling.scm \
guix/store.scm \
guix/cvs-download.scm \

View file

@ -525,7 +525,6 @@ of Rebar and Mix build systems and Hex.pm importer."
"guix/discovery.scm"
"guix/docker.scm"
"guix/download.scm"
"guix/elf.scm"
"guix/ftp-client.scm"
"guix/gexp.scm"
"guix/git-authenticate.scm"

View file

@ -21,7 +21,6 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu build linux-modules)
#:use-module (guix elf)
#:use-module (guix glob)
#:use-module (guix build syscalls)
#:use-module ((guix build utils) #:select (find-files invoke))
@ -39,6 +38,7 @@
#:use-module (ice-9 match)
#:use-module (ice-9 rdelim)
#:autoload (ice-9 pretty-print) (pretty-print)
#:use-module (system vm elf)
#:export (dot-ko
ensure-dot-ko
module-formal-name

View file

@ -932,7 +932,7 @@ preferences/advanced-scripts.dtd"
(srfi srfi-26)
(rnrs bytevectors)
(rnrs io ports)
(guix elf)
(system vm elf)
(guix build gremlin)
,@%default-gnu-modules)
#:phases

View file

@ -282,7 +282,7 @@
(srfi srfi-26)
(rnrs bytevectors)
(rnrs io ports)
(guix elf)
(system vm elf)
(guix build gremlin)
,@%default-gnu-imported-modules)
#:phases

View file

@ -318,7 +318,7 @@ This Guix package is built to use the nettle cryptographic library.")
(guix build union)
(guix build gnu-build-system)
(guix build gremlin)
(guix elf))
(system vm elf))
#:builder
#~(begin
(use-modules (guix build utils)

View file

@ -362,7 +362,7 @@ Browser.")
(srfi srfi-26)
(rnrs bytevectors)
(rnrs io ports)
(guix elf)
(system vm elf)
(guix build gremlin)
,@%default-gnu-imported-modules)
#:phases

View file

@ -2959,7 +2959,7 @@ history. It implements the changeset evolution concept for Mercurial.")
(guix build utils)
(guix build gremlin)
(ice-9 ftw)
(guix elf))
(system vm elf))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-paths

View file

@ -57,8 +57,7 @@
(guix build utils)
(guix build gremlin)
(guix build io) ;used by gremlin
(guix build syscalls) ;used by io
(guix elf)))
(guix build syscalls))) ;used by io
(define-deprecated/public-alias %gnu-build-system-modules
%default-gnu-imported-modules)

View file

@ -18,7 +18,6 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix build debug-link)
#:use-module (guix elf)
#:use-module (guix build io)
#:use-module ((guix build utils)
#:select (find-files elf-file? make-file-writable))
@ -26,6 +25,7 @@
#:use-module (rnrs io ports)
#:use-module (srfi srfi-1)
#:use-module (system foreign)
#:use-module (system vm elf)
#:use-module (ice-9 match)
#:export (debuglink-crc32
elf-debuglink

View file

@ -23,7 +23,8 @@
#:use-module (guix build utils)
#:use-module (guix build gremlin)
#:use-module (guix build io)
#:use-module (guix elf)
#:use-module ((guix build syscalls) #:select
(has-access-to-libc-shared-library?))
#:use-module (ice-9 ftw)
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
@ -51,6 +52,21 @@
;;
;; Code:
;;; This is a lazy module loading hack that is necessary until our
;;; %bootstrap-guile package is new enough (>= 2.1.0) to have (system vm elf).
(define has-system-vm-elf-module? #t)
(catch 'misc-error
(lambda ()
(module-use! (current-module) (resolve-interface '(system vm elf))))
(lambda args
(set! has-system-vm-elf-module? #f)
(format (current-warning-port)
"lacking (system vm elf) module; some phases will be skipped~%")))
(define has-elf-editing-support?
(and has-system-vm-elf-module?
(has-access-to-libc-shared-library?)))
(cond-expand
(guile-2.2
;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and
@ -522,8 +538,10 @@ makefiles."
(define (guile-bytecode? file)
(and (string-suffix? ".go" file)
(elf-section-by-name (parse-elf (file->bytevector file))
".guile.procprops")))
(if has-elf-editing-support?
(elf-section-by-name (parse-elf (file->bytevector file))
".guile.procprops")
#t)))
(define (strip-dir dir)
(format #t "stripping binaries in ~s with ~s and flags ~s~%"
@ -586,7 +604,7 @@ makefiles."
(dwz-command (which "dwz"))
#:allow-other-keys)
(define debug-output (assoc-ref outputs "debug"))
(when debug-output
(when (and has-elf-editing-support? debug-output)
(let* ((common-file (string-append debug-output
"/lib/debug/" (assoc-ref outputs "out")
"/common.debug"))
@ -663,7 +681,7 @@ ELF-DIRECTORIES have their dependencies found in their 'RUNPATH'."
(length files) directory)
(every* validate-needed-in-runpath files)))
(if validate-runpath?
(if (and has-elf-editing-support? validate-runpath?)
(let ((dirs (append-map (match-lambda
(("debug" . _)
;; The "debug" output is full of ELF files
@ -925,7 +943,7 @@ that traversing all the RUNPATH entries entails."
(format #t "created '~a' from ~a library search path entries~%"
cache-file (length library-path)))))
(if make-dynamic-linker-cache?
(if (and has-elf-editing-support? make-dynamic-linker-cache?)
(match outputs
(((_ . directories) ...)
(for-each make-cache-for-output directories)))

View file

@ -18,7 +18,6 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix build gremlin)
#:use-module (guix elf)
#:use-module (guix build io)
#:use-module ((guix build utils) #:select (store-file-name?))
#:use-module (ice-9 match)
@ -64,6 +63,17 @@
;;;
;;; Code:
;;; This is a lazy module loading hack that is necessary until our
;;; %bootstrap-guile package is new enough (>= 2.1.0) to have (system vm elf).
(define has-system-vm-elf-module? #t)
(catch 'misc-error
(lambda ()
(module-use! (current-module) (resolve-interface '(system vm elf))))
(lambda args
(set! has-system-vm-elf-module? #f)
(format (current-warning-port)
"no (system vm elf) module; (guix build gremlin) unusable~%")))
(define-condition-type &elf-error &error
elf-error?
(elf elf-error-elf))

View file

@ -24,10 +24,10 @@
#:use-module ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
#:use-module (guix build utils)
#:use-module (guix build gremlin)
#:use-module (guix elf)
#:use-module (ice-9 match)
#:use-module (rnrs io ports)
#:use-module (srfi srfi-1)
#:use-module (system vm elf)
#:export (%standard-phases
meson-build))

View file

@ -43,7 +43,9 @@
#:use-module (ice-9 regex)
#:use-module (ice-9 match)
#:use-module (ice-9 ftw)
#:export (protection
#:export (has-access-to-libc-shared-library?
protection
protection-set
mmap-flag
mmap-flag-set
@ -257,6 +259,9 @@
;;;
;;; Code:
(define (has-access-to-libc-shared-library?)
(false-if-exception (dynamic-link "libc.so.6")))
;;;
;;; Packed structures.

File diff suppressed because it is too large Load diff

View file

@ -118,12 +118,12 @@ are not recursively applied to dependencies of DRV."
(define build
(with-imported-modules '((guix build graft)
(guix build utils)
(guix build debug-link)
(guix elf))
(guix build debug-link))
#~(begin
(use-modules (guix build graft)
(guix build utils)
(ice-9 match))
(ice-9 match)
(system vm elf))
(define %outputs
(ungexp (outputs->gexp outputs)))

View file

@ -1224,20 +1224,19 @@ libfakechroot.so and related ld.so machinery as a fallback."
'((guix build io)
(guix build utils)
(guix build union)
(guix build gremlin)
(guix elf)))
(guix build gremlin)))
#~(begin
(use-modules (guix build io)
(guix build utils)
((guix build union) #:select (symlink-relative))
(guix elf)
(guix build gremlin)
(ice-9 binary-ports)
(ice-9 ftw)
(ice-9 match)
(ice-9 receive)
(srfi srfi-1)
(rnrs bytevectors))
(rnrs bytevectors)
(system vm elf))
(define input
;; The OUTPUT* output of PACKAGE.

View file

@ -18,7 +18,6 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (test-debug-link)
#:use-module (guix elf)
#:use-module (guix build utils)
#:use-module (guix build debug-link)
#:use-module (guix build io)
@ -33,6 +32,7 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-64)
#:use-module (system vm elf)
#:use-module (rnrs io ports)
#:use-module (ice-9 match))
@ -70,13 +70,12 @@
(exp (with-imported-modules (source-module-closure
'((guix build io)
(guix build utils)
(guix build debug-link)
(guix elf)))
(guix build debug-link)))
#~(begin
(use-modules (guix build io)
(guix build utils)
(guix build debug-link)
(guix elf)
(system vm elf)
(rnrs io ports))
(define read-elf
@ -117,13 +116,12 @@
(exp (with-imported-modules (source-module-closure
'((guix build io)
(guix build utils)
(guix build debug-link)
(guix elf)))
(guix build debug-link)))
#~(begin
(use-modules (guix build io)
(guix build utils)
(guix build debug-link)
(guix elf)
(system vm elf)
(rnrs io ports))
(define read-elf

View file

@ -19,7 +19,6 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (test-gremlin)
#:use-module (guix elf)
#:use-module (guix tests)
#:use-module ((guix utils) #:select (call-with-temporary-directory
target-aarch64?))
@ -31,6 +30,7 @@
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-64)
#:use-module (system vm elf)
#:use-module (rnrs io ports)
#:use-module (ice-9 popen)
#:use-module (ice-9 rdelim)