summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Aphecetche <laurent.aphecetche@gmail.com>2023-12-22 13:03:23 +0100
committerGitHub <noreply@github.com>2023-12-22 05:03:23 -0700
commitec9d08e71ec2ef0b50d834f2ee7ad25658689e01 (patch)
tree95c7a7c0a452ecc2eb5c76bce50143f54818cbb9
parent397c0664649068a9923d6eb2f3d49ac801dda27f (diff)
downloadspack-ec9d08e71ec2ef0b50d834f2ee7ad25658689e01.tar.gz
spack-ec9d08e71ec2ef0b50d834f2ee7ad25658689e01.tar.bz2
spack-ec9d08e71ec2ef0b50d834f2ee7ad25658689e01.tar.xz
spack-ec9d08e71ec2ef0b50d834f2ee7ad25658689e01.zip
llvm: fix llvm@14 build with apple-clang-15 (#40191)
* llvm: fix llvm@14 build with apple-clang-15 * fix formatting --------- Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
-rw-r--r--var/spack/repos/builtin/packages/llvm/package.py22
-rw-r--r--var/spack/repos/builtin/packages/llvm/sanitizer-platform-limits-posix-xdr-macos.patch11
2 files changed, 33 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py
index b85e5be19d..d2195fca49 100644
--- a/var/spack/repos/builtin/packages/llvm/package.py
+++ b/var/spack/repos/builtin/packages/llvm/package.py
@@ -572,6 +572,8 @@ class Llvm(CMakePackage, CudaPackage):
patch("add-include-for-libelf-llvm-12-14.patch", when="@12:14")
patch("add-include-for-libelf-llvm-15.patch", when="@15")
+ patch("sanitizer-platform-limits-posix-xdr-macos.patch", when="@10:14 platform=darwin")
+
@when("@14:17")
def patch(self):
# https://github.com/llvm/llvm-project/pull/69458
@@ -940,6 +942,26 @@ class Llvm(CMakePackage, CudaPackage):
# Semicolon seperated list of runtimes to enable
if runtimes:
+ # The older versions are not careful enough with the order of the runtimes.
+ # Instead of applying
+ # https://github.com/llvm/llvm-project/commit/06400a0142af8297b5d39b8f34a7c59db6f9910c,
+ # which might be incompatible with the version that we install,
+ # we sort the runtimes here according to the same order as
+ # in the aforementioned commit:
+ if self.spec.satisfies("@:14"):
+ runtimes_order = [
+ "libc",
+ "libunwind",
+ "libcxxabi",
+ "libcxx",
+ "compiler-rt",
+ "openmp",
+ ]
+ runtimes.sort(
+ key=lambda x: runtimes_order.index(x)
+ if x in runtimes_order
+ else len(runtimes_order)
+ )
cmake_args.extend(
[
define("LLVM_ENABLE_RUNTIMES", runtimes),
diff --git a/var/spack/repos/builtin/packages/llvm/sanitizer-platform-limits-posix-xdr-macos.patch b/var/spack/repos/builtin/packages/llvm/sanitizer-platform-limits-posix-xdr-macos.patch
new file mode 100644
index 0000000000..d4477390f5
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/sanitizer-platform-limits-posix-xdr-macos.patch
@@ -0,0 +1,11 @@
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+@@ -1250,7 +1250,7 @@ CHECK_SIZE_AND_OFFSET(group, gr_passwd);
+ CHECK_SIZE_AND_OFFSET(group, gr_gid);
+ CHECK_SIZE_AND_OFFSET(group, gr_mem);
+
+-#if HAVE_RPC_XDR_H
++#if HAVE_RPC_XDR_H && !SANITIZER_MAC
+ CHECK_TYPE_SIZE(XDR);
+ CHECK_SIZE_AND_OFFSET(XDR, x_op);
+ CHECK_SIZE_AND_OFFSET(XDR, x_ops);