llvm: optionally build compiler-rt, libcxx and libunwind as runtimes (#32476)
* llvm: replace +omp_as_runtime with omp=runtime * llvm: fetch 'libomp-libflags-as-list.patch' from upstream repo * llvm: replace 'llvm14-hwloc-ompd.patch' with the official fix from upstream repo * llvm: fix-up for the black reformatting * llvm: fetch 'constexpr_longdouble.patch' from upstream repo * llvm: optionally build libcxx as a runtime * llvm: fetch 'llvm5-sanitizer-ustat.patch' from upstream repo * llvm: update 'sanitizer-ipc_perm_mode.patch' * llvm: refactor compiler conflicts when libcxx=project * llvm: fetch 'llvm_python_path.patch' from upstream repo * llvm: update comments and condition for 'xray_buffer_queue-cstddef.patch' * llvm: optionally build compiler-rt as a runtime * llvm: fetch 'lldb_external_ncurses-10.patch' from upstream repo * llvm: fetch 'llvm_py37.patch' from upstream repo * llvm: rename variant 'internal_unwind' to 'libunwind' * llvm: optionally build libunwind as a runtime * llvm: extend the list of maintainers * llvm: allow for explicit '~clang~flang~libomptarget~lldb~omp_debug~z3' * llvm: fetch 'llvm5-lld-ELF-Symbols.patch' from FreeBSD port repo * llvm: fetch most of 'missing-includes.patch' from upstream repo and reuse 'llvm-gcc11.patch' * llvm: regroup patches for missing include directives and drop compiler constraints for them * llvm: fetch 'llvm-gcc11.patch' from upstream repo * llvm: fetch 'no_cyclades.patch' from upstream repo * llvm: update comments and condition for 'no_cyclades9.patch' * llvm: rename variant 'omp' to 'openmp' * llvm: constrain and rename variant 'omp_tsan' to 'libomp_tsan' * llvm: rename variant 'omp_debug' to 'libomptarget_debug' * llvm: do not apply same patch twice * llvm: constrain and document the '*-thread.patch' patches * llvm: document the '~lld+libomptarget' conflict * llvm: update comments for the 'D133513.diff' patch
This commit is contained in:
		| @@ -14,7 +14,7 @@ spack: | ||||
|     llvm: | ||||
|       require: "@14:" | ||||
|       # Minimize LLVM | ||||
|       variants: ~lldb~lld~internal_unwind~polly~compiler-rt~gold | ||||
|       variants: "~lldb~lld~polly~gold libunwind=none compiler-rt=none" | ||||
|     all: | ||||
|       require: target=x86_64_v3 | ||||
|  | ||||
|   | ||||
| @@ -50,15 +50,15 @@ class Julia(MakefilePackage): | ||||
|     # Note, we just use link_llvm_dylib so that we not only get a libLLVM, | ||||
|     # but also so that llvm-config --libfiles gives only the dylib. Without | ||||
|     # it it also gives static libraries, and breaks Julia's build. | ||||
|     depends_on("llvm targets=amdgpu,bpf,nvptx,webassembly version_suffix=jl +link_llvm_dylib") | ||||
|     depends_on( | ||||
|         "llvm" | ||||
|         " targets=amdgpu,bpf,nvptx,webassembly" | ||||
|         " version_suffix=jl +link_llvm_dylib libunwind=none" | ||||
|     ) | ||||
|     depends_on("libuv", when="@:1.7") | ||||
|     depends_on("libuv-julia@1.42.0", when="@1.8.0:1.8.1") | ||||
|     depends_on("libuv-julia@1.44.2", when="@1.8.2:") | ||||
| 
 | ||||
|     # Do not use internal unwind.  We need to use a conflict, because | ||||
|     # `internal_unwind` is defined only when `+clang`. | ||||
|     conflicts("^llvm+internal_unwind") | ||||
| 
 | ||||
|     with when("@1.9.0:1.9"): | ||||
|         # libssh2.so.1, libpcre2-8.so.0, mbedtls.so.14, mbedcrypto.so.7, mbedx509.so.1 | ||||
|         # openlibm.so.4, libblastrampoline.so.5, libgit2.so.1.5, libnghttp2.so.14, | ||||
|   | ||||
| @@ -1,28 +0,0 @@ | ||||
| From 3bf63cf3b366d3a57cf5cbad4112a6abf6c0c3b1 Mon Sep 17 00:00:00 2001 | ||||
| From: Marshall Clow <mclow.lists@gmail.com> | ||||
| Date: Tue, 2 Apr 2019 14:46:36 +0000 | ||||
| Subject: [PATCH] Special case some duration arithmetic for GCC and PPC because | ||||
|  their long double constant folding is broken. Fixes PR#39696. | ||||
|  | ||||
| llvm-svn: 357478 | ||||
| --- | ||||
|  libcxx/include/thread | 5 +++++ | ||||
|  1 file changed, 5 insertions(+) | ||||
|  | ||||
| diff --git a/libcxx/include/thread b/libcxx/include/thread | ||||
| index df06ff70f8e37f22f4108be8e5e79a38052a11dd..400459ae7f32c4d7cd24b2d85c49d789500e432d 100644 | ||||
| --- a/libcxx/include/thread | ||||
| +++ b/libcxx/include/thread | ||||
| @@ -434,7 +434,12 @@ sleep_for(const chrono::duration<_Rep, _Period>& __d) | ||||
|      using namespace chrono; | ||||
|      if (__d > duration<_Rep, _Period>::zero()) | ||||
|      { | ||||
| +#if defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__) | ||||
| +    //  GCC's long double const folding is incomplete for IBM128 long doubles. | ||||
| +        _LIBCPP_CONSTEXPR duration<long double> _Max = duration<long double>(ULLONG_MAX/1000000000ULL) ; | ||||
| +#else | ||||
|          _LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max(); | ||||
| +#endif | ||||
|          nanoseconds __ns; | ||||
|          if (__d < _Max) | ||||
|          { | ||||
| @@ -1,38 +0,0 @@ | ||||
| From d9a42ec98adcb1ebc0c3837715df4e5a50c7ccc0 Mon Sep 17 00:00:00 2001 | ||||
| From: "Joel E. Denny" <jdenny.ornl@gmail.com> | ||||
| Date: Wed, 10 Jun 2020 12:40:43 -0400 | ||||
| Subject: [PATCH] [libc++] Work around gcc/Power9 bug in `include/thread` | ||||
|  | ||||
| This fixes PR39696, which breaks the libcxx build with gcc (I tested | ||||
| 7.5.0) on Power9.  This fix was suggested at | ||||
|  | ||||
| https://bugs.llvm.org/show_bug.cgi?id=39696#c38 | ||||
|  | ||||
| but never applied.  It just reverts 0583d9ea8d5e, which reverses | ||||
| components of the original fix in 3bf63cf3b366, which is correct. | ||||
|  | ||||
| Fixes https://llvm.org/PR39696 | ||||
|  | ||||
| Reviewed By: ldionne | ||||
|  | ||||
| Differential Revision: https://reviews.llvm.org/D81438 | ||||
| --- | ||||
|  libcxx/include/thread | 4 ++-- | ||||
|  1 file changed, 2 insertions(+), 2 deletions(-) | ||||
|  | ||||
| diff --git a/libcxx/include/thread b/libcxx/include/thread | ||||
| index 22aa4f201295867cff57b7a944e6b7bd67b22ad3..6eff1800acdbef09eae4417eee977fa350c596ea 100644 | ||||
| --- a/libcxx/include/thread | ||||
| +++ b/libcxx/include/thread | ||||
| @@ -365,9 +365,9 @@ sleep_for(const chrono::duration<_Rep, _Period>& __d) | ||||
|      { | ||||
|  #if defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__) | ||||
|      //  GCC's long double const folding is incomplete for IBM128 long doubles. | ||||
| -        _LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max(); | ||||
| -#else | ||||
|          _LIBCPP_CONSTEXPR duration<long double> _Max = duration<long double>(ULLONG_MAX/1000000000ULL) ; | ||||
| +#else | ||||
| +        _LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max(); | ||||
|  #endif | ||||
|          nanoseconds __ns; | ||||
|          if (__d < _Max) | ||||
| @@ -1,14 +0,0 @@ | ||||
| diff --git a/openmp/runtime/cmake/LibompHandleFlags.cmake b/openmp/runtime/cmake/LibompHandleFlags.cmake | ||||
| index 9e19e59ba17d..f92fa12d851a 100644 | ||||
| --- a/openmp/runtime/cmake/LibompHandleFlags.cmake | ||||
| +++ b/openmp/runtime/cmake/LibompHandleFlags.cmake | ||||
| @@ -144,7 +144,8 @@ function(libomp_get_libflags libflags) | ||||
|    endif() | ||||
|    set(libflags_local ${libflags_local} ${LIBOMP_LIBFLAGS}) | ||||
|    libomp_setup_flags(libflags_local) | ||||
| -  set(${libflags} ${libflags_local} PARENT_SCOPE) | ||||
| +  libomp_string_to_list("${libflags_local}" libflags_local_list) | ||||
| +  set(${libflags} ${libflags_local_list} PARENT_SCOPE) | ||||
|  endfunction() | ||||
|  | ||||
|  # Fortran flags | ||||
| @@ -1,31 +0,0 @@ | ||||
| diff --git a/lldb/include/lldb/Host/Config.h.cmake b/lldb/include/lldb/Host/Config.h.cmake | ||||
| --- a/lldb/include/lldb/Host/Config.h.cmake | ||||
| +++ b/lldb/include/lldb/Host/Config.h.cmake | ||||
| @@ -38,6 +38,8 @@ | ||||
|   | ||||
|  #cmakedefine01 LLDB_ENABLE_CURSES | ||||
|   | ||||
| +#cmakedefine01 CURSES_HAVE_NCURSES_CURSES_H | ||||
| + | ||||
|  #cmakedefine01 LLDB_ENABLE_LIBEDIT | ||||
|   | ||||
|  #cmakedefine01 LLDB_ENABLE_LIBXML2 | ||||
| diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp | ||||
| --- a/lldb/source/Core/IOHandlerCursesGUI.cpp | ||||
| +++ b/lldb/source/Core/IOHandlerCursesGUI.cpp | ||||
| @@ -10,9 +10,14 @@ | ||||
|  #include "lldb/Host/Config.h" | ||||
|   | ||||
|  #if LLDB_ENABLE_CURSES | ||||
| +#if CURSES_HAVE_NCURSES_CURSES_H | ||||
| +#include <ncurses/curses.h> | ||||
| +#include <ncurses/panel.h> | ||||
| +#else | ||||
|  #include <curses.h> | ||||
|  #include <panel.h> | ||||
|  #endif | ||||
| +#endif | ||||
|   | ||||
|  #if defined(__APPLE__) | ||||
|  #include <deque> | ||||
|  | ||||
| @@ -1,9 +0,0 @@ | ||||
| --- 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" | ||||
| @@ -1,13 +0,0 @@ | ||||
| --- a/openmp/libompd/src/CMakeLists.txt | ||||
| +++ b/openmp/libompd/src/CMakeLists.txt | ||||
| @@ -44,6 +44,10 @@ | ||||
|          ${LIBOMP_SRC_DIR} | ||||
|  ) | ||||
|  | ||||
| +if(${LIBOMP_USE_HWLOC}) | ||||
| +  include_directories(${LIBOMP_HWLOC_INSTALL_DIR}/include) | ||||
| +endif() | ||||
| + | ||||
|  INSTALL( TARGETS ompd | ||||
|          LIBRARY DESTINATION ${OPENMP_INSTALL_LIBDIR} | ||||
|          ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR} | ||||
| @@ -1,33 +0,0 @@ | ||||
| # 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; | ||||
| @@ -1,25 +0,0 @@ | ||||
| # <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); | ||||
| @@ -1,37 +0,0 @@ | ||||
| From ecdefed7f6ba11421fe1ecc6c13a135ab7bcda73 Mon Sep 17 00:00:00 2001 | ||||
| From: Pavel Labath <labath@google.com> | ||||
| Date: Mon, 23 Jul 2018 11:37:36 +0100 | ||||
| Subject: [PATCH] Fix PythonString::GetString for >=python-3.7 | ||||
|  | ||||
| The return value of PyUnicode_AsUTF8AndSize is now "const char *". | ||||
| --- | ||||
|  .../Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp  | 6 ++++-- | ||||
|  1 file changed, 4 insertions(+), 2 deletions(-) | ||||
|  | ||||
| diff --git a/tools/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/tools/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp | ||||
| index 6a9d57d5a..94f16b2c7 100644 | ||||
| --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp | ||||
| +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp | ||||
| @@ -404,14 +404,16 @@ llvm::StringRef PythonString::GetString() const { | ||||
|      return llvm::StringRef(); | ||||
|   | ||||
|    Py_ssize_t size; | ||||
| -  char *c; | ||||
| +  const char *data; | ||||
|   | ||||
|  #if PY_MAJOR_VERSION >= 3 | ||||
| -  c = PyUnicode_AsUTF8AndSize(m_py_obj, &size); | ||||
| +  data = PyUnicode_AsUTF8AndSize(m_py_obj, &size); | ||||
|  #else | ||||
| +  char *c; | ||||
|    PyString_AsStringAndSize(m_py_obj, &c, &size); | ||||
| +  data = c; | ||||
|  #endif | ||||
| -  return llvm::StringRef(c, size); | ||||
| +  return llvm::StringRef(data, size); | ||||
|  } | ||||
|   | ||||
|  size_t PythonString::GetSize() const { | ||||
| --  | ||||
| 2.18.0.233.g985f88cf7e-goog | ||||
|  | ||||
| @@ -1,14 +0,0 @@ | ||||
| diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake | ||||
| index dab55707338..6f4c6791141 100644 | ||||
| --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake | ||||
| +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake | ||||
| @@ -612,6 +612,9 @@ macro(add_custom_libcxx name prefix) | ||||
|      CMAKE_OBJDUMP | ||||
|      CMAKE_STRIP | ||||
|      CMAKE_SYSROOT | ||||
| +    PYTHON_EXECUTABLE | ||||
| +    Python3_EXECUTABLE | ||||
| +    Python2_EXECUTABLE | ||||
|      CMAKE_SYSTEM_NAME) | ||||
|    foreach(variable ${PASSTHROUGH_VARIABLES}) | ||||
|      get_property(is_value_set CACHE ${variable} PROPERTY VALUE SET) | ||||
| @@ -1,23 +0,0 @@ | ||||
| # 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" | ||||
|   | ||||
| @@ -1,81 +0,0 @@ | ||||
| diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc | ||||
| --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc | ||||
| +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc | ||||
| @@ -370,15 +370,6 @@ | ||||
|   | ||||
|  #if SANITIZER_GLIBC | ||||
|    // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE | ||||
| -  _(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); | ||||
|    _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz); | ||||
|    _(EQL_ENSLAVE, WRITE, struct_ifreq_sz); | ||||
|    _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz); | ||||
| diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h | ||||
| --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h | ||||
| +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h | ||||
| @@ -983,7 +983,6 @@ | ||||
|   | ||||
|  #if SANITIZER_LINUX && !SANITIZER_ANDROID | ||||
|  extern unsigned struct_ax25_parms_struct_sz; | ||||
| -extern unsigned struct_cyclades_monitor_sz; | ||||
|  extern unsigned struct_input_keymap_entry_sz; | ||||
|  extern unsigned struct_ipx_config_data_sz; | ||||
|  extern unsigned struct_kbdiacrs_sz; | ||||
| @@ -1328,15 +1327,6 @@ | ||||
|  #endif  // SANITIZER_LINUX | ||||
|   | ||||
|  #if SANITIZER_LINUX && !SANITIZER_ANDROID | ||||
| -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; | ||||
|  extern unsigned IOCTL_EQL_EMANCIPATE; | ||||
|  extern unsigned IOCTL_EQL_ENSLAVE; | ||||
|  extern unsigned IOCTL_EQL_GETMASTRCFG; | ||||
| diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp | ||||
| --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp | ||||
| +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp | ||||
| @@ -143,7 +143,6 @@ | ||||
|  # include <sys/procfs.h> | ||||
|  #endif | ||||
|  #include <sys/user.h> | ||||
| -#include <linux/cyclades.h> | ||||
|  #include <linux/if_eql.h> | ||||
|  #include <linux/if_plip.h> | ||||
|  #include <linux/lp.h> | ||||
| @@ -460,7 +459,6 @@ | ||||
|   | ||||
|  #if SANITIZER_GLIBC | ||||
|    unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); | ||||
| -  unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); | ||||
|  #if EV_VERSION > (0x010000) | ||||
|    unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry); | ||||
|  #else | ||||
| @@ -824,15 +822,6 @@ | ||||
|  #endif // SANITIZER_LINUX | ||||
|   | ||||
|  #if SANITIZER_LINUX && !SANITIZER_ANDROID | ||||
| -  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; | ||||
|    unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE; | ||||
|    unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE; | ||||
|    unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG; | ||||
| @@ -1,3 +1,8 @@ | ||||
| # This is a backport of https://reviews.llvm.org/D102059. | ||||
| # | ||||
| # We need the patch to be applicable when="@:9" and, therefore, cannot fetch | ||||
| # it from the upstream repo. | ||||
|  | ||||
| --- 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 @@ | ||||
|   | ||||
| @@ -26,7 +26,7 @@ class Llvm(CMakePackage, CudaPackage): | ||||
|     url = "https://github.com/llvm/llvm-project/archive/llvmorg-7.1.0.tar.gz" | ||||
|     list_url = "https://releases.llvm.org/download.html" | ||||
|     git = "https://github.com/llvm/llvm-project" | ||||
|     maintainers("trws", "haampie") | ||||
|     maintainers("trws", "haampie", "skosukhin") | ||||
| 
 | ||||
|     tags = ["e4s"] | ||||
| 
 | ||||
| @@ -82,44 +82,72 @@ class Llvm(CMakePackage, CudaPackage): | ||||
|     variant( | ||||
|         "clang", default=True, description="Build the LLVM C/C++/Objective-C compiler frontend" | ||||
|     ) | ||||
| 
 | ||||
|     variant( | ||||
|         "flang", | ||||
|         default=False, | ||||
|         when="@11: +clang", | ||||
|         description="Build the LLVM Fortran compiler frontend " | ||||
|         "(experimental - parser only, needs GCC)", | ||||
|     ) | ||||
|     variant("lldb", default=True, when="+clang", description="Build the LLVM debugger") | ||||
|     conflicts("+flang", when="@:10") | ||||
|     conflicts("+flang", when="~clang") | ||||
| 
 | ||||
|     variant("lldb", default=True, description="Build the LLVM debugger") | ||||
|     conflicts("+lldb", when="~clang") | ||||
| 
 | ||||
|     variant("lld", default=True, description="Build the LLVM linker") | ||||
|     variant("mlir", default=False, when="@10:", description="Build with MLIR support") | ||||
|     variant( | ||||
|         "internal_unwind", default=True, when="+clang", description="Build the libcxxabi libunwind" | ||||
|         "libunwind", | ||||
|         values=( | ||||
|             "none", | ||||
|             conditional("project", when="@:15"), | ||||
|             conditional("runtime", when="+clang @6:"), | ||||
|         ), | ||||
|         default="runtime", | ||||
|         description="Build the LLVM unwinder library" | ||||
|         "either as a runtime (with just-build Clang) " | ||||
|         "or as a project (with the compiler in use)", | ||||
|     ) | ||||
|     variant( | ||||
|         "polly", | ||||
|         default=True, | ||||
|         description="Build the LLVM polyhedral optimization plugin, " "only builds for 3.7.0+", | ||||
|         description="Build the LLVM polyhedral optimization plugin, only builds for 3.7.0+", | ||||
|     ) | ||||
|     variant( | ||||
|         "libcxx", default=True, when="+clang", description="Build the LLVM C++ standard library" | ||||
|         "libcxx", | ||||
|         values=( | ||||
|             "none", | ||||
|             conditional("project", when="@:15"), | ||||
|             conditional("runtime", when="+clang @6:"), | ||||
|         ), | ||||
|         default="runtime", | ||||
|         description="Build the LLVM C++ standard library " | ||||
|         "either as a runtime (with just-build Clang) " | ||||
|         "or as a project (with the compiler in use)", | ||||
|     ) | ||||
| 
 | ||||
