summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorBernhard Kaindl <43588962+bernhardkaindl@users.noreply.github.com>2021-11-29 21:48:18 +0100
committerGitHub <noreply@github.com>2021-11-29 12:48:18 -0800
commit2d34082b0c91a564327854240f4d2e54003b3987 (patch)
tree1d7146c62bf0d890ab73ff443fa1ea9508cc319f /var
parent1f1da6806c87f73bf53c03a2a3264825530a2b93 (diff)
downloadspack-2d34082b0c91a564327854240f4d2e54003b3987.tar.gz
spack-2d34082b0c91a564327854240f4d2e54003b3987.tar.bz2
spack-2d34082b0c91a564327854240f4d2e54003b3987.tar.xz
spack-2d34082b0c91a564327854240f4d2e54003b3987.zip
llvm: Fix building llvm@4:9 using %clang@6: and %gcc@10: (#27233)
Add z3 variant, fix @:9%gcc@9: with glibc2.31, fix no_cyclades range
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/llvm/llvm4-lld-ELF-Symbols.patch112
-rw-r--r--var/spack/repos/builtin/packages/llvm/llvm5-lld-ELF-Symbols.patch33
-rw-r--r--var/spack/repos/builtin/packages/llvm/llvm5-sanitizer-ustat.patch25
-rw-r--r--var/spack/repos/builtin/packages/llvm/missing-includes.patch23
-rw-r--r--var/spack/repos/builtin/packages/llvm/no_cyclades9.patch42
-rw-r--r--var/spack/repos/builtin/packages/llvm/package.py75
-rw-r--r--var/spack/repos/builtin/packages/llvm/sanitizer-ipc_perm_mode.patch9
-rw-r--r--var/spack/repos/builtin/packages/llvm/xray_buffer_queue-cstddef.patch5
8 files changed, 308 insertions, 16 deletions
diff --git a/var/spack/repos/builtin/packages/llvm/llvm4-lld-ELF-Symbols.patch b/var/spack/repos/builtin/packages/llvm/llvm4-lld-ELF-Symbols.patch
new file mode 100644
index 0000000000..1a86cda358
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/llvm4-lld-ELF-Symbols.patch
@@ -0,0 +1,112 @@
+--- a/lldb/include/lldb/Utility/TaskPool.h
++++ b/lldb/include/lldb/Utility/TaskPool.h
+@@ -33,6 +33,7 @@
+ #include <queue>
+ #include <thread>
+ #include <vector>
++#include <functional>
+
+ // Global TaskPool class for running tasks in parallel on a set of worker thread
+ // created the first
+# Fix lld templates: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230463
+--- a/lld/ELF/LTO.cpp
++++ b/lld/ELF/LTO.cpp
+@@ -158,7 +158,7 @@
+ return Ret;
+ }
+
+-template void BitcodeCompiler::template add<ELF32LE>(BitcodeFile &);
+-template void BitcodeCompiler::template add<ELF32BE>(BitcodeFile &);
+-template void BitcodeCompiler::template add<ELF64LE>(BitcodeFile &);
+-template void BitcodeCompiler::template add<ELF64BE>(BitcodeFile &);
++template void BitcodeCompiler::add<ELF32LE>(BitcodeFile &);
++template void BitcodeCompiler::add<ELF32BE>(BitcodeFile &);
++template void BitcodeCompiler::add<ELF64LE>(BitcodeFile &);
++template void BitcodeCompiler::add<ELF64BE>(BitcodeFile &);
+--- a/lld/ELF/Symbols.cpp
++++ b/lld/ELF/Symbols.cpp
+@@ -343,45 +343,45 @@
+ template bool SymbolBody::hasThunk<ELF64LE>() const;
+ template bool SymbolBody::hasThunk<ELF64BE>() const;
+
+-template uint32_t SymbolBody::template getVA<ELF32LE>(uint32_t) const;
+-template uint32_t SymbolBody::template getVA<ELF32BE>(uint32_t) const;
+-template uint64_t SymbolBody::template getVA<ELF64LE>(uint64_t) const;
+-template uint64_t SymbolBody::template getVA<ELF64BE>(uint64_t) const;
+-
+-template uint32_t SymbolBody::template getGotVA<ELF32LE>() const;
+-template uint32_t SymbolBody::template getGotVA<ELF32BE>() const;
+-template uint64_t SymbolBody::template getGotVA<ELF64LE>() const;
+-template uint64_t SymbolBody::template getGotVA<ELF64BE>() const;
+-
+-template uint32_t SymbolBody::template getGotOffset<ELF32LE>() const;
+-template uint32_t SymbolBody::template getGotOffset<ELF32BE>() const;
+-template uint64_t SymbolBody::template getGotOffset<ELF64LE>() const;
+-template uint64_t SymbolBody::template getGotOffset<ELF64BE>() const;
+-
+-template uint32_t SymbolBody::template getGotPltVA<ELF32LE>() const;
+-template uint32_t SymbolBody::template getGotPltVA<ELF32BE>() const;
+-template uint64_t SymbolBody::template getGotPltVA<ELF64LE>() const;
+-template uint64_t SymbolBody::template getGotPltVA<ELF64BE>() const;
+-
+-template uint32_t SymbolBody::template getThunkVA<ELF32LE>() const;
+-template uint32_t SymbolBody::template getThunkVA<ELF32BE>() const;
+-template uint64_t SymbolBody::template getThunkVA<ELF64LE>() const;
+-template uint64_t SymbolBody::template getThunkVA<ELF64BE>() const;
+-
+-template uint32_t SymbolBody::template getGotPltOffset<ELF32LE>() const;
+-template uint32_t SymbolBody::template getGotPltOffset<ELF32BE>() const;
+-template uint64_t SymbolBody::template getGotPltOffset<ELF64LE>() const;
+-template uint64_t SymbolBody::template getGotPltOffset<ELF64BE>() const;
+-
+-template uint32_t SymbolBody::template getPltVA<ELF32LE>() const;
+-template uint32_t SymbolBody::template getPltVA<ELF32BE>() const;
+-template uint64_t SymbolBody::template getPltVA<ELF64LE>() const;
+-template uint64_t SymbolBody::template getPltVA<ELF64BE>() const;
+-
+-template uint32_t SymbolBody::template getSize<ELF32LE>() const;
+-template uint32_t SymbolBody::template getSize<ELF32BE>() const;
+-template uint64_t SymbolBody::template getSize<ELF64LE>() const;
+-template uint64_t SymbolBody::template getSize<ELF64BE>() const;
++template uint32_t SymbolBody::getVA<ELF32LE>(uint32_t) const;
++template uint32_t SymbolBody::getVA<ELF32BE>(uint32_t) const;
++template uint64_t SymbolBody::getVA<ELF64LE>(uint64_t) const;
++template uint64_t SymbolBody::getVA<ELF64BE>(uint64_t) const;
++
++template uint32_t SymbolBody::getGotVA<ELF32LE>() const;
++template uint32_t SymbolBody::getGotVA<ELF32BE>() const;
++template uint64_t SymbolBody::getGotVA<ELF64LE>() const;
++template uint64_t SymbolBody::getGotVA<ELF64BE>() const;
++
++template uint32_t SymbolBody::getGotOffset<ELF32LE>() const;
++template uint32_t SymbolBody::getGotOffset<ELF32BE>() const;
++template uint64_t SymbolBody::getGotOffset<ELF64LE>() const;
++template uint64_t SymbolBody::getGotOffset<ELF64BE>() const;
++
++template uint32_t SymbolBody::getGotPltVA<ELF32LE>() const;
++template uint32_t SymbolBody::getGotPltVA<ELF32BE>() const;
++template uint64_t SymbolBody::getGotPltVA<ELF64LE>() const;
++template uint64_t SymbolBody::getGotPltVA<ELF64BE>() const;
++
++template uint32_t SymbolBody::getThunkVA<ELF32LE>() const;
++template uint32_t SymbolBody::getThunkVA<ELF32BE>() const;
++template uint64_t SymbolBody::getThunkVA<ELF64LE>() const;
++template uint64_t SymbolBody::getThunkVA<ELF64BE>() const;
++
++template uint32_t SymbolBody::getGotPltOffset<ELF32LE>() const;
++template uint32_t SymbolBody::getGotPltOffset<ELF32BE>() const;
++template uint64_t SymbolBody::getGotPltOffset<ELF64LE>() const;
++template uint64_t SymbolBody::getGotPltOffset<ELF64BE>() const;
++
++template uint32_t SymbolBody::getPltVA<ELF32LE>() const;
++template uint32_t SymbolBody::getPltVA<ELF32BE>() const;
++template uint64_t SymbolBody::getPltVA<ELF64LE>() const;
++template uint64_t SymbolBody::getPltVA<ELF64BE>() const;
++
++template uint32_t SymbolBody::getSize<ELF32LE>() const;
++template uint32_t SymbolBody::getSize<ELF32BE>() const;
++template uint64_t SymbolBody::getSize<ELF64LE>() const;
++template uint64_t SymbolBody::getSize<ELF64BE>() const;
+
+ template class elf::Undefined<ELF32LE>;
+ template class elf::Undefined<ELF32BE>;
diff --git a/var/spack/repos/builtin/packages/llvm/llvm5-lld-ELF-Symbols.patch b/var/spack/repos/builtin/packages/llvm/llvm5-lld-ELF-Symbols.patch
new file mode 100644
index 0000000000..727647d3b8
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/llvm5-lld-ELF-Symbols.patch
@@ -0,0 +1,33 @@
+# Fix lld templates: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230463
+--- a/lld/ELF/Symbols.cpp
++++ b/lld/ELF/Symbols.cpp
+@@ -383,17 +383,17 @@
+ return B.getName();
+ }
+
+-template uint32_t SymbolBody::template getSize<ELF32LE>() const;
+-template uint32_t SymbolBody::template getSize<ELF32BE>() const;
+-template uint64_t SymbolBody::template getSize<ELF64LE>() const;
+-template uint64_t SymbolBody::template getSize<ELF64BE>() const;
++template uint32_t SymbolBody::getSize<ELF32LE>() const;
++template uint32_t SymbolBody::getSize<ELF32BE>() const;
++template uint64_t SymbolBody::getSize<ELF64LE>() const;
++template uint64_t SymbolBody::getSize<ELF64BE>() const;
+
+-template bool DefinedRegular::template isMipsPIC<ELF32LE>() const;
+-template bool DefinedRegular::template isMipsPIC<ELF32BE>() const;
+-template bool DefinedRegular::template isMipsPIC<ELF64LE>() const;
+-template bool DefinedRegular::template isMipsPIC<ELF64BE>() const;
++template bool DefinedRegular::isMipsPIC<ELF32LE>() const;
++template bool DefinedRegular::isMipsPIC<ELF32BE>() const;
++template bool DefinedRegular::isMipsPIC<ELF64LE>() const;
++template bool DefinedRegular::isMipsPIC<ELF64BE>() const;
+
+-template uint32_t SharedSymbol::template getAlignment<ELF32LE>() const;
+-template uint32_t SharedSymbol::template getAlignment<ELF32BE>() const;
+-template uint32_t SharedSymbol::template getAlignment<ELF64LE>() const;
+-template uint32_t SharedSymbol::template getAlignment<ELF64BE>() const;
++template uint32_t SharedSymbol::getAlignment<ELF32LE>() const;
++template uint32_t SharedSymbol::getAlignment<ELF32BE>() const;
++template uint32_t SharedSymbol::getAlignment<ELF64LE>() const;
++template uint32_t SharedSymbol::getAlignment<ELF64BE>() const;
diff --git a/var/spack/repos/builtin/packages/llvm/llvm5-sanitizer-ustat.patch b/var/spack/repos/builtin/packages/llvm/llvm5-sanitizer-ustat.patch
new file mode 100644
index 0000000000..531a3c5d6d
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/llvm5-sanitizer-ustat.patch
@@ -0,0 +1,25 @@
+# <sys/ustat.h> has been removed from glibc 2.28,
+# backport fix from llvm-6.0.1:
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -159,1 +159,0 @@
+-#include <sys/ustat.h>
+@@ -252,5 +252,17 @@
+
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+- unsigned struct_ustat_sz = sizeof(struct ustat);
++ // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
++ // has been removed from glibc 2.28.
++#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
++ || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
++ || defined(__x86_64__)
++#define SIZEOF_STRUCT_USTAT 32
++#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
++ || defined(__powerpc__) || defined(__s390__)
++#define SIZEOF_STRUCT_USTAT 20
++#else
++#error Unknown size of struct ustat
++#endif
++ unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
+ unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
+ unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
diff --git a/var/spack/repos/builtin/packages/llvm/missing-includes.patch b/var/spack/repos/builtin/packages/llvm/missing-includes.patch
new file mode 100644
index 0000000000..e88b8fcfde
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/missing-includes.patch
@@ -0,0 +1,23 @@
+# https://github.com/spack/spack/issues/24270 (This hunk is upstream since llvm-10)
+--- a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
++++ b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
+@@ -4,6 +4,8 @@
+ #include "llvm/Demangle/Compiler.h"
+ #include "llvm/Demangle/StringView.h"
+ #include <array>
++#include <cstdint>
++#include <string>
+
+ class OutputStream;
+
+# https://github.com/spack/spack/pull/27233
+--- a/llvm/utils/benchmark/src/benchmark_register.h
++++ b/llvm/utils/benchmark/src/benchmark_register.h
+@@ -2,6 +2,7 @@
+ #define BENCHMARK_REGISTER_H
+
+ #include <vector>
++#include <limits>
+
+ #include "check.h"
+
diff --git a/var/spack/repos/builtin/packages/llvm/no_cyclades9.patch b/var/spack/repos/builtin/packages/llvm/no_cyclades9.patch
new file mode 100644
index 0000000000..7532865e6d
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/no_cyclades9.patch
@@ -0,0 +1,42 @@
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+@@ -370,9 +370,0 @@
+- _(CYGETDEFTHRESH, WRITE, sizeof(int));
+- _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
+- _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
+- _(CYGETTHRESH, WRITE, sizeof(int));
+- _(CYGETTIMEOUT, WRITE, sizeof(int));
+- _(CYSETDEFTHRESH, NONE, 0);
+- _(CYSETDEFTIMEOUT, NONE, 0);
+- _(CYSETTHRESH, NONE, 0);
+- _(CYSETTIMEOUT, NONE, 0);
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -986,1 +986,0 @@
+- extern unsigned struct_cyclades_monitor_sz;
+@@ -1331,9 +1327,0 @@
+- extern unsigned IOCTL_CYGETDEFTHRESH;
+- extern unsigned IOCTL_CYGETDEFTIMEOUT;
+- extern unsigned IOCTL_CYGETMON;
+- extern unsigned IOCTL_CYGETTHRESH;
+- extern unsigned IOCTL_CYGETTIMEOUT;
+- extern unsigned IOCTL_CYSETDEFTHRESH;
+- extern unsigned IOCTL_CYSETDEFTIMEOUT;
+- extern unsigned IOCTL_CYSETTHRESH;
+- extern unsigned IOCTL_CYSETTIMEOUT;
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -143,1 +143,0 @@
+-#include <linux/cyclades.h>
+@@ -460,1 +459,0 @@
+- unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
+@@ -824,9 +822,0 @@
+- unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
+- unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
+- unsigned IOCTL_CYGETMON = CYGETMON;
+- unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
+- unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
+- unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
+- unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
+- unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
+- unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py
index 36c3984dc1..d87c924d6b 100644
--- a/var/spack/repos/builtin/packages/llvm/package.py
+++ b/var/spack/repos/builtin/packages/llvm/package.py
@@ -2,6 +2,7 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import os
import os.path
import re
import sys
@@ -163,11 +164,13 @@ class Llvm(CMakePackage, CudaPackage):
variant("python", default=False, description="Install python bindings")
variant('version_suffix', default='none', description="Add a symbol suffix")
+ variant('z3', default=False, description='Use Z3 for the clang static analyzer')
extends("python", when="+python")
# Build dependency
depends_on("cmake@3.4.3:", type="build")
+ depends_on('cmake@3.13.4:', type='build', when='@12:')
depends_on("ninja", type="build")
depends_on("python@2.7:2.8", when="@:4 ~python", type="build")
depends_on("python", when="@5: ~python", type="build")
@@ -176,7 +179,7 @@ class Llvm(CMakePackage, CudaPackage):
# Universal dependency
depends_on("python@2.7:2.8", when="@:4+python")
depends_on("python", when="@5:+python")
- depends_on("z3", when="@9:")
+ depends_on('z3', when='@8:+clang+z3')
# openmp dependencies
depends_on("perl-data-dumper", type=("build"))
@@ -212,10 +215,13 @@ class Llvm(CMakePackage, CudaPackage):
conflicts('~mlir', when='+flang', msg='Flang requires MLIR')
# Older LLVM do not build with newer compilers, and vice versa
- conflicts("%gcc@11:", when="@:7")
conflicts("%gcc@8:", when="@:5")
conflicts("%gcc@:5.0", when="@8:")
- conflicts("%apple-clang@13:", when="@:9")
+ # clang/lib: a lambda parameter cannot shadow an explicitly captured entity
+ conflicts("%clang@8:", when="@:4")
+
+ # When these versions are concretized, but not explicitly with +libcxx, these
+ # conflicts will enable clingo to set ~libcxx, making the build successful:
# libc++ of LLVM13, see https://libcxx.llvm.org/#platform-and-compiler-support
# @13 does not support %gcc@:10 https://bugs.llvm.org/show_bug.cgi?id=51359#c1
@@ -224,7 +230,15 @@ class Llvm(CMakePackage, CudaPackage):
# AppleClang 12 - latest stable release per Xcode release page
conflicts("%gcc@:10", when="@13:+libcxx")
conflicts("%clang@:10", when="@13:+libcxx")
- conflicts("%apple_clang@:11", when="@13:+libcxx")
+ conflicts("%apple-clang@:11", when="@13:+libcxx")
+
+ # libcxx-4 and compiler-rt-4 fail to build with "newer" clang and gcc versions:
+ conflicts('%gcc@7:', when='@:4+libcxx')
+ conflicts('%clang@6:', when='@:4+libcxx')
+ conflicts('%apple-clang@6:', when='@:4+libcxx')
+ conflicts('%gcc@7:', when='@:4+compiler-rt')
+ conflicts('%clang@6:', when='@:4+compiler-rt')
+ conflicts('%apple-clang@6:', when='@:4+compiler-rt')
# OMP TSAN exists in > 5.x
conflicts("+omp_tsan", when="@:5")
@@ -260,10 +274,22 @@ class Llvm(CMakePackage, CudaPackage):
# Github issue #4986
patch("llvm_gcc7.patch", when="@4.0.0:4.0.1+lldb %gcc@7.0:")
- # https://github.com/spack/spack/issues/24270
- patch('https://src.fedoraproject.org/rpms/llvm10/raw/7ce7ebd066955ea95ba2b491c41fbc6e4ee0643a/f/llvm10-gcc11.patch',
- sha256='958c64838c9d469be514eef195eca0f8c3ab069bc4b64a48fad59991c626bab8',
- when='@8:11 %gcc@11:')
+ # sys/ustat.h has been removed in favour of statfs from glibc-2.28. Use fixed sizes:
+ patch('llvm5-sanitizer-ustat.patch', when="@4:6+compiler-rt")
+
+ # Fix lld templates: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230463
+ patch('llvm4-lld-ELF-Symbols.patch', when="@4+lld%clang@6:")
+ patch('llvm5-lld-ELF-Symbols.patch', when="@5+lld%clang@7:")
+
+ # Fix missing std:size_t in 'llvm@4:5' when built with '%clang@7:'
+ patch('xray_buffer_queue-cstddef.patch', when="@4:5+compiler-rt%clang@7:")
+
+ # https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
+ patch('sanitizer-ipc_perm_mode.patch', when="@5:7+compiler-rt%clang@11:")
+ patch('sanitizer-ipc_perm_mode.patch', when="@5:9+compiler-rt%gcc@9:")
+
+ # github.com/spack/spack/issues/24270 and MicrosoftDemangle: %gcc@10: and %clang@13:
+ patch('missing-includes.patch', when='@8:11')
# Backport from llvm master + additional fix
# see https://bugs.llvm.org/show_bug.cgi?id=39696
@@ -292,7 +318,8 @@ class Llvm(CMakePackage, CudaPackage):
# Remove cyclades support to build against newer kernel headers
# https://reviews.llvm.org/D102059
- patch('no_cyclades.patch', when='@10:11')
+ patch('no_cyclades.patch', when='@10:12.0.0')
+ patch('no_cyclades9.patch', when='@6:9')
# The functions and attributes below implement external package
# detection for LLVM. See:
@@ -457,6 +484,17 @@ class Llvm(CMakePackage, CudaPackage):
return(None, flags, None)
return(flags, None, None)
+ def setup_build_environment(self, env):
+ """When using %clang, add only its ld.lld-$ver and/or ld.lld to our PATH"""
+ if self.compiler.name in ['clang', 'apple-clang']:
+ for lld in 'ld.lld-{0}'.format(self.compiler.version.version[0]), 'ld.lld':
+ bin = os.path.join(os.path.dirname(self.compiler.cc), lld)
+ sym = os.path.join(self.stage.path, 'ld.lld')
+ if os.path.exists(bin) and not os.path.exists(sym):
+ mkdirp(self.stage.path)
+ os.symlink(bin, sym)
+ env.prepend_path('PATH', self.stage.path)
+
def setup_run_environment(self, env):
if "+clang" in self.spec:
env.set("CC", join_path(self.spec.prefix.bin, "clang"))
@@ -543,6 +581,13 @@ class Llvm(CMakePackage, CudaPackage):
else:
projects.append("openmp")
+ if self.spec.satisfies("@8"):
+ cmake_args.append(define('CLANG_ANALYZER_ENABLE_Z3_SOLVER',
+ self.spec.satisfies('@8+z3')))
+ if self.spec.satisfies("@9:"):
+ cmake_args.append(define('LLVM_ENABLE_Z3_SOLVER',
+ self.spec.satisfies('@9:+z3')))
+
if "+flang" in spec:
projects.append("flang")
if "+lldb" in spec:
@@ -566,15 +611,13 @@ class Llvm(CMakePackage, CudaPackage):
from_variant("BUILD_SHARED_LIBS", "shared_libs"),
from_variant("LLVM_BUILD_LLVM_DYLIB", "build_llvm_dylib"),
from_variant("LLVM_LINK_LLVM_DYLIB", "link_llvm_dylib"),
- from_variant("LLVM_USE_SPLIT_DWARF", "split_dwarf")
+ from_variant("LLVM_USE_SPLIT_DWARF", "split_dwarf"),
+ # By default on Linux, libc++.so is a ldscript. CMake fails to add
+ # CMAKE_INSTALL_RPATH to it, which fails. Statically link libc++abi.a
+ # into libc++.so, linking with -lc++ or -stdlib=libc++ is enough.
+ define('LIBCXX_ENABLE_STATIC_ABI_LIBRARY', True)
])
- # By default on Linux, libc++.so is a linker script, and CMake tries to add the
- # CMAKE_INSTALL_RPATH to it, which fails, causing installation to fail. The
- # easiest workaround is to just statically link libc++abi.a into libc++.so,
- # so that linking with -lc++ or -stdlib=libc++ is enough.
- cmake_args.append(define('LIBCXX_ENABLE_STATIC_ABI_LIBRARY', True))
-
if "+all_targets" not in spec: # all is default on cmake
targets = ["NVPTX", "AMDGPU"]
diff --git a/var/spack/repos/builtin/packages/llvm/sanitizer-ipc_perm_mode.patch b/var/spack/repos/builtin/packages/llvm/sanitizer-ipc_perm_mode.patch
new file mode 100644
index 0000000000..8f91703a32
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/sanitizer-ipc_perm_mode.patch
@@ -0,0 +1,9 @@
+# ipc_perm.mode is not used and has changed from short to int over architecures
+# and versions. The last change was in glibc-2.31.
+# LLVM upstream decided to not check ipc_perm.mode below glibc-2.31,
+# because it is not actually used in the sanitizer:
+# github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1143,1 +1143,0 @@
+-CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
diff --git a/var/spack/repos/builtin/packages/llvm/xray_buffer_queue-cstddef.patch b/var/spack/repos/builtin/packages/llvm/xray_buffer_queue-cstddef.patch
new file mode 100644
index 0000000000..b5ca841e3e
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/xray_buffer_queue-cstddef.patch
@@ -0,0 +1,5 @@
+# Fix missing std:size_t in 'llvm@4:5' for build with '%clang@7:'
+--- a/compiler-rt/lib/xray/xray_buffer_queue.h
++++ b/compiler-rt/lib/xray/xray_buffer_queue.h
+@@ -18,0 +18,1 @@
++#include <cstddef>