gnu: cross-base: Use an 'ld' wrapper also when cross-compiling.
* gnu/packages/base.scm (make-ld-wrapper): Add #:target parameter and honor it. * gnu/packages/cross-base.scm (cross-gcc-arguments)[#:phases] <make-cross-binutils-visible>: Refer to the ld wrapper. (cross-gcc)[native-inputs]: Add "ld-wrapper-cross".
This commit is contained in:
parent
9bab6bea86
commit
4a740d0fec
|
@ -358,11 +358,14 @@ included.")
|
||||||
(license gpl3+)
|
(license gpl3+)
|
||||||
(home-page "http://www.gnu.org/software/binutils/")))
|
(home-page "http://www.gnu.org/software/binutils/")))
|
||||||
|
|
||||||
(define* (make-ld-wrapper name #:key binutils guile bash
|
(define* (make-ld-wrapper name #:key binutils
|
||||||
|
(guile (canonical-package guile-2.0))
|
||||||
|
(bash (canonical-package bash)) target
|
||||||
(guile-for-build guile))
|
(guile-for-build guile))
|
||||||
"Return a package called NAME that contains a wrapper for the 'ld' program
|
"Return a package called NAME that contains a wrapper for the 'ld' program
|
||||||
of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. The
|
of BINUTILS, which adds '-rpath' flags to the actual 'ld' command line. When
|
||||||
wrapper uses GUILE and BASH."
|
TARGET is not #f, make a wrapper for the cross-linker for TARGET, called
|
||||||
|
'TARGET-ld'. The wrapper uses GUILE and BASH."
|
||||||
(package
|
(package
|
||||||
(name name)
|
(name name)
|
||||||
(version "0")
|
(version "0")
|
||||||
|
@ -382,8 +385,10 @@ wrapper uses GUILE and BASH."
|
||||||
|
|
||||||
(let* ((out (assoc-ref %outputs "out"))
|
(let* ((out (assoc-ref %outputs "out"))
|
||||||
(bin (string-append out "/bin"))
|
(bin (string-append out "/bin"))
|
||||||
(ld (string-append bin "/ld"))
|
(ld ,(if target
|
||||||
(go (string-append bin "/ld.go")))
|
`(string-append bin "/" ,target "-ld")
|
||||||
|
'(string-append bin "/ld")))
|
||||||
|
(go (string-append ld ".go")))
|
||||||
|
|
||||||
(setvbuf (current-output-port) _IOLBF)
|
(setvbuf (current-output-port) _IOLBF)
|
||||||
(format #t "building ~s/bin/ld wrapper in ~s~%"
|
(format #t "building ~s/bin/ld wrapper in ~s~%"
|
||||||
|
@ -403,7 +408,10 @@ wrapper uses GUILE and BASH."
|
||||||
"/bin/bash"))
|
"/bin/bash"))
|
||||||
(("@LD@")
|
(("@LD@")
|
||||||
(string-append (assoc-ref %build-inputs "binutils")
|
(string-append (assoc-ref %build-inputs "binutils")
|
||||||
"/bin/ld")))
|
,(if target
|
||||||
|
(string-append "/bin/"
|
||||||
|
target "-ld")
|
||||||
|
"/bin/ld"))))
|
||||||
(chmod ld #o555)
|
(chmod ld #o555)
|
||||||
(compile-file ld #:output-file go)))))
|
(compile-file ld #:output-file go)))))
|
||||||
(synopsis "The linker wrapper")
|
(synopsis "The linker wrapper")
|
||||||
|
|
|
@ -130,12 +130,16 @@ may be either a libc package or #f.)"
|
||||||
,target))
|
,target))
|
||||||
(binutils (string-append
|
(binutils (string-append
|
||||||
(assoc-ref inputs "binutils-cross")
|
(assoc-ref inputs "binutils-cross")
|
||||||
"/bin/" ,target "-")))
|
"/bin/" ,target "-"))
|
||||||
|
(wrapper (string-append
|
||||||
|
(assoc-ref inputs "ld-wrapper-cross")
|
||||||
|
"/bin/" ,target "-ld")))
|
||||||
(for-each (lambda (file)
|
(for-each (lambda (file)
|
||||||
(symlink (string-append binutils file)
|
(symlink (string-append binutils file)
|
||||||
(string-append libexec "/"
|
(string-append libexec "/"
|
||||||
file)))
|
file)))
|
||||||
'("as" "ld" "nm"))
|
'("as" "nm"))
|
||||||
|
(symlink wrapper (string-append libexec "/ld"))
|
||||||
#t))
|
#t))
|
||||||
,phases)))
|
,phases)))
|
||||||
(if libc
|
(if libc
|
||||||
|
@ -214,7 +218,11 @@ GCC that does not target a libc; otherwise, target that libc."
|
||||||
,@(cross-gcc-arguments target libc)))
|
,@(cross-gcc-arguments target libc)))
|
||||||
|
|
||||||
(native-inputs
|
(native-inputs
|
||||||
`(("binutils-cross" ,xbinutils)
|
`(("ld-wrapper-cross" ,(make-ld-wrapper
|
||||||
|
(string-append "ld-wrapper-" target)
|
||||||
|
#:target target
|
||||||
|
#:binutils xbinutils))
|
||||||
|
("binutils-cross" ,xbinutils)
|
||||||
|
|
||||||
;; Call it differently so that the builder can check whether the "libc"
|
;; Call it differently so that the builder can check whether the "libc"
|
||||||
;; input is #f.
|
;; input is #f.
|
||||||
|
|
Loading…
Reference in New Issue