|     variant("libomptarget", default=True, description="Build the OpenMP offloading library") | ||||
|     conflicts("+libomptarget", when="~clang") | ||||
| 
 | ||||
|     variant( | ||||
|         "libomptarget", | ||||
|         default=True, | ||||
|         when="+clang", | ||||
|         description="Build the OpenMP offloading library", | ||||
|     ) | ||||
|     variant( | ||||
|         "omp_debug", | ||||
|         "libomptarget_debug", | ||||
|         default=False, | ||||
|         when="+libomptarget", | ||||
|         description="Include debugging code in OpenMP runtime libraries", | ||||
|         description="Allow debug output with the environment variable LIBOMPTARGET_DEBUG=1", | ||||
|     ) | ||||
|     conflicts("+libomptarget_debug", when="~libomptarget") | ||||
| 
 | ||||
|     variant( | ||||
|         "compiler-rt", | ||||
|         when="+clang", | ||||
|         default=True, | ||||
|         description="Build LLVM compiler runtime, including sanitizers", | ||||
|         values=( | ||||
|             "none", | ||||
|             conditional("project", when="+clang"), | ||||
|             conditional("runtime", when="+clang @6:"), | ||||
|         ), | ||||
|         default="runtime", | ||||
|         description="Build the LLVM compiler runtime, including sanitizers, " | ||||
|         "either as a runtime (with just-build Clang) " | ||||
|         "or as a project (with the compiler in use)", | ||||
|     ) | ||||
|     variant( | ||||
|         "gold", | ||||
| @@ -170,16 +198,19 @@ class Llvm(CMakePackage, CudaPackage): | ||||
|         multi=True, | ||||
|     ) | ||||
|     variant( | ||||
|         "omp_tsan", | ||||
|         "libomp_tsan", | ||||
|         default=False, | ||||
|         when="@6:", | ||||
|         # Added in https://reviews.llvm.org/D13072 | ||||
|         # Removed in https://reviews.llvm.org/D103767 | ||||
|         when="@4:12", | ||||
|         description="Build with OpenMP capable thread sanitizer", | ||||
|     ) | ||||
|     variant( | ||||
|         "omp_as_runtime", | ||||
|         default=True, | ||||
|         when="+clang @12:", | ||||
|         description="Build OpenMP runtime via ENABLE_RUNTIME by just-built Clang", | ||||
|         "openmp", | ||||
|         values=("project", conditional("runtime", when="+clang @12:")), | ||||
|         default="runtime", | ||||
|         description="Build OpenMP either as a runtime (with just-build Clang) " | ||||
|         "or as a project (with the compiler in use)", | ||||
|     ) | ||||
|     variant( | ||||
|         "code_signing", | ||||
| @@ -195,9 +226,10 @@ class Llvm(CMakePackage, CudaPackage): | ||||
|         description="Add shared library symbol version", | ||||
|         when="@13:", | ||||
|     ) | ||||
|     variant( | ||||
|         "z3", default=False, when="+clang @8:", description="Use Z3 for the clang static analyzer" | ||||
|     ) | ||||
|     variant("z3", default=False, description="Use Z3 for the clang static analyzer") | ||||
|     conflicts("+z3", when="@:7") | ||||
|     conflicts("+z3", when="~clang") | ||||
| 
 | ||||
