gnu: make-ld-wrapper: Add a LINKER argument.
This allows creating wrappers for other linkers than "ld", such as "ld.gold". * gnu/packages/base.scm (make-ld-wrapper): New variable. [linker]: New argument. Update doc. <ld>: Use LINKER to derive the linker source.
This commit is contained in:
parent
b04a20f77f
commit
8b1dfc144b
@ -19,6 +19,7 @@
|
|||||||
;;; Copyright © 2021 Leo Le Bouter <lle-bout@zaclys.net>
|
;;; Copyright © 2021 Leo Le Bouter <lle-bout@zaclys.net>
|
||||||
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
|
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
|
||||||
;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
|
;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
|
||||||
|
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
@ -71,6 +72,7 @@
|
|||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:export (glibc
|
#:export (glibc
|
||||||
|
make-ld-wrapper
|
||||||
libiconv-if-needed))
|
libiconv-if-needed))
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
@ -603,6 +605,7 @@ included.")
|
|||||||
(define* (make-ld-wrapper name #:key
|
(define* (make-ld-wrapper name #:key
|
||||||
(target (const #f))
|
(target (const #f))
|
||||||
binutils
|
binutils
|
||||||
|
(linker "ld")
|
||||||
(guile (canonical-package guile-3.0))
|
(guile (canonical-package guile-3.0))
|
||||||
(bash (canonical-package bash))
|
(bash (canonical-package bash))
|
||||||
(guile-for-build guile))
|
(guile-for-build guile))
|
||||||
@ -612,7 +615,9 @@ wrapper uses GUILE and BASH.
|
|||||||
|
|
||||||
TARGET must be a one-argument procedure that, given a system type, returns a
|
TARGET must be a one-argument procedure that, given a system type, returns a
|
||||||
cross-compilation target triplet or #f. When the result is not #f, make a
|
cross-compilation target triplet or #f. When the result is not #f, make a
|
||||||
wrapper for the cross-linker for that target, called 'TARGET-ld'."
|
wrapper for the cross-linker for that target, called 'TARGET-ld'. To use a
|
||||||
|
different linker than the default \"ld\", such as \"ld.gold\" the linker name
|
||||||
|
can be provided via the LINKER argument."
|
||||||
;; Note: #:system->target-triplet is a procedure so that the evaluation of
|
;; Note: #:system->target-triplet is a procedure so that the evaluation of
|
||||||
;; its result can be delayed until the 'arguments' field is evaluated, thus
|
;; its result can be delayed until the 'arguments' field is evaluated, thus
|
||||||
;; in a context where '%current-system' is accurate.
|
;; in a context where '%current-system' is accurate.
|
||||||
@ -637,8 +642,9 @@ wrapper for the cross-linker for that target, called 'TARGET-ld'."
|
|||||||
(let* ((out (assoc-ref %outputs "out"))
|
(let* ((out (assoc-ref %outputs "out"))
|
||||||
(bin (string-append out "/bin"))
|
(bin (string-append out "/bin"))
|
||||||
(ld ,(if target
|
(ld ,(if target
|
||||||
`(string-append bin "/" ,target "-ld")
|
`(string-append bin "/" ,target "-"
|
||||||
'(string-append bin "/ld")))
|
,linker)
|
||||||
|
`(string-append bin "/" ,linker)))
|
||||||
(go (string-append ld ".go")))
|
(go (string-append ld ".go")))
|
||||||
|
|
||||||
(setvbuf (current-output-port)
|
(setvbuf (current-output-port)
|
||||||
@ -663,11 +669,10 @@ wrapper for the cross-linker for that target, called 'TARGET-ld'."
|
|||||||
(string-append (assoc-ref %build-inputs "binutils")
|
(string-append (assoc-ref %build-inputs "binutils")
|
||||||
,(if target
|
,(if target
|
||||||
(string-append "/bin/"
|
(string-append "/bin/"
|
||||||
target "-ld")
|
target "-" linker)
|
||||||
"/bin/ld"))))
|
(string-append "/bin/" linker)))))
|
||||||
(chmod ld #o555)
|
(chmod ld #o555)
|
||||||
(compile-file ld #:output-file go)
|
(compile-file ld #:output-file go))))))
|
||||||
#t)))))
|
|
||||||
(synopsis "The linker wrapper")
|
(synopsis "The linker wrapper")
|
||||||
(description
|
(description
|
||||||
"The linker wrapper (or @code{ld-wrapper}) wraps the linker to add any
|
"The linker wrapper (or @code{ld-wrapper}) wraps the linker to add any
|
||||||
@ -676,8 +681,6 @@ the store.")
|
|||||||
(home-page "https://www.gnu.org/software/guix//")
|
(home-page "https://www.gnu.org/software/guix//")
|
||||||
(license gpl3+)))
|
(license gpl3+)))
|
||||||
|
|
||||||
(export make-ld-wrapper)
|
|
||||||
|
|
||||||
(define-public glibc
|
(define-public glibc
|
||||||
;; This is the GNU C Library, used on GNU/Linux and GNU/Hurd. Prior to
|
;; This is the GNU C Library, used on GNU/Linux and GNU/Hurd. Prior to
|
||||||
;; version 2.28, GNU/Hurd used a different glibc branch.
|
;; version 2.28, GNU/Hurd used a different glibc branch.
|
||||||
|
Loading…
Reference in New Issue
Block a user