guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

134/142: gnu: llvm: Add make-lld-wrapper, lld-wrapper and lld-as-ld-wrap


From: guix-commits
Subject: 134/142: gnu: llvm: Add make-lld-wrapper, lld-wrapper and lld-as-ld-wrapper.
Date: Wed, 20 Oct 2021 14:57:02 -0400 (EDT)

apteryx pushed a commit to branch core-updates-frozen-batched-changes
in repository guix.

commit ad2d1c5b5c0fdcb5aedbbc2dfea6f802364e521d
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Sun Oct 17 22:41:01 2021 -0400

    gnu: llvm: Add make-lld-wrapper, lld-wrapper and lld-as-ld-wrapper.
    
    * gnu/packages/llvm.scm (make-lld-wrapper): New procedure.
    (lld-wrapper, lld-as-ld-wrapper): New variables.
---
 gnu/packages/llvm.scm | 40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 6403176..0249442 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -16,8 +16,8 @@
 ;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
-;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
@@ -67,7 +67,8 @@
   #:use-module (gnu packages python)
   #:use-module (gnu packages swig)
   #:use-module (gnu packages xml)
-  #:export (system->llvm-target))
+  #:export (make-lld-wrapper
+            system->llvm-target))
 
 (define* (system->llvm-target #:optional
                               (system (or (and=> (%current-target-system)
@@ -991,6 +992,41 @@ of programming tools as well as libraries with equivalent 
functionality.")
 components which highly leverage existing libraries in the larger LLVM 
Project.")
     (license license:asl2.0))) ; With LLVM exception
 
+;;; A lld wrapper that inserts appropriate -rpath entries.  Sufficient to use
+;;; with Clang or when specifying -fuse-ld with GCC.
+(define* (make-lld-wrapper lld #:key lld-as-ld?)
+  "Return a LLD wrapper.  When LLD-AS-LD? is true, create a 'ld' symlink that
+points to 'lld'."
+  (computed-file
+   (if lld-as-ld?
+       "lld-as-ld-wrapper"
+       "lld-wrapper")
+   #~(let ((ld.lld-wrapper (string-append #$(make-ld-wrapper "ld.lld-wrapper"
+                                                             #:binutils lld
+                                                             #:linker "ld.lld")
+                                          "/bin/ld.lld"))
+           (lld-wrapper (string-append #$(make-ld-wrapper "lld-wrapper"
+                                                          #:binutils lld
+                                                          #:linker "lld")
+                                       "/bin/lld")))
+       (mkdir #$output)
+       (mkdir (string-append #$output "/bin"))
+       (symlink ld.lld-wrapper (string-append #$output "/bin/ld.lld"))
+       (symlink lld-wrapper (string-append #$output "/bin/lld"))
+       (when #$lld-as-ld?
+         (symlink ld.lld-wrapper (string-append #$output "/bin/ld"))))))
+
+;;; FIXME: The following aliases are defined as promises since there seems to
+;;; be a problem with using `make-ld-wrapper' at the top level.
+
+;;; A lld wrapper suitable to use with -fuse-ld and GCC or with Clang.
+(define-public lld-wrapper
+  (delay (make-lld-wrapper lld)))
+
+;;; A lld wrapper that can be used as a (near) drop-in replacement to GNU ld.
+(define-public lld-as-ld-wrapper
+  (delay (make-lld-wrapper lld #:lld-as-ld? #t)))
+
 (define-public lldb
   (package
     (name "lldb")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]