|     variant( | ||||
|         "zstd", | ||||
|         default=False, | ||||
| @@ -224,6 +256,12 @@ class Llvm(CMakePackage, CudaPackage): | ||||
|     depends_on("cmake@3.4.3:", type="build") | ||||
|     depends_on("cmake@3.13.4:", type="build", when="@12:") | ||||
|     depends_on("cmake@3.20:", type="build", when="@16:") | ||||
|     with when("@:10"): | ||||
|         # Versions 10 and older cannot build runtimes with cmake@3.17: | ||||
|         # See https://reviews.llvm.org/D77284 | ||||
|         for runtime in ["libunwind", "libcxx", "compiler-rt"]: | ||||
|             depends_on("cmake@:3.16", type="build", when="{0}=runtime".format(runtime)) | ||||
|         del runtime | ||||
|     depends_on("python", when="~python", type="build") | ||||
|     depends_on("pkgconfig", type="build") | ||||
| 
 | ||||
| @@ -268,17 +306,41 @@ class Llvm(CMakePackage, CudaPackage): | ||||
|     # Internal compiler error on gcc 8.4 on aarch64 https://bugzilla.redhat.com/show_bug.cgi?id=1958295 | ||||
|     conflicts("%gcc@8.4:8.4.9", when="@12: target=aarch64:") | ||||
| 
 | ||||
|     # 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 | ||||
|     # GCC    11     - latest stable release per GCC release page | ||||
|     # Clang: 11, 12 - latest two stable releases per LLVM release page | ||||
|     # 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") | ||||
|     # libcxx=project imposes compiler conflicts | ||||
|     # see https://libcxx.llvm.org/#platform-and-compiler-support for the latest release | ||||
|     # and https://github.com/llvm/www-releases for older releases | ||||
|     with when("libcxx=project"): | ||||
|         for v, compiler_conflicts in { | ||||
|             "@7:": {"clang": "@:3.4", "gcc": "@:4.6"}, | ||||
|             "@9:": {"clang": "@:3.4", "gcc": "@:4"}, | ||||
|             "@11:": {"clang": "@:3", "gcc": "@:4"}, | ||||
|             "@13:": {"clang": "@:10", "gcc": "@:10", "apple-clang": "@:11"}, | ||||
|             "@14:": { | ||||
|                 "clang": "@:11", | ||||
|                 "gcc": "@:10", | ||||
|                 "apple-clang": "@:11", | ||||
|                 "xlc": "@:17.0", | ||||
|                 "xlc_r": "@:17.0", | ||||
|             }, | ||||
|             "@15:": { | ||||
|                 "clang": "@:12", | ||||
|                 "gcc": "@:11", | ||||
|                 "apple-clang": "@:12", | ||||
|                 "xlc": "@:17.0", | ||||
|                 "xlc_r": "@:17.0", | ||||
|             }, | ||||
|             "@16:": { | ||||
|                 "clang": "@:13", | ||||
|                 "gcc": "@:11", | ||||
|                 "apple-clang": "@:13", | ||||
|                 "xlc": "@:17.0", | ||||
|                 "xlc_r": "@:17.0", | ||||
|             }, | ||||
|         }.items(): | ||||
|             with when(v): | ||||
|                 for comp in spack.compilers.supported_compilers(): | ||||
|                     conflicts("%{0}{1}".format(comp, compiler_conflicts.get(comp, ""))) | ||||
|         del v, compiler_conflicts, comp | ||||
| 
 | ||||
|     # libomptarget | ||||
|     conflicts("+cuda", when="@15:")  # +cuda variant is obselete since LLVM 15 | ||||
| @@ -287,6 +349,7 @@ class Llvm(CMakePackage, CudaPackage): | ||||
|         when="+libomptarget", | ||||
|         msg="Non-host backends needed for offloading, set targets=all", | ||||
|     ) | ||||
|     # See https://github.com/spack/spack/pull/32476#issuecomment-1573770361 | ||||
|     conflicts("~lld", when="+libomptarget") | ||||
| 
 | ||||
|     # cuda_arch value must be specified | ||||
| @@ -297,82 +360,160 @@ class Llvm(CMakePackage, CudaPackage): | ||||
|     # Fixed in upstream versions of both | ||||
|     conflicts("^cmake@3.19.0", when="@6:11.0.0") | ||||
| 
 | ||||
|     # 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.0.0+compiler-rt") | ||||
| 
 | ||||
|     # Fix lld templates: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230463 | ||||
|     patch("llvm5-lld-ELF-Symbols.patch", when="@5+lld%clang@7:") | ||||
|     patch( | ||||
|         "https://raw.githubusercontent.com/freebsd/freebsd-ports/f8f9333d8e1e5a7a6b28c5ef0ca73785db06136e/devel/llvm50/files/lld/patch-tools_lld_ELF_Symbols.cpp", | ||||
|         sha256="c81a50c1b6b78d359c0ce3b88914477f4f2a85b8dbfa7ac745b9e7eb4e53931b", | ||||
|         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: MicrosoftDemangle for %gcc@10: and %clang@13: | ||||
|     patch("missing-includes.patch", when="@8") | ||||
| 
 | ||||
|     # Backport from llvm upstream gcc ppc const expr long double issue | ||||
|     # see https://bugs.llvm.org/show_bug.cgi?id=39696 | ||||
|     # This fix was initially commited (3bf63cf3b366) for the 9.0 release | ||||
|     # but was then broken (0583d9ea8d5e) prior to the 9.0 release and | ||||
|     # eventually unbroken (d9a42ec98adc) for the 11.0 release.  The first | ||||
|     # patch backports the original correct fix to previous releases.  The | ||||
|     # second patch backports the un-breaking of the original fix. | ||||
|     patch("constexpr_longdouble.patch", when="@6:8+libcxx") | ||||
|     patch("constexpr_longdouble_9.0.patch", when="@9:10+libcxx") | ||||
| 
 | ||||
|     # Backport from llvm master; see | ||||
|     # https://bugs.llvm.org/show_bug.cgi?id=38233 | ||||
|     # for a bug report about this problem in llvm master. | ||||
|     patch("llvm_py37.patch", when="@4:6 ^python@3.7:") | ||||
| 
 | ||||
|     # https://github.com/spack/spack/issues/19625, | ||||
|     # merged in llvm-11.0.0_rc2, first available in 12.0.0 | ||||
|     patch("lldb_external_ncurses-10.patch", when="@10.0.0:11+lldb") | ||||
| 
 | ||||
|     # https://github.com/spack/spack/issues/19908 | ||||
|     # merged in llvm main prior to 12.0.0 | ||||
|     patch("llvm_python_path.patch", when="@:11") | ||||
| 
 | ||||
|     # Workaround for issue https://github.com/spack/spack/issues/18197 | ||||
|     patch("llvm7_intel.patch", when="@7 %intel@18.0.2,19.0.0:19.1.99") | ||||
| 
 | ||||
|     # Remove cyclades support to build against newer kernel headers | ||||
|     # https://reviews.llvm.org/D102059 | ||||
|     patch("no_cyclades.patch", when="@10:12.0.0") | ||||
|     patch("no_cyclades9.patch", when="@6:9") | ||||
| 
 | ||||
|     patch("llvm-gcc11.patch", when="@9:11%gcc@11:") | ||||
| 
 | ||||
|     # add -lpthread to build OpenMP libraries with Fujitsu compiler | ||||
|     patch("llvm12-thread.patch", when="@12 %fj") | ||||
| 
 | ||||
|     # add -lpthread to build OpenMP libraries | ||||
|     patch("llvm13-14-thread.patch", when="@13:14") | ||||
|     patch("llvm15-thread.patch", when="@15") | ||||
| 
 | ||||
|     # avoid build failed with Fujitsu compiler | ||||
|     patch("llvm13-fujitsu.patch", when="@13 %fj") | ||||
| 
 | ||||
|     # patch for missing hwloc.h include for libompd | ||||
|     patch("llvm14-hwloc-ompd.patch", when="@14") | ||||
| 
 | ||||
|     # make libflags a list in openmp subproject when ~omp_as_runtime | ||||
|     patch("libomp-libflags-as-list.patch", when="@3.7:14") | ||||
| 
 | ||||
|     # Add missing include leading to build fail with clang | ||||
|     # Add missing include directives for the standard headers (the real need for the following | ||||
|     # patches depends on the implementation of the standard C++ library, the headers, however, must | ||||
|     # be included according to the standard, therefore, we apply the patches regardless of the | ||||
|     # compiler and compiler version). | ||||
|     # | ||||
|     # fix missing ::size_t in 'llvm@4:5' | ||||
|     # see comments in the patch file | ||||
|     patch( | ||||
|         "xray_buffer_queue-cstddef.patch", | ||||
|         # we do not cover compiler-rt=runtime because it is not supported when @:5 | ||||
|         when="@4:5 compiler-rt=project", | ||||
|     ) | ||||
|     # | ||||
|     # see https://reviews.llvm.org/D64937 | ||||
|     # see https://github.com/spack/spack/issues/24270 | ||||
|     patch( | ||||
|         "https://github.com/llvm/llvm-project/commit/b288d90b39f4b905c02092a9bfcfd6d78f99b191.patch?full_index=1", | ||||
|         sha256="2028d52e1a39326bb48fb7463132bbfe7fb4fa18f1adfeea9c3ed0320ed49564", | ||||
|         when="@8:9.0.0", | ||||
|     ) | ||||
|     # | ||||
|     # committed upstream without a review | ||||
|     # see https://github.com/llvm/llvm-project/commit/b498303066a63a203d24f739b2d2e0e56dca70d1 | ||||
|     # see https://github.com/spack/spack/pull/28547 | ||||
|     patch( | ||||
|         "https://github.com/llvm/llvm-project/commit/b498303066a63a203d24f739b2d2e0e56dca70d1.patch?full_index=1", | ||||
|         sha256="514926d661635de47972c7d403c9c4669235aa51e22e56d44676d2a2709179b6", | ||||
|         when="@8:11", | ||||
|     ) | ||||
| 
 | ||||
|     # fix building of older versions of llvm with newer versions of glibc | ||||
|     for compiler_rt_as in ["project", "runtime"]: | ||||
|         with when("compiler-rt={0}".format(compiler_rt_as)): | ||||
|             # sys/ustat.h has been removed in favour of statfs from glibc-2.28 | ||||
|             # see https://reviews.llvm.org/D47281 | ||||
|             patch( | ||||
|                 "https://github.com/llvm/llvm-project/commit/383fe5c8668f63ef21c646b43f48da9fa41aa100.patch?full_index=1", | ||||
|                 sha256="66f01ac1769a6815aba09d6f4347ac1744f77f82ec9578a1158b24daca7a89e6", | ||||
|                 when="@4:6.0.0", | ||||
|             ) | ||||
|             # fix sanitizer-common build with glibc 2.31 | ||||
|             # see https://reviews.llvm.org/D70662 | ||||
|             patch("sanitizer-ipc_perm_mode.patch", when="@5:9") | ||||
|     del compiler_rt_as | ||||
| 
 | ||||
|     # Backport from llvm upstream gcc ppc const expr long double issue | ||||
|     # see https://bugs.llvm.org/show_bug.cgi?id=39696 | ||||
|     # This fix was initially committed (3bf63cf3b366) for the 9.0 release | ||||
|     # but was then broken (0583d9ea8d5e) prior to the 9.0 release and | ||||
|     # eventually unbroken (d9a42ec98adc) for the 11.0 release.  The first | ||||
|     # patch backports the original correct fix to previous releases.  The | ||||
|     # second patch backports the un-breaking of the original fix. | ||||
|     for libcxx_as in ["project", "runtime"]: | ||||
|         with when("libcxx={0}".format(libcxx_as)): | ||||
|             patch( | ||||
|                 "https://github.com/llvm/llvm-project/commit/3bf63cf3b366d3a57cf5cbad4112a6abf6c0c3b1.patch?full_index=1", | ||||
|                 sha256="e56489a4bcf3c3636e206adca366bfcda2722ad81a5fa9a0360faed63933191a", | ||||
|                 when="@6:8", | ||||
|             ) | ||||
|             patch( | ||||
|                 "https://github.com/llvm/llvm-project/commit/d9a42ec98adcb1ebc0c3837715df4e5a50c7ccc0.patch?full_index=1", | ||||
|                 sha256="50bfc4e82c02bb5b7739990f363d99b1e43d5d11a5104f6aabbc303ebce6fbe3", | ||||
|                 when="@9:10", | ||||
|             ) | ||||
|     del libcxx_as | ||||
| 
 | ||||
|     # Backport from llvm to fix issues related to Python 3.7 | ||||
|     # see https://bugs.llvm.org/show_bug.cgi?id=38233 | ||||
|     patch( | ||||
|         "https://github.com/llvm/llvm-project/commit/5457b426f5e15a29c0acc8af1a476132f8be2a36.patch?full_index=1", | ||||
|         sha256="7a1e4aa80760167807255c3e3121b1281bfcf532396b2d8fb3dce021f3f18758", | ||||
|         when="@4:6+python+lldb ^python@3.7:", | ||||
|     ) | ||||
| 
 | ||||
|     # fix building on SUSE (with panel.h being in /usr/include/ncurses/) | ||||
|     # see https://reviews.llvm.org/D85219 | ||||
|     # see https://github.com/spack/spack/issues/19625 | ||||
|     patch( | ||||
|         "https://github.com/llvm/llvm-project/commit/c952ec15d38843b69e22dfd7b0665304a0459f9f.patch?full_index=1", | ||||
|         sha256="66932ba31b5bf8808ea112e42cfd79b2480a4936e711771c06ce851eac429b2c", | ||||
|         when="@10:11+lldb", | ||||
|     ) | ||||
| 
 | ||||
|     # honor Python2_EXECUTABLE and Python3_EXECUTABLE when they are passed to cmake | ||||
|     # see https://reviews.llvm.org/D91536 | ||||
|     patch( | ||||
|         "https://github.com/llvm/llvm-project/commit/16de50895e96adbe261a5ce2498366bda7b3fccd.patch?full_index=1", | ||||
|         sha256="0e121ed460aa6e117f9f5f339d597a96c0fe4f97dc2209aba47b43ffc831ea24", | ||||
|         # The patch is applicable only starting version 7.0.0 (the older version might require a | ||||
|         # different patch addressing https://github.com/spack/spack/issues/19908). It looks like | ||||
|         # the patched function is used only if both compiler-rt and libcxx are enabled but we keep | ||||
|         # it simple: | ||||
|         when="@7:11", | ||||
|     ) | ||||
| 
 | ||||
|     # Workaround for issue https://github.com/spack/spack/issues/18197 | ||||
|     patch("llvm7_intel.patch", when="@7 %intel@18.0.2,19.0.0:19.1.99") | ||||
| 
 | ||||
|     # Remove cyclades support to build against newer kernel headers | ||||
|     # https://reviews.llvm.org/D102059 | ||||
|     patch( | ||||
|         "https://github.com/llvm/llvm-project/commit/68d5235cb58f988c71b403334cd9482d663841ab.patch?full_index=1", | ||||
|         sha256="742501723642675075e617f3c38339961b2c7b6fd8290dbffc52239ab0783317", | ||||
|         when="@10:12.0.0", | ||||
|     ) | ||||
|     # The patch above is not applicable when "@:9" due to the file renaming and reformatting. The | ||||
|     # following patch is applicable starting at least version 5.0.0, the oldest we try to support. | ||||
|     patch("no_cyclades9.patch", when="@5:9") | ||||
| 
 | ||||
|     with when("+libomptarget"): | ||||
|         # libomptarget makes use of multithreading via the standard C++ library (e.g. | ||||
|         # std::call_once), which, depending on the platform and the implementation of the standard | ||||
|         # library, might or might not require linking to libpthread (note that the failure might | ||||
|         # happen at the linking time as well as at the runtime). In some cases, the required linker | ||||
|         # flag comes as a transitive dependency (e.g. from the static LLVMSupport component). The | ||||
|         # following patches enforce linking to the thread library that is relevant for the system, | ||||
|         # which might lead to overlinking in some cases though. | ||||
|         # TODO: figure out why we do not use LLVM_PTHREAD_LIB but run find_package(Threads), at | ||||
|         #  least for newer versions (the solution must work with both openmp=runtime and | ||||
|         #  openmp=project) | ||||
|         patch("llvm12-thread.patch", when="@12") | ||||
|         patch("llvm13-14-thread.patch", when="@13:14") | ||||
|         patch("llvm15-thread.patch", when="@15") | ||||
| 
 | ||||
|     # avoid build failed with Fujitsu compiler | ||||
|     patch("llvm13-fujitsu.patch", when="@13 %fj") | ||||
| 
 | ||||
|     # patch for missing hwloc.h include for libompd | ||||
|     # see https://reviews.llvm.org/D123888 | ||||
|     patch( | ||||
|         "https://github.com/llvm/llvm-project/commit/91ccd8248c85385a5654c63c302a37d97f811bab.patch?full_index=1", | ||||
|         sha256="b216cff38659c176c5381e9dda3252edbb204e6f6f1f33e843a9ebcc42732e5d", | ||||
|         when="@14 openmp=runtime", | ||||
|     ) | ||||
| 
 | ||||
|     # make libflags a list in openmp subproject when openmp=project | ||||
|     # see https://reviews.llvm.org/D125370 | ||||
|     patch( | ||||
|         "https://github.com/llvm/llvm-project/commit/e27ce281399dca8b08b6ca593172a1bd5dbdd5c1.patch?full_index=1", | ||||
|         sha256="6f0cfa55e3ed17ee33346b0a5bca8092adcc1dc75ca712ab83901755fba9767e", | ||||
|         when="@3.7:14 openmp=project", | ||||
|     ) | ||||
| 
 | ||||
|     # fix detection of LLDB_PYTHON_EXE_RELATIVE_PATH | ||||
|     # see https://reviews.llvm.org/D133513 | ||||
|     # TODO: adjust version constraint and switch to fetching from the upstream GitHub repo | ||||
|     #  when/if the bugfix is merged | ||||
|     # TODO: the patch is not applicable after https://reviews.llvm.org/D141042 but it is not clear | ||||
|     #  yet whether we need a version of it for when="@16:" | ||||
|     patch("D133513.diff", level=0, when="@14:15+lldb+python") | ||||
| 
 | ||||
|     # Fix hwloc@:2.3 (Conditionally disable hwloc@2.0 and hwloc@2.4 code) | ||||
| @@ -382,6 +523,14 @@ class Llvm(CMakePackage, CudaPackage): | ||||
|         when="@14:15", | ||||
|     ) | ||||
| 
 | ||||
|     # Fix false positive detection of a target when building compiler-rt as a runtime | ||||
|     # https://reviews.llvm.org/D127975 | ||||
|     patch( | ||||
|         "https://github.com/llvm/llvm-project/commit/9f1d90bf91570efa124c4a86cd033de374d1049a.patch?full_index=1", | ||||
|         sha256="1f4287465b3e499911e039e6cc2f395b8cb00eb8a0a223fa0db3704ba77f9969", | ||||
|         when="@13:14 compiler-rt=runtime", | ||||
|     ) | ||||
| 
 | ||||
|     # The functions and attributes below implement external package | ||||
|     # detection for LLVM. See: | ||||
|     # | ||||
| @@ -618,7 +767,7 @@ def cmake_args(self): | ||||
|                     ), | ||||
|                 ] | ||||
|             ) | ||||
|             if "+omp_as_runtime" in spec: | ||||
|             if "openmp=runtime" in spec: | ||||
|                 cmake_args.extend( | ||||
|                     [ | ||||
|                         define("LIBOMPTARGET_NVPTX_ENABLE_BCLIB", True), | ||||
| @@ -637,7 +786,7 @@ def cmake_args(self): | ||||
|                 ] | ||||
|             ) | ||||
| 
 | ||||
|         cmake_args.append(from_variant("LIBOMPTARGET_ENABLE_DEBUG", "omp_debug")) | ||||
|         cmake_args.append(from_variant("LIBOMPTARGET_ENABLE_DEBUG", "libomptarget_debug")) | ||||
| 
 | ||||
|         if "+lldb" in spec: | ||||
|             projects.append("lldb") | ||||
| @@ -663,9 +812,9 @@ def cmake_args(self): | ||||
|         if "+clang" in spec: | ||||
|             projects.append("clang") | ||||
|             projects.append("clang-tools-extra") | ||||
|             if "+omp_as_runtime" in spec: | ||||
|             if "openmp=runtime" in spec: | ||||
|                 runtimes.append("openmp") | ||||
|             else: | ||||
|             elif "openmp=project" in spec: | ||||
|                 projects.append("openmp") | ||||
| 
 | ||||
|             if "+libomptarget" in spec: | ||||
| @@ -682,23 +831,20 @@ def cmake_args(self): | ||||
|             projects.append("flang") | ||||
|         if "+lld" in spec: | ||||
|             projects.append("lld") | ||||
|         if "+compiler-rt" in spec: | ||||
|             if self.spec.satisfies("@15.0.0:"): | ||||
|                 runtimes.append("compiler-rt") | ||||
|             else: | ||||
|                 projects.append("compiler-rt") | ||||
|         if "+libcxx" in spec: | ||||
|             if self.spec.satisfies("@15.0.0:"): | ||||
|                 runtimes.extend(["libcxx", "libcxxabi"]) | ||||
|             else: | ||||
|                 projects.extend(["libcxx", "libcxxabi"]) | ||||
|         if "compiler-rt=runtime" in spec: | ||||
|             runtimes.append("compiler-rt") | ||||
|         elif "compiler-rt=project" in spec: | ||||
|             projects.append("compiler-rt") | ||||
|         if "libcxx=runtime" in spec: | ||||
|             runtimes.extend(["libcxx", "libcxxabi"]) | ||||
|         elif "libcxx=project" in spec: | ||||
|             projects.extend(["libcxx", "libcxxabi"]) | ||||
|         if "+mlir" in spec: | ||||
|             projects.append("mlir") | ||||
|         if "+internal_unwind" in spec: | ||||
|             if self.spec.satisfies("@15.0.0:"): | ||||
|                 runtimes.append("libunwind") | ||||
|             else: | ||||
|                 projects.append("libunwind") | ||||
|         if "libunwind=runtime" in spec: | ||||
|             runtimes.append("libunwind") | ||||
|         elif "libunwind=project" in spec: | ||||
|             projects.append("libunwind") | ||||
|         if "+polly" in spec: | ||||
|             projects.append("polly") | ||||
|             cmake_args.append(define("LINK_POLLY_INTO_TOOLS", True)) | ||||
| @@ -718,7 +864,7 @@ def cmake_args(self): | ||||
| 
 | ||||
|         cmake_args.append(define("LLVM_TARGETS_TO_BUILD", get_llvm_targets_to_build(spec))) | ||||
| 
 | ||||
|         cmake_args.append(from_variant("LIBOMP_TSAN_SUPPORT", "omp_tsan")) | ||||
|         cmake_args.append(from_variant("LIBOMP_TSAN_SUPPORT", "libomp_tsan")) | ||||
| 
 | ||||
|         if self.compiler.name == "gcc": | ||||
|             cmake_args.append(define("GCC_INSTALL_PREFIX", self.compiler.prefix)) | ||||
| @@ -746,7 +892,7 @@ def post_install(self): | ||||
|         define = self.define | ||||
| 
 | ||||
|         # unnecessary if we build openmp via LLVM_ENABLE_RUNTIMES | ||||
|         if "+cuda ~omp_as_runtime" in self.spec: | ||||
|         if "+cuda openmp=project" in self.spec: | ||||
|             ompdir = "build-bootstrapped-omp" | ||||
|             prefix_paths = spack.build_environment.get_cmake_prefix_path(self) | ||||
|             prefix_paths.append(str(spec.prefix)) | ||||
|   | ||||
| @@ -1,9 +1,53 @@ | ||||
| # ipc_perm.mode is not used and has changed from short to int over architecures | ||||
| # ipc_perm.mode is not used and has changed from short to int over architectures | ||||
| # 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 | ||||
| # https://reviews.llvm.org/D70662 | ||||
| # | ||||
| # We need the patch to be applicable when="@5:9" and, therefore, cannot | ||||
| # fetch it from the upstream repo. | ||||
|  | ||||
| --- 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); | ||||
| @@ -1126,8 +1126,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); | ||||
|  CHECK_SIZE_AND_OFFSET(ipc_perm, gid); | ||||
|  CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); | ||||
|  CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); | ||||
| -#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) | ||||
| -/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */ | ||||
| +#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) | ||||
| +/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit | ||||
| +   on many architectures.  */ | ||||
|  CHECK_SIZE_AND_OFFSET(ipc_perm, mode); | ||||
|  #endif | ||||
|   | ||||
| --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h | ||||
| +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h | ||||
| @@ -203,26 +203,13 @@ namespace __sanitizer { | ||||
|      u64 __unused1; | ||||
|      u64 __unused2; | ||||
|  #elif defined(__sparc__) | ||||
| -#if defined(__arch64__) | ||||
|      unsigned mode; | ||||
| -    unsigned short __pad1; | ||||
| -#else | ||||
| -    unsigned short __pad1; | ||||
| -    unsigned short mode; | ||||
|      unsigned short __pad2; | ||||
| -#endif | ||||
|      unsigned short __seq; | ||||
|      unsigned long long __unused1; | ||||
|      unsigned long long __unused2; | ||||
| -#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__) | ||||
| -    unsigned int mode; | ||||
| -    unsigned short __seq; | ||||
| -    unsigned short __pad1; | ||||
| -    unsigned long __unused1; | ||||
| -    unsigned long __unused2; | ||||
|  #else | ||||
| -    unsigned short mode; | ||||
| -    unsigned short __pad1; | ||||
| +    unsigned int mode; | ||||
|      unsigned short __seq; | ||||
|      unsigned short __pad2; | ||||
|  #if defined(__x86_64__) && !defined(_LP64) | ||||
|   | ||||
| @@ -1,4 +1,12 @@ | ||||
| # Fix missing std:size_t in 'llvm@4:5' for build with '%clang@7:' | ||||
| # The patched file uses size_t, a.k.a. ::size_t (not std::size_t), but does not | ||||
| # include <stddef.h> explicitly. Whether or not the header is included | ||||
| # implicitly via other headers, depends on the implementation of the standard | ||||
| # library. Therefore, we should not apply this patch depending on the compiler | ||||
| # version. Strictly speaking, <cstddef> is not guaranteed to provide ::size_t | ||||
| # (in contrast to std::size_t). However, it does that in most cases and that is | ||||
| # what the upstream developers seem to rely on starting LLVM 6.0.0 | ||||
| # (see https://reviews.llvm.org/D39175). | ||||
|  | ||||
| --- a/compiler-rt/lib/xray/xray_buffer_queue.h | ||||
| +++ b/compiler-rt/lib/xray/xray_buffer_queue.h | ||||
| @@ -18,0 +18,1 @@ | ||||
|   | ||||
| @@ -24,7 +24,7 @@ class Open3d(CMakePackage, CudaPackage): | ||||
|     depends_on("cmake@3.19:", type="build") | ||||
|     # https://github.com/isl-org/Open3D/issues/3762 | ||||
|     # https://github.com/isl-org/Open3D/issues/4570 | ||||
|     depends_on("llvm@7:+clang+libcxx") | ||||
|     depends_on("llvm@7:+clang") | ||||
|     depends_on("eigen") | ||||
|     depends_on("flann") | ||||
|     # https://github.com/isl-org/Open3D/issues/4360 | ||||
| @@ -54,6 +54,9 @@ class Open3d(CMakePackage, CudaPackage): | ||||
|     conflicts("%gcc@:4") | ||||
|     conflicts("%clang@:6") | ||||
| 
 | ||||
|     # LLVM must be built with the C++ library | ||||
|     conflicts("^llvm libcxx=none") | ||||
| 
 | ||||
|     def patch(self): | ||||
|         # Force Python libraries to be installed to self.prefix | ||||
|         filter_file( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sergey Kosukhin
					Sergey Kosukhin