guix-patches
[Top][All Lists]
Advanced

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

[bug#64218] [PATCH 4/7] gnu: lld-15: Adjust max text section size on ris


From: Efraim Flashner
Subject: [bug#64218] [PATCH 4/7] gnu: lld-15: Adjust max text section size on riscv64-linux.
Date: Thu, 22 Jun 2023 12:19:11 +0300

* gnu/packages/llvm.scm (ldd-15)[arguments]: When building for
riscv64-linux add a phase to mirror an upstream patch to allow for
larger text section sizes in linked libraries.
---
 gnu/packages/llvm.scm | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index d36a95879a..a15dffed93 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1525,14 +1525,29 @@ (define-public lld-15
     (inputs
      (list llvm-15))
     (arguments
-     '(#:build-type "Release"
+     `(#:build-type "Release"
        ;; TODO: Tests require the lit tool, which isn't installed by the LLVM
        ;; package.
        #:tests? #f
-       #:phases (modify-phases %standard-phases
-                  (add-after 'unpack 'change-directory
-                    (lambda _
-                      (chdir "lld"))))))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'change-directory
+           (lambda _
+             (chdir "lld")))
+         ,@(if (target-riscv64?)
+             '((add-after 'change-directory 'patch-riscv-text-section-size
+                 (lambda _
+                   ;; https://github.com/llvm/llvm-project/issues/63374
+                   ;; 
https://github.com/llvm/llvm-project/commit/9d37ea95df1b84cca9b5e954d8964c976a5e303e
+                   (substitute* "ELF/Arch/RISCV.cpp"
+                     (("uint32_t delta = 0") "uint64_t delta = 0")
+                     (("isUInt<16>\\(delta\\)") "isUInt<32>(delta)")
+                     (("is too large\"") "is too large \" + Twine(delta)"))
+                   (substitute* "ELF/InputSection.h"
+                     (("uint16_t bytesDropped = 0")
+                      "uint32_t bytesDropped = 0")
+                     (("160") "168")))))
+             '()))))
     (home-page "https://lld.llvm.org/";)
     (synopsis "Linker from the LLVM project")
     (description "LLD is a high-performance linker, built as a set of reusable
@@ -1544,6 +1559,13 @@ (define-public lld-14
     (inherit lld-15)
     (version "14.0.6")
     (source (llvm-monorepo version))
+    (arguments
+     (substitute-keyword-arguments (package-arguments lld-15)
+       ((#:phases phases)
+        (if (target-riscv64?)
+          `(modify-phases ,phases
+             (delete 'patch-riscv-text-section-size))
+          phases))))
     (inputs
      (list llvm-14))))
 
-- 
Efraim Flashner   <efraim@flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted






reply via email to

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