guix-commits
[Top][All Lists]
Advanced

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

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


From: guix-commits
Subject: 134/140: gnu: llvm: Add make-lld-wrapper, lld-wrapper and lld-as-ld-wrapper.
Date: Sun, 17 Oct 2021 23:11:17 -0400 (EDT)

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

commit 5f270c61ec5f64b8c8591fb9706c847dece8f78d
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 | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 6403176..6930479 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,37 @@ 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
+   "lld-wrapper"
+   #~(begin
+       (define lld* (string-append #$(make-ld-wrapper "lld-wrapper-0"
+                                                      #:binutils lld
+                                                      #:linker "lld")
+                                   "/bin/lld"))
+       (mkdir #$output)
+       (mkdir (string-append #$output "/bin"))
+       (symlink lld* (string-append #$output "/bin/lld"))
+       ;; Clang looks for an 'ld.lld' executable.
+       (symlink lld* (string-append #$output "/bin/ld.lld"))
+       (when #$lld-as-ld?
+         (symlink lld* (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]