aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/dlang.scm4
-rw-r--r--gnu/packages/gl.scm2
-rw-r--r--gnu/packages/llvm.scm47
-rw-r--r--gnu/packages/patches/clang-7.0-libc-search-path.patch82
5 files changed, 113 insertions, 23 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index a2a13a5fa1..0484b3e085 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -683,6 +683,7 @@ dist_patch_DATA = \
%D%/packages/patches/clang-3.5-libsanitizer-ustat-fix.patch \
%D%/packages/patches/clang-3.8-libc-search-path.patch \
%D%/packages/patches/clang-6.0-libc-search-path.patch \
+ %D%/packages/patches/clang-7.0-libc-search-path.patch \
%D%/packages/patches/clang-runtime-asan-build-fixes.patch \
%D%/packages/patches/clang-runtime-esan-build-fixes.patch \
%D%/packages/patches/classpath-aarch64-support.patch \
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index c03c24d9e2..2530b8a3c7 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -249,8 +249,8 @@ bootstrapping more recent compilers written in D.")
(setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
(invoke "make" "test" "-j" (number->string (parallel-job-count))))))))
(native-inputs
- `(("llvm" ,llvm)
- ("clang" ,clang)
+ `(("llvm" ,llvm-6)
+ ("clang" ,clang-6)
("ldc" ,ldc-bootstrap)
("python-lit" ,python-lit)
("python-wrapper" ,python-wrapper)
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index b673cbffe6..37b8fce7cb 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -257,7 +257,7 @@ also known as DXTn or DXTC) for Mesa.")
("libxvmc" ,libxvmc)
,@(match (%current-system)
((or "x86_64-linux" "i686-linux")
- `(("llvm" ,llvm)))
+ `(("llvm" ,llvm-6))) ;TODO: Change to LLVM in the next rebuild cycle.
(_
`()))
("makedepend" ,makedepend)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index bea52ea480..9a4cca35d0 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -5,7 +5,7 @@
;;; Copyright © 2016 Dennis Mungai <dmngaie@gmail.com>
;;; Copyright © 2016, 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
-;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018, 2019 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
@@ -47,7 +47,7 @@
(define-public llvm
(package
(name "llvm")
- (version "6.0.1")
+ (version "7.0.1")
(source
(origin
(method url-fetch)
@@ -55,7 +55,7 @@
version "/llvm-" version ".src.tar.xz"))
(sha256
(base32
- "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn"))))
+ "16s196wqzdw4pmri15hadzqgdi926zln3an2viwyq0kini6zr3d3"))))
(build-system cmake-build-system)
(native-inputs
`(("python" ,python-2) ;bytes->str conversion in clang>=3.7 needs python-2
@@ -95,21 +95,6 @@ languages is in development. The compiler infrastructure includes mirror sets
of programming tools as well as libraries with equivalent functionality.")
(license license:ncsa)))
-;; TODO: Build Mesa with LLVM 7 in the next staging cycle.
-;; TODO: Make LLVM 7 the default LLVM once Clang is also upgraded.
-(define-public llvm-7.0.1
- (package (inherit llvm)
- (name "llvm")
- (version "7.0.1")
- (source
- (origin
- (method url-fetch)
- (uri (string-append "http://llvm.org/releases/"
- version "/llvm-" version ".src.tar.xz"))
- (sha256
- (base32
- "16s196wqzdw4pmri15hadzqgdi926zln3an2viwyq0kini6zr3d3"))))))
-
(define* (clang-runtime-from-llvm llvm hash
#:optional (patches '()))
(package
@@ -190,7 +175,7 @@ compiler. In LLVM this library is called \"compiler-rt\".")
(compiler-rt (assoc-ref inputs "clang-runtime")))
(case (string->number ,(version-major
(package-version clang-runtime)))
- ((6)
+ ((or 6 7)
;; Link to libclang_rt files from clang-runtime.
(substitute* "lib/Driver/ToolChain.cpp"
(("getDriver\\(\\)\\.ResourceDir")
@@ -277,10 +262,32 @@ code analysis tools.")
(define-public clang-runtime
(clang-runtime-from-llvm
llvm
- "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl"))
+ "065ybd8fsc4h2hikbdyricj6pyv4r7r7kpcikhb2y5zf370xybkq"))
(define-public clang
(clang-from-llvm llvm clang-runtime
+ "067lwggnbg0w1dfrps790r5l6k8n5zwhlsw7zb6zvmfpwpfn4nx4"
+ #:patches '("clang-7.0-libc-search-path.patch")))
+
+(define-public llvm-6
+ (package
+ (inherit llvm)
+ (version "6.0.1")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://llvm.org/releases/"
+ version "/llvm-" version ".src.tar.xz"))
+ (sha256
+ (base32
+ "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn"))))))
+
+(define-public clang-runtime-6
+ (clang-runtime-from-llvm
+ llvm-6
+ "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl"))
+
+(define-public clang-6
+ (clang-from-llvm llvm-6 clang-runtime
"0rxn4rh7rrnsqbdgp4gzc8ishbkryhpl1kd3mpnxzpxxhla3y93w"
#:patches '("clang-6.0-libc-search-path.patch")))
diff --git a/gnu/packages/patches/clang-7.0-libc-search-path.patch b/gnu/packages/patches/clang-7.0-libc-search-path.patch
new file mode 100644
index 0000000000..07ff8c90bd
--- /dev/null
+++ b/gnu/packages/patches/clang-7.0-libc-search-path.patch
@@ -0,0 +1,82 @@
+Clang attempts to guess file names based on the OS and distro (yes!),
+but unfortunately, that doesn't work for us.
+
+This patch makes it easy to insert libc's $libdir so that Clang passes the
+correct absolute file name of crt1.o etc. to 'ld'. It also disables all
+the distro-specific stuff and removes the hard-coded FHS directory names
+to make sure Clang also works on non-GuixSD systems.
+
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -225,7 +225,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" +
+ GCCInstallation.getTriple().str() + "/bin")
+ .str());
+-
++ // Comment out the distro-specific tweaks so that they don't bite when
++ // using Guix on a foreign distro.
++#if 0
+ Distro Distro(D.getVFS());
+
+ if (Distro.IsAlpineLinux()) {
+@@ -284,6 +286,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ if (IsAndroid || Distro.IsOpenSUSE())
+ ExtraOpts.push_back("--enable-new-dtags");
++#endif
+
+ // The selection of paths to try here is designed to match the patterns which
+ // the GCC driver itself uses, as this is part of the GCC-compatible driver.
+@@ -342,7 +345,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ // the cross. Note that GCC does include some of these directories in some
+ // configurations but this seems somewhere between questionable and simply
+ // a bug.
+- if (StringRef(LibPath).startswith(SysRoot)) {
++ if (0) {
+ addPathIfExists(D, LibPath + "/" + MultiarchTriple, Paths);
+ addPathIfExists(D, LibPath + "/../" + OSLibDir, Paths);
+ }
+@@ -361,6 +364,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
+ addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);
+
++ // This requires the commented distro tweaks above.
++#if 0
+ if (IsAndroid) {
+ // Android sysroots contain a library directory for each supported OS
+ // version as well as some unversioned libraries in the usual multiarch
+@@ -389,10 +394,14 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ addPathIfExists(D, SysRoot + "/" + OSLibDir + "/" + ABIName, Paths);
+ addPathIfExists(D, SysRoot + "/usr/" + OSLibDir + "/" + ABIName, Paths);
+ }
++#endif
+
+ // Try walking via the GCC triple path in case of biarch or multiarch GCC
+ // installations with strange symlinks.
+ if (GCCInstallation.isValid()) {
++ // The following code would end up adding things like
++ // "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
++#if 0
+ addPathIfExists(D,
+ SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
+ "/../../" + OSLibDir,
+@@ -405,6 +414,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ BiarchSibling.gccSuffix(),
+ Paths);
+ }
++#endif
+
+ // See comments above on the multilib variant for details of why this is
+ // included even from outside the sysroot.
+@@ -429,8 +439,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ if (StringRef(D.Dir).startswith(SysRoot))
+ addPathIfExists(D, D.Dir + "/../lib", Paths);
+
+- addPathIfExists(D, SysRoot + "/lib", Paths);
+- addPathIfExists(D, SysRoot + "/usr/lib", Paths);
++ // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
++ // and friends can be found.
++ addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
+ }
+
+ bool Linux::HasNativeLLVMSupport() const { return true; }