[PATCH 0/7] build ldc with llvm-15

  • Done
  • quality assurance status badge
Details
One participant
  • Efraim Flashner
Owner
unassigned
Submitted by
Efraim Flashner
Severity
normal
E
E
Efraim Flashner wrote on 22 Jun 2023 11:17
(address . guix-patches@gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
cover.1687425321.git.efraim@flashner.co.il
A series of patches to build ldc with llvm-15. llvm-15 doesn't build on
i686 and I wasn't able to skip the 'make-dynamic-linker-cache phase
without also skipping it on llvm-for-mesa. ldc builds on powerpc64le
with this patch, but still not yet on riscv64.

Efraim Flashner (7):
gnu: python-lit: Update to 16.0.6.
gnu: clang-runtime-15: Don't delete static libraries.
gnu: clang-15: Fix building on i686-linux.
gnu: lld-15: Adjust max text section size on riscv64-linux.
gnu: ldc: Build with llvm-15.
gnu: ldc: Enable building on more architectures.
gnu: sambamba: Fix building.

gnu/packages/bioinformatics.scm | 8 +---
gnu/packages/check.scm | 6 +--
gnu/packages/dlang.scm | 83 ++++++++++++++++++++++-----------
gnu/packages/llvm.scm | 45 +++++++++++++-----
4 files changed, 94 insertions(+), 48 deletions(-)


base-commit: 8b6bc4b2aa579193306cdc7a28f788c9afb4e039
--
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
E
E
Efraim Flashner wrote on 22 Jun 2023 11:19
[PATCH 1/7] gnu: python-lit: Update to 16.0.6.
(address . 64218@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
0a576fdc39b0ebb5acccb8f7c2d3b749a27403b0.1687425321.git.efraim@flashner.co.il
* gnu/packages/check.scm (python-lit): Update to 16.0.6.
---
gnu/packages/check.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (25 lines)
diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 87728fefa3..82b4741212 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -2332,14 +2332,14 @@ (define-public python-hypothesmith
(define-public python-lit
(package
(name "python-lit")
- (version "16.0.0")
+ (version "16.0.6")
(source
(origin
(method url-fetch)
(uri (pypi-uri "lit" version))
(sha256
(base32
- "04dyv8b2nbdbn61zdgm042a21dwidyapn9zbinlf879a29rc6jiw"))))
+ "16kswyw71vlg3l0gf2x4mm3386vjdczfdx1psrilgcdn4ff3qql4"))))
(build-system python-build-system)
(arguments
`(#:phases
--
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
E
E
Efraim Flashner wrote on 22 Jun 2023 11:19
[PATCH 2/7] gnu: clang-runtime-15: Don't delete static libraries.
(address . 64218@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
cf3843b3ffa5961e1cf69683f148e993ae21b09d.1687425321.git.efraim@flashner.co.il
These are needed for some test suites.

* gnu/packages/llvm.scm (clang-runtime-15)[arguments]: Remove custom
'delete-static-libraries phase.
---
gnu/packages/llvm.scm | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

Toggle diff (22 lines)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index f59c8e9592..9764552a62 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -699,12 +699,7 @@ (define-public clang-runtime-15
#~(modify-phases #$phases
(add-after 'unpack 'change-directory
(lambda _
- (chdir "compiler-rt")))
- (add-after 'install 'delete-static-libraries
- ;; Reduce size from 33 MiB to 7.4 MiB.
- (lambda _
- (for-each delete-file
- (find-files #$output "\\.a(\\.syms)?$"))))))))
+ (chdir "compiler-rt")))))))
(native-inputs
(modify-inputs (package-native-inputs template)
(prepend gcc-12))) ;libfuzzer fails to build with GCC 11
--
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
E
E
Efraim Flashner wrote on 22 Jun 2023 11:19
[PATCH 3/7] gnu: clang-15: Fix building on i686-linux.
(address . 64218@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
22c1259428c04d43007a291a7bca36f7e1c6ccec.1687425321.git.efraim@flashner.co.il
* gnu/packages/llvm.scm (clang-from-llvm)[arguments]: When building at
least version 15 for i686-linux skip the 'make-dynamic-linker-cache
phase.
---
gnu/packages/llvm.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Toggle diff (21 lines)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 9764552a62..d36a95879a 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -408,7 +408,11 @@ (define* (clang-from-llvm llvm clang-runtime
(mkdir-p compl-dir)
(rename-file "bash-autocomplete.sh"
(string-append compl-dir "/clang")))))
- #t)))))
+ #t))
+ ;; GC Warning: Out of Memory! Heap size: 3636 MiB. Returning NULL!
+ ,@(if (and (version>? version "15") (target-x86-32?))
+ `((delete 'make-dynamic-linker-cache))
+ '()))))
;; Clang supports the same environment variables as GCC.
(native-search-paths
--
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
E
E
Efraim Flashner wrote on 22 Jun 2023 11:19
[PATCH 4/7] gnu: lld-15: Adjust max text section size on riscv64-linux.
(address . 64218@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
dbda7b77de65485d2122507e314615b975a9180b.1687425321.git.efraim@flashner.co.il
* 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(-)

Toggle diff (57 lines)
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
E
E
Efraim Flashner wrote on 22 Jun 2023 11:19
[PATCH 5/7] gnu: ldc: Build with llvm-15.
(address . 64218@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
eb95596441d9f1566f0a869d3a7f8919132fb586.1687425321.git.efraim@flashner.co.il
* gnu/packages/check.scm (python-lit)[native-inputs]: Replace llvm-14
with llvm-15.
* gnu/packages/dlang.scm (ldc-bootstrap)[arguments]: Adjust
configure-flags to make use of llvm shared libraries.
[native-inputs]: Replace lld-wrapper-14 with lld-wrapper-15, llvm-14
with llvm-15.
(ldc)[arguments]: Inherit configure-flags from ldc-bootstrap. Update
skipped tests.
[native-inputs]: Replace clang-14 with clang-15.
---
gnu/packages/check.scm | 2 +-
gnu/packages/dlang.scm | 64 +++++++++++++++++++++++++++++++++---------
2 files changed, 52 insertions(+), 14 deletions(-)

Toggle diff (137 lines)
diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 82b4741212..4c1ba085c4 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -2349,7 +2349,7 @@ (define-public python-lit
(when tests?
(invoke "python" "lit.py" "tests")))))))
(native-inputs
- (list llvm-14))
+ (list llvm-15))
(home-page "https://llvm.org/")
(synopsis "LLVM Software Testing Tool")
(description "@code{lit} is a portable tool for executing LLVM and Clang
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 2b5b1235e4..3103e629d9 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -163,7 +163,9 @@ (define ldc-bootstrap
#:tests? #f ;skip in the bootstrap
#:build-type "Release"
#:configure-flags
- (list "-GNinja")
+ (list "-GNinja"
+ "-DLLVM_IS_SHARED=ON"
+ "-DBUILD_SHARED_LIBS=ON")
#:make-flags ;used as build targets
(list "all")
#:phases
@@ -190,8 +192,8 @@ (define ldc-bootstrap
("libedit" ,libedit)
("zlib" ,zlib)))
(native-inputs
- `(("lld-wrapper" ,(make-lld-wrapper lld-14 #:lld-as-ld? #t))
- ("llvm" ,llvm-14)
+ `(("lld-wrapper" ,(make-lld-wrapper lld-15 #:lld-as-ld? #t))
+ ("llvm" ,llvm-15)
("ldc" ,gdmd)
("ninja" ,ninja)
("python-wrapper" ,python-wrapper)
@@ -224,10 +226,6 @@ (define-public ldc
'(list "all"
;; Also build the test runner binaries.
"ldc2-unittest" "all-test-runners"))
- ((#:configure-flags flags)
- `(,@flags "-DBUILD_SHARED_LIBS=ON"
- "-DLDC_LINK_MANUALLY=OFF"
- "-DLDC_DYNAMIC_COMPILE=OFF"))
((#:phases phases)
`(modify-phases ,phases
(add-after 'unpack 'fix-compiler-rt-library-discovery
@@ -314,13 +312,39 @@ (define-public ldc
"instrument/xray_check_pipeline.d"
"instrument/xray_link.d"
"instrument/xray_simple_execution.d"
+ "sanitizers/fuzz_asan.d"
+ "sanitizers/fuzz_basic.d"
+ "sanitizers/fuzz_mixin.d"
+ "sanitizers/link_fuzzer.d"
"sanitizers/msan_noerror.d"
"sanitizers/msan_uninitialized.d"
"dmd/runnable_cxx/cppa.d")))
(,(target-aarch64?)
(for-each delete-file
- '("dmd/runnable/ldc_cabi1.d"
+ '("PGO/allstatementtypes.d"
+ "PGO/branching_switch.d"
+ "PGO/break.d"
+ "PGO/exceptions.d"
+ "PGO/final_switch_release.d"
+ "PGO/functions.d"
+ "PGO/hash.d"
+ "PGO/hash_smallchange.d"
+ "PGO/irbased_indirect_calls.d"
+ "PGO/max_function_count.d"
+ "PGO/profile_rt_calls.d"
+ "PGO/reset_counters.d"
+ "PGO/singleobj.d"
+ "PGO/summary.d"
+ "PGO/unrolledloopstatement_gh3375.d"
+ "instrument/xray_link.d"
+ "instrument/xray_simple_execution.d"
+ "sanitizers/asan_dynalloc.d"
+ "sanitizers/asan_interface.d"
+ "sanitizers/asan_noerror.d"
+ "sanitizers/asan_stackoverflow.d"
+ "sanitizers/fuzz_asan.d"
"sanitizers/fuzz_basic.d"
+ "sanitizers/lsan_memleak.d"
"sanitizers/msan_noerror.d"
"sanitizers/msan_uninitialized.d")))
(#t '())))))
@@ -341,9 +365,11 @@ (define-public ldc
;; finer-grained diagnostics (see:
;; https://raw.githubusercontent.com/ldc-developers/
;; ldc/master/.azure-pipelines/3-posix-test.yml)
- (display "running the ldc2 unit tests...\n")
- (invoke "ctest" "--output-on-failure" "-j" job-count
- "-R" "ldc2-unittest")
+ ;; This test segfaults on i686-linux.
+ (unless ,(target-x86-32?)
+ (display "running the ldc2 unit tests...\n")
+ (invoke "ctest" "--output-on-failure" "-j" job-count
+ "-R" "ldc2-unittest"))
(display "running the lit test suite...\n")
(invoke "ctest" "--output-on-failure" "-j" job-count
"-R" "lit-tests")
@@ -354,12 +380,24 @@ (define-public ldc
(display "running the defaultlib unit tests and druntime \
integration tests...\n")
(invoke "ctest" "--output-on-failure" "-j" job-count
- "-E" "dmd-testsuite|lit-tests|ldc2-unittest")))))))))
+ "-E" (string-join
+ (append
+ (list "dmd-testsuite"
+ "lit-tests"
+ "ldc2-unittest")
+ ;; from .cirrus.yaml
+ (if ,(target-aarch64?)
+ '("^core.thread.fiber(-shared)?$"
+ "^std.internal.math.gammafunction"
+ "^std.math.exponential(-shared)?$"
+ "^druntime-test-exceptions-debug$")
+ `()))
+ "|"))))))))))
(native-inputs
(append (delete "llvm"
(alist-replace "ldc" (list ldc-bootstrap)
(package-native-inputs ldc-bootstrap)))
- `(("clang" ,clang-14) ;propagates llvm and clang-runtime
+ `(("clang" ,clang-15) ;propagates llvm and clang-runtime
("python-lit" ,python-lit))))))
(define-public dub
--
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
E
E
Efraim Flashner wrote on 22 Jun 2023 11:19
[PATCH 6/7] gnu: ldc: Enable building on more architectures.
(address . 64218@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
67098e2f87ffdd1bceb29a811680a2ac4d30ed96.1687425321.git.efraim@flashner.co.il
* gnu/packages/dlang.scm (ldc)[arguments]: In the custom phase
'fix-compiler-rt-library-discovery rewrite gnu-triplet->clang-arch to
pass-through unmatched architectures.
---
gnu/packages/dlang.scm | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 3103e629d9..92600f759e 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -234,19 +234,12 @@ (define-public ldc
(system ,(or (%current-target-system)
(%current-system))))
(define (gnu-triplet->clang-arch system)
- (letrec-syntax
- ((matches (syntax-rules (=>)
- ((_ (system-prefix => target) rest ...)
- (if (string-prefix? system-prefix system)
- target
- (matches rest ...)))
- ((_)
- (error "Clang target for system is unknown"
- system)))))
- (matches ("x86_64" => "x86_64")
- ("i686" => "i386")
- ("armhf" => "armhf")
- ("aarch64" => "aarch64"))))
+ (let ((system-prefix
+ (car (string-tokenize
+ system (char-set-complement (char-set #\-))))))
+ (cond
+ ((equal? system-prefix "i686") "i386")
+ (#t system-prefix))))
;; Coax LLVM into agreeing with Clang about system target
;; naming.
(substitute* "driver/linker-gcc.cpp"
--
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
E
E
Efraim Flashner wrote on 22 Jun 2023 11:19
[PATCH 7/7] gnu: sambamba: Fix building.
(address . 64218@debbugs.gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
1ecebd6162fabea2e9fd0f2c849ecf079a008355.1687425321.git.efraim@flashner.co.il
* gnu/packages/bioinformatics.scm (sambamba)[native-inputs]: Remove
ld-gold-wrapper, bintutils-gold. Remove input labels.
---
gnu/packages/bioinformatics.scm | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

Toggle diff (23 lines)
diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 4edcc28d12..87e7c33b90 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -11732,13 +11732,7 @@ (define-public sambamba
(copy-file (string-append "bin/sambamba-" ,version)
(string-append bin "/sambamba"))))))))
(native-inputs
- `(("ld-gold-wrapper"
- ;; Importing (gnu packages commencement) would introduce a cycle.
- ,(module-ref (resolve-interface
- '(gnu packages commencement))
- 'ld-gold-wrapper))
- ("binutils-gold" ,binutils-gold)
- ("python" ,python)))
+ (list python))
(inputs
(list ldc lz4 zlib))
(home-page "https://github.com/biod/sambamba")
--
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
E
E
Efraim Flashner wrote on 3 Dec 2023 10:21
Re: bug#64218: Acknowledgement ([PATCH 0/7] build ldc with llvm-15)
(address . 64218-done@debbugs.gnu.org)
ZWxIlYZWeafFFLaT@3900XT
I've applied some of the patches in this series but not the one
upgrading the version of llvm used to build ldc. I'm still not happy
with the number of tests which need to be skipped to make it pass on
some architectures.

Closing this patch series, feel free to open a new one when adjusting
ldc at at later date.

--
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
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmVsSJUACgkQQarn3Mo9
g1EYVA//Xy3mJGEbvU5YgdIjdHn/DPUIlebZP2CmnvD9HyeSntKiSomFKqg1zpB+
KPAQg7Y2rn3EjkAiyxWwVd+Z6VESZ7v2QH9fFvtUqpg1bHGjXPiu8nvWiLoYGBUz
pai1ieHUpORRwOoyeuFA7MhnlBqQFP0O42+9uyXJdLmxQolXpVft6vLyE1oWEc9Y
mofN8/avsz1Sd3ZYShwNwYa7yMTleLFXTl8d4Kqkqz9HhZ0JUlrj6NLCzDN89oG5
ekctSwcuF8AN1wyO4RQ0S6CKmt1Kp41VSM7FizuzB8bGqZ3D0jFQm5S9FvPCp0ek
PGQn+3B3get7oEjq8f94IOiDIJVIC5U0WdQskOiI4hPNDlVLPW00J4ne2riDsD7D
M31QXjAuBhg+016ZU4fomYdrrmg+2Ga+ucOJ/zPulLLYih0UyRBuBy76gVC4GWMw
c9QhnkMxKjHJ5UsR3FR1XFGEJjneZdWrM8hK3veG8tjk3jw9FAb8DRhc946j8p6W
1cVd69IoJpgnrlHHJkAmPKOAIzgksLXKxDA5NKeWh5zoJJhDGj4uoM96IK905WRW
GQQZT5mrhgXlGZnVVAe3DkrubrjJUqbRhMGSoJOQnsDaw8E7YROxsLhODYJmTqOD
aSIk3tVF8wvqL9Qf16blULyv8Dv3D7axJ2qekxFaaO1rJTuvkto=
=8R86
-----END PGP SIGNATURE-----


Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 64218@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 64218
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch