From 1830b0f376fba6f2920b25bedb0f40b1e54db318 Mon Sep 17 00:00:00 2001 From: Daniel Martinez Date: Tue, 30 Jan 2024 10:43:36 -0500 Subject: [PATCH] New package: llvm18-18.1.8 --- common/shlibs | 8 +- srcpkgs/clang-analyzer18 | 1 + srcpkgs/clang-tools-extra18 | 1 + srcpkgs/clang18 | 1 + srcpkgs/clang18-devel | 1 + srcpkgs/clang18-headers | 1 + srcpkgs/compiler-rt | 2 +- srcpkgs/compiler-rt18 | 1 + srcpkgs/flang18 | 1 + srcpkgs/flang18-devel | 1 + srcpkgs/libclang-cpp18 | 1 + srcpkgs/libclang18 | 1 + srcpkgs/libcxx | 2 +- srcpkgs/libcxx-devel | 2 +- srcpkgs/libcxxabi | 2 +- srcpkgs/libcxxabi-devel | 2 +- srcpkgs/liblldb18 | 1 + srcpkgs/libllvm18 | 1 + srcpkgs/libomp18 | 1 + srcpkgs/libomp18-devel | 1 + srcpkgs/lld-devel18 | 1 + srcpkgs/lld18 | 1 + srcpkgs/lld18-devel | 1 + srcpkgs/lldb-devel18 | 1 + srcpkgs/lldb18 | 1 + srcpkgs/lldb18-devel | 1 + srcpkgs/llvm-bolt18 | 1 + srcpkgs/llvm-libunwind | 2 +- srcpkgs/llvm-libunwind-devel | 2 +- srcpkgs/llvm-libunwind-devel18 | 1 + srcpkgs/llvm-libunwind18 | 1 + srcpkgs/llvm18-cross-tools | 1 + srcpkgs/llvm18-devel | 1 + srcpkgs/llvm18-doc | 1 + .../llvm18/files/llvm-Config-llvm-config.h | 9 + srcpkgs/llvm18/patches/SmallVector.patch | 13 + ...s-set-a-larger-stack-size-explicitly.patch | 37 + ...clang-001-fix-unwind-chain-inclusion.patch | 44 + .../patches/clang-002-add-musl-triples.patch | 115 +++ .../clang-003-ppc64-dynamic-linker-path.patch | 13 + .../compiler-rt-sanitizer-ppc64-musl.patch | 37 + ...compiler-rt-sanitizer-supported-arch.patch | 22 + srcpkgs/llvm18/patches/libcxx-armv67.patch | 35 + srcpkgs/llvm18/patches/libcxx-musl.patch | 26 + .../llvm18/patches/libcxx-ssp-nonshared.patch | 11 + srcpkgs/llvm18/patches/libcxxabi-dl.patch | 25 + srcpkgs/llvm18/patches/libomp-soname.patch | 12 + srcpkgs/llvm18/patches/llvm-001-musl.patch | 32 + .../patches/llvm-004-override-opt.patch | 18 + .../llvm18/patches/llvm-005-ppc-bigpic.patch | 36 + .../patches/llvm-006-aarch64-mf_exec.patch | 24 + srcpkgs/llvm18/patches/openmp-stdint.patch | 12 + srcpkgs/llvm18/template | 781 ++++++++++++++++++ srcpkgs/llvm18/update | 3 + srcpkgs/mlir18 | 1 + srcpkgs/mlir18-devel | 1 + 56 files changed, 1345 insertions(+), 10 deletions(-) create mode 120000 srcpkgs/clang-analyzer18 create mode 120000 srcpkgs/clang-tools-extra18 create mode 120000 srcpkgs/clang18 create mode 120000 srcpkgs/clang18-devel create mode 120000 srcpkgs/clang18-headers create mode 120000 srcpkgs/compiler-rt18 create mode 120000 srcpkgs/flang18 create mode 120000 srcpkgs/flang18-devel create mode 120000 srcpkgs/libclang-cpp18 create mode 120000 srcpkgs/libclang18 create mode 120000 srcpkgs/liblldb18 create mode 120000 srcpkgs/libllvm18 create mode 120000 srcpkgs/libomp18 create mode 120000 srcpkgs/libomp18-devel create mode 120000 srcpkgs/lld-devel18 create mode 120000 srcpkgs/lld18 create mode 120000 srcpkgs/lld18-devel create mode 120000 srcpkgs/lldb-devel18 create mode 120000 srcpkgs/lldb18 create mode 120000 srcpkgs/lldb18-devel create mode 120000 srcpkgs/llvm-bolt18 create mode 120000 srcpkgs/llvm-libunwind-devel18 create mode 120000 srcpkgs/llvm-libunwind18 create mode 120000 srcpkgs/llvm18-cross-tools create mode 120000 srcpkgs/llvm18-devel create mode 120000 srcpkgs/llvm18-doc create mode 100644 srcpkgs/llvm18/files/llvm-Config-llvm-config.h create mode 100644 srcpkgs/llvm18/patches/SmallVector.patch create mode 100644 srcpkgs/llvm18/patches/always-set-a-larger-stack-size-explicitly.patch create mode 100644 srcpkgs/llvm18/patches/clang-001-fix-unwind-chain-inclusion.patch create mode 100644 srcpkgs/llvm18/patches/clang-002-add-musl-triples.patch create mode 100644 srcpkgs/llvm18/patches/clang-003-ppc64-dynamic-linker-path.patch create mode 100644 srcpkgs/llvm18/patches/compiler-rt-sanitizer-ppc64-musl.patch create mode 100644 srcpkgs/llvm18/patches/compiler-rt-sanitizer-supported-arch.patch create mode 100644 srcpkgs/llvm18/patches/libcxx-armv67.patch create mode 100644 srcpkgs/llvm18/patches/libcxx-musl.patch create mode 100644 srcpkgs/llvm18/patches/libcxx-ssp-nonshared.patch create mode 100644 srcpkgs/llvm18/patches/libcxxabi-dl.patch create mode 100644 srcpkgs/llvm18/patches/libomp-soname.patch create mode 100644 srcpkgs/llvm18/patches/llvm-001-musl.patch create mode 100644 srcpkgs/llvm18/patches/llvm-004-override-opt.patch create mode 100644 srcpkgs/llvm18/patches/llvm-005-ppc-bigpic.patch create mode 100644 srcpkgs/llvm18/patches/llvm-006-aarch64-mf_exec.patch create mode 100644 srcpkgs/llvm18/patches/openmp-stdint.patch create mode 100644 srcpkgs/llvm18/template create mode 100644 srcpkgs/llvm18/update create mode 120000 srcpkgs/mlir18 create mode 120000 srcpkgs/mlir18-devel diff --git a/common/shlibs b/common/shlibs index 7c683804f64..6f864b0d2b7 100644 --- a/common/shlibs +++ b/common/shlibs @@ -976,21 +976,23 @@ libuchardet.so.0 uchardet-0.0.6_1 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1 libyajl.so.2 yajl-2.0.1_1 libconfuse.so.2 confuse-3.2.1_1 -liblldb.so.17 lldb17-17.0.6_1 -liblldb.so.18 lldb18-18.1.0_1 +liblldb.so.18.1 liblldb18-18.1.8_1 liblldb.so.17 liblldb17-17.0.6_3 liblldb.so.15 lldb15-15.0.7_4 +libclang.so.18.1 libclang18-18.1.8_1 libclang.so.17 libclang17-17.0.6_1 libclang.so.15 libclang15-15.0.7_4 +libclang-cpp.so.18.1 libclang-cpp18-18.1.8_1 libclang-cpp.so.17 libclang-cpp17-17.0.6_1 libclang-cpp.so.15 libclang-cpp15-15.0.7_4 libLLVM-11.so libllvm11-11.0.0_1 libLLVM-12.so libllvm12-12.0.0_1 libLLVM-15.so libllvm15-15.0.7_4 libLLVM-17.so libllvm17-17.0.6_1 +libLLVM.so.18.1 libllvm18-18.1.8_1 libLLVMSPIRVLib.so.17 SPIRV-LLVM-Translator-17.0.0_1 libomp.so.5 libomp-17.0.6_1 -libomptarget.so.17 libomp-17.0.3_1 +libomptarget.so.18.1 libomp-18.1.8_1 libisofs.so.6 libisofs-0.6.24_1 libmpack.so.0 libmpack-1.0.5_1 libGeoIP.so.1 libgeoip-1.4.8_1 diff --git a/srcpkgs/clang-analyzer18 b/srcpkgs/clang-analyzer18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/clang-analyzer18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/clang-tools-extra18 b/srcpkgs/clang-tools-extra18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/clang-tools-extra18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/clang18 b/srcpkgs/clang18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/clang18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/clang18-devel b/srcpkgs/clang18-devel new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/clang18-devel @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/clang18-headers b/srcpkgs/clang18-headers new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/clang18-headers @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt index 96970d5c02c..1f418dc969a 120000 --- a/srcpkgs/compiler-rt +++ b/srcpkgs/compiler-rt @@ -1 +1 @@ -llvm17 \ No newline at end of file +llvm18 \ No newline at end of file diff --git a/srcpkgs/compiler-rt18 b/srcpkgs/compiler-rt18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/compiler-rt18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/flang18 b/srcpkgs/flang18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/flang18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/flang18-devel b/srcpkgs/flang18-devel new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/flang18-devel @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/libclang-cpp18 b/srcpkgs/libclang-cpp18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/libclang-cpp18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/libclang18 b/srcpkgs/libclang18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/libclang18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx index 96970d5c02c..1f418dc969a 120000 --- a/srcpkgs/libcxx +++ b/srcpkgs/libcxx @@ -1 +1 @@ -llvm17 \ No newline at end of file +llvm18 \ No newline at end of file diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel index 96970d5c02c..1f418dc969a 120000 --- a/srcpkgs/libcxx-devel +++ b/srcpkgs/libcxx-devel @@ -1 +1 @@ -llvm17 \ No newline at end of file +llvm18 \ No newline at end of file diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi index 96970d5c02c..1f418dc969a 120000 --- a/srcpkgs/libcxxabi +++ b/srcpkgs/libcxxabi @@ -1 +1 @@ -llvm17 \ No newline at end of file +llvm18 \ No newline at end of file diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel index 96970d5c02c..1f418dc969a 120000 --- a/srcpkgs/libcxxabi-devel +++ b/srcpkgs/libcxxabi-devel @@ -1 +1 @@ -llvm17 \ No newline at end of file +llvm18 \ No newline at end of file diff --git a/srcpkgs/liblldb18 b/srcpkgs/liblldb18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/liblldb18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/libllvm18 b/srcpkgs/libllvm18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/libllvm18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/libomp18 b/srcpkgs/libomp18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/libomp18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/libomp18-devel b/srcpkgs/libomp18-devel new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/libomp18-devel @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/lld-devel18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/lld18 b/srcpkgs/lld18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/lld18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/lld18-devel b/srcpkgs/lld18-devel new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/lld18-devel @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/lldb-devel18 b/srcpkgs/lldb-devel18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/lldb-devel18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/lldb18 b/srcpkgs/lldb18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/lldb18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/lldb18-devel b/srcpkgs/lldb18-devel new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/lldb18-devel @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/llvm-bolt18 b/srcpkgs/llvm-bolt18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/llvm-bolt18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind index 96970d5c02c..1f418dc969a 120000 --- a/srcpkgs/llvm-libunwind +++ b/srcpkgs/llvm-libunwind @@ -1 +1 @@ -llvm17 \ No newline at end of file +llvm18 \ No newline at end of file diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel index 96970d5c02c..1f418dc969a 120000 --- a/srcpkgs/llvm-libunwind-devel +++ b/srcpkgs/llvm-libunwind-devel @@ -1 +1 @@ -llvm17 \ No newline at end of file +llvm18 \ No newline at end of file diff --git a/srcpkgs/llvm-libunwind-devel18 b/srcpkgs/llvm-libunwind-devel18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/llvm-libunwind-devel18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/llvm-libunwind18 b/srcpkgs/llvm-libunwind18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/llvm-libunwind18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/llvm18-cross-tools b/srcpkgs/llvm18-cross-tools new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/llvm18-cross-tools @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/llvm18-devel b/srcpkgs/llvm18-devel new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/llvm18-devel @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/llvm18-doc b/srcpkgs/llvm18-doc new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/llvm18-doc @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/llvm18/files/llvm-Config-llvm-config.h b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h new file mode 100644 index 00000000000..2fa08c9be69 --- /dev/null +++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h @@ -0,0 +1,9 @@ +#include + +#if __WORDSIZE == 32 +#include "llvm-config-32.h" +#elif __WORDSIZE == 64 +#include "llvm-config-64.h" +#else +#error "Unknown word size" +#endif diff --git a/srcpkgs/llvm18/patches/SmallVector.patch b/srcpkgs/llvm18/patches/SmallVector.patch new file mode 100644 index 00000000000..ac10d306c43 --- /dev/null +++ b/srcpkgs/llvm18/patches/SmallVector.patch @@ -0,0 +1,13 @@ +diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h +index 2e6d2dc6ce90..be2cf6cc1fee 100644 +--- a/llvm/include/llvm/ADT/SmallVector.h ++++ b/llvm/include/llvm/ADT/SmallVector.h +@@ -1163,7 +1163,7 @@ template struct CalculateSmallVectorDefaultInlinedElements { + // happens on a 32-bit host and then fails due to sizeof(T) *increasing* on a + // 64-bit host, is expected to be very rare. + static_assert( +- sizeof(T) <= 256, ++ sizeof(T) <= 288, + "You are trying to use a default number of inlined elements for " + "`SmallVector` but `sizeof(T)` is really big! Please use an " + "explicit number of inlined elements with `SmallVector` to make " diff --git a/srcpkgs/llvm18/patches/always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm18/patches/always-set-a-larger-stack-size-explicitly.patch new file mode 100644 index 00000000000..cb17121dea2 --- /dev/null +++ b/srcpkgs/llvm18/patches/always-set-a-larger-stack-size-explicitly.patch @@ -0,0 +1,37 @@ +From 2354350bcc890c13016d67f4c060b32cb1cd693c Mon Sep 17 00:00:00 2001 +From: q66 +Date: Sat, 4 Nov 2023 08:44:01 +0100 +Subject: [PATCH 01/25] llvm: always set a larger stack size explicitly + +--- + llvm/lib/Support/Threading.cpp | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp +index 7cc7ba44c..b91b8f4bb 100644 +--- a/llvm/lib/Support/Threading.cpp ++++ b/llvm/lib/Support/Threading.cpp +@@ -77,21 +77,7 @@ unsigned llvm::ThreadPoolStrategy::compute_thread_count() const { + // keyword. + #include "llvm/Support/thread.h" + +-#if defined(__APPLE__) +- // Darwin's default stack size for threads except the main one is only 512KB, +- // which is not enough for some/many normal LLVM compilations. This implements +- // the same interface as std::thread but requests the same stack size as the +- // main thread (8MB) before creation. + const std::optional llvm::thread::DefaultStackSize = 8 * 1024 * 1024; +-#elif defined(_AIX) +- // On AIX, the default pthread stack size limit is ~192k for 64-bit programs. +- // This limit is easily reached when doing link-time thinLTO. AIX library +- // developers have used 4MB, so we'll do the same. +-const std::optional llvm::thread::DefaultStackSize = 4 * 1024 * 1024; +-#else +-const std::optional llvm::thread::DefaultStackSize; +-#endif +- + + #endif + +-- +2.42.0 diff --git a/srcpkgs/llvm18/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm18/patches/clang-001-fix-unwind-chain-inclusion.patch new file mode 100644 index 00000000000..e4eaa7783e7 --- /dev/null +++ b/srcpkgs/llvm18/patches/clang-001-fix-unwind-chain-inclusion.patch @@ -0,0 +1,44 @@ +From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Tue, 8 Sep 2015 22:14:57 +0200 +Subject: [PATCH 2/7] fix unwind chain inclusion + +--- + lib/Headers/unwind.h | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h +index 303d792..44e10cc 100644 +--- a/clang/lib/Headers/unwind.h ++++ b/clang/lib/Headers/unwind.h +@@ -9,9 +9,6 @@ + + /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/ + +-#ifndef __CLANG_UNWIND_H +-#define __CLANG_UNWIND_H +- + #if defined(__APPLE__) && __has_include_next() + /* Darwin (from 11.x on) provide an unwind.h. If that's available, + * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE, +@@ -39,6 +36,9 @@ + # endif + #else + ++#ifndef __CLANG_UNWIND_H ++#define __CLANG_UNWIND_H ++ + #include + + #ifdef __cplusplus +@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *); + } + #endif + ++#endif /* __CLANG_UNWIND_H */ ++ + #endif + +-#endif /* __CLANG_UNWIND_H */ +-- +2.5.1 diff --git a/srcpkgs/llvm18/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm18/patches/clang-002-add-musl-triples.patch new file mode 100644 index 00000000000..0ef4c7e75d6 --- /dev/null +++ b/srcpkgs/llvm18/patches/clang-002-add-musl-triples.patch @@ -0,0 +1,115 @@ +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2086,7 +2086,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf", + "armv7hl-redhat-linux-gnueabi", + "armv6hl-suse-linux-gnueabi", +- "armv7hl-suse-linux-gnueabi"}; ++ "armv7hl-suse-linux-gnueabi", ++ "armv7l-linux-gnueabihf"}; + static const char *const ARMebLibDirs[] = {"/lib"}; + static const char *const ARMebTriples[] = {"armeb-linux-gnueabi", + "armeb-linux-androideabi"}; +@@ -2153,8 +2154,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + "powerpc64-suse-linux", "powerpc-montavista-linuxspe"}; + static const char *const PPCLELibDirs[] = {"/lib32", "/lib"}; + static const char *const PPCLETriples[] = {"powerpcle-linux-gnu", +- "powerpcle-unknown-linux-gnu", +- "powerpcle-linux-musl"}; ++ "powerpcle-unknown-linux-gnu"}; + + static const char *const PPC64LibDirs[] = {"/lib64", "/lib"}; + static const char *const PPC64Triples[] = { +@@ -2235,6 +2235,92 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + return; + } + ++ if (TargetTriple.isMusl()) { ++ static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"}; ++ static const char *const ARMHFMuslTriples[] = { ++ "arm-linux-musleabihf", "armv7l-linux-musleabihf" ++ }; ++ static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"}; ++ static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"}; ++ static const char *const X86MuslTriples[] = {"i686-linux-musl"}; ++ static const char *const MIPSMuslTriples[] = { ++ "mips-linux-musl", "mipsel-linux-musl", ++ "mipsel-linux-muslhf", "mips-linux-muslhf" ++ }; ++ static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"}; ++ static const char *const PPCLEMuslTriples[] = {"powerpcle-linux-musl"}; ++ static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"}; ++ static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"}; ++ static const char *const RISCV64MuslTriples[] = {"riscv64-linux-musl"}; ++ ++ switch (TargetTriple.getArch()) { ++ case llvm::Triple::aarch64: ++ LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs)); ++ TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples)); ++ BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs)); ++ BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples)); ++ break; ++ case llvm::Triple::arm: ++ LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs)); ++ if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) { ++ TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples)); ++ } else { ++ TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples)); ++ } ++ break; ++ case llvm::Triple::x86_64: ++ LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs)); ++ TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples)); ++ BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs)); ++ BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples)); ++ break; ++ case llvm::Triple::x86: ++ LibDirs.append(begin(X86LibDirs), end(X86LibDirs)); ++ TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples)); ++ BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs)); ++ BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples)); ++ break; ++ case llvm::Triple::mips: ++ LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs)); ++ TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples)); ++ break; ++ case llvm::Triple::ppc: ++ LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs)); ++ TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples)); ++ BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs)); ++ BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples)); ++ break; ++ case llvm::Triple::ppcle: ++ LibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs)); ++ TripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples)); ++ BiarchLibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs)); ++ BiarchTripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples)); ++ break; ++ case llvm::Triple::ppc64: ++ LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs)); ++ TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples)); ++ BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs)); ++ BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples)); ++ break; ++ case llvm::Triple::ppc64le: ++ LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs)); ++ TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples)); ++ BiarchLibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs)); ++ BiarchTripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples)); ++ break; ++ case llvm::Triple::riscv64: ++ LibDirs.append(begin(RISCV64LibDirs), end(RISCV64LibDirs)); ++ TripleAliases.append(begin(RISCV64MuslTriples), end(RISCV64MuslTriples)); ++ break; ++ default: ++ break; ++ } ++ TripleAliases.push_back(TargetTriple.str()); ++ if (TargetTriple.str() != BiarchTriple.str()) ++ BiarchTripleAliases.push_back(BiarchTriple.str()); ++ return; ++ } ++ + // Android targets should not use GNU/Linux tools or libraries. + if (TargetTriple.isAndroid()) { + static const char *const AArch64AndroidTriples[] = { diff --git a/srcpkgs/llvm18/patches/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm18/patches/clang-003-ppc64-dynamic-linker-path.patch new file mode 100644 index 00000000000..4ad6412d1e6 --- /dev/null +++ b/srcpkgs/llvm18/patches/clang-003-ppc64-dynamic-linker-path.patch @@ -0,0 +1,13 @@ +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -504,10 +504,6 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { + Loader = "ld.so.1"; + break; + case llvm::Triple::ppc64: +- LibDir = "lib64"; +- Loader = +- (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1"; +- break; + case llvm::Triple::ppc64le: + LibDir = "lib64"; + Loader = diff --git a/srcpkgs/llvm18/patches/compiler-rt-sanitizer-ppc64-musl.patch b/srcpkgs/llvm18/patches/compiler-rt-sanitizer-ppc64-musl.patch new file mode 100644 index 00000000000..3aed07b8569 --- /dev/null +++ b/srcpkgs/llvm18/patches/compiler-rt-sanitizer-ppc64-musl.patch @@ -0,0 +1,37 @@ +--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp +@@ -74,6 +74,10 @@ + # include + # endif + ++#if SANITIZER_LINUX && defined(__powerpc__) ++#include ++#endif ++ + # if SANITIZER_LINUX && !SANITIZER_ANDROID + # include + # endif +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +@@ -94,7 +94,7 @@ + # include + # include + # if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \ +- defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64 ++ defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64 + # include + # ifdef __arm__ + typedef struct user_fpregs elf_fpregset_t; +--- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp +@@ -31,7 +31,7 @@ + #include // for pid_t + #include // for iovec + #include // for NT_PRSTATUS +-#if (defined(__aarch64__) || SANITIZER_RISCV64 || SANITIZER_LOONGARCH64) && \ +- !SANITIZER_ANDROID ++#if (defined(__aarch64__) || defined(__powerpc__) ||SANITIZER_RISCV64 || SANITIZER_LOONGARCH64) && \ ++ !SANITIZER_ANDROID + // GLIBC 2.20+ sys/user does not include asm/ptrace.h + # include + #endif diff --git a/srcpkgs/llvm18/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm18/patches/compiler-rt-sanitizer-supported-arch.patch new file mode 100644 index 00000000000..c9b9286ac37 --- /dev/null +++ b/srcpkgs/llvm18/patches/compiler-rt-sanitizer-supported-arch.patch @@ -0,0 +1,22 @@ +Based on patch from Alpine: +https://gitlab.alpinelinux.org/alpine/aports/-/blob/693203c42aa1cde88cb547173ef67a98824973fd/main/llvm-runtimes/compiler-rt-sanitizer-supported-arch.patch + +Sanitizer code is broken on armhf, armv7, s390x, x86, and probably riscv64 on musl, +i.e. enable it only on x86_64, aarch64, and ppc64le. + +--- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake ++++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake +@@ -23,9 +23,13 @@ if(APPLE) + set(X86_64 x86_64 x86_64h) + endif() + ++if (LIBCXX_HAS_MUSL_LIBC) ++set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86_64} ${ARM64} ${PPC64}) ++else() + set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} ${RISCV64} + ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9} + ${HEXAGON} ${LOONGARCH64}) ++endif() + set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64} + ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON} + ${LOONGARCH64}) diff --git a/srcpkgs/llvm18/patches/libcxx-armv67.patch b/srcpkgs/llvm18/patches/libcxx-armv67.patch new file mode 100644 index 00000000000..700ab134790 --- /dev/null +++ b/srcpkgs/llvm18/patches/libcxx-armv67.patch @@ -0,0 +1,35 @@ +See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109180 +Avoid the following undefined reference: + +/usr/lib/gcc/armv7l-linux-gnueabihf/12.2.0/../../../../armv7l-linux-gnueabihf/bin/ld: projects/libcxx/src/CMakeFiles/cxx_shared.dir/locale.cpp.o: in function `std::__1::__time_get_c_storage::__x() const [clone .localalias]': +locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string, std::__1::allocator >::~basic_string()' +/usr/lib/gcc/armv7l-linux-gnueabihf/12.2.0/../../../../armv7l-linux-gnueabihf/bin/ld: projects/libcxx/src/CMakeFiles/cxx_shared.dir/locale.cpp.o: in function `std::__1::__time_get_c_storage::__X() const [clone .localalias]': + +diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt +index b8ac536588d3..65e5a1365634 100644 +--- a/libcxx/CMakeLists.txt ++++ b/libcxx/CMakeLists.txt +@@ -308,6 +308,8 @@ endif() + option(LIBCXX_HERMETIC_STATIC_LIBRARY + "Do not export any symbols from the static library." ${LIBCXX_HERMETIC_STATIC_LIBRARY_DEFAULT}) + ++option(LIBCXX_VOID_GCC_BUG_109180_WORKAROUND OFF) ++ + #=============================================================================== + # Check option configurations + #=============================================================================== +diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt +index 35b466527096..5b0efa171616 100644 +--- a/libcxx/src/CMakeLists.txt ++++ b/libcxx/src/CMakeLists.txt +@@ -155,6 +155,10 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIBCXX_COVERAGE_LIBRARY) + endif() + add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}") + ++if (LIBCXX_VOID_GCC_BUG_109180_WORKAROUND) ++ set_source_files_properties(string.cpp PROPERTIES COMPILE_FLAGS -fno-inline) ++endif() ++ + if (APPLE AND LLVM_USE_SANITIZER) + if (("${LLVM_USE_SANITIZER}" STREQUAL "Address") OR + ("${LLVM_USE_SANITIZER}" STREQUAL "Address;Undefined") OR diff --git a/srcpkgs/llvm18/patches/libcxx-musl.patch b/srcpkgs/llvm18/patches/libcxx-musl.patch new file mode 100644 index 00000000000..0dd5f0e7eb8 --- /dev/null +++ b/srcpkgs/llvm18/patches/libcxx-musl.patch @@ -0,0 +1,26 @@ +--- a/libcxx/include/locale ++++ b/libcxx/include/locale +@@ -742,7 +742,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end, + __libcpp_remove_reference_t __save_errno = errno; + errno = 0; + char* __p2; ++#if defined(__linux__) && !defined(__GLIBC__) ++ long long __ll = strtoll(__a, &__p2, __base); ++#else + long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); ++#endif + __libcpp_remove_reference_t __current_errno = errno; + if (__current_errno == 0) + errno = __save_errno; +@@ -782,7 +786,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end, + __libcpp_remove_reference_t __save_errno = errno; + errno = 0; + char* __p2; ++#if defined(__linux__) && !defined(__GLIBC__) ++ unsigned long long __ll = strtoull(__a, &__p2, __base); ++#else + unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); ++#endif + __libcpp_remove_reference_t __current_errno = errno; + if (__current_errno == 0) + errno = __save_errno; diff --git a/srcpkgs/llvm18/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm18/patches/libcxx-ssp-nonshared.patch new file mode 100644 index 00000000000..70292beb2fc --- /dev/null +++ b/srcpkgs/llvm18/patches/libcxx-ssp-nonshared.patch @@ -0,0 +1,11 @@ +--- a/libcxx/CMakeLists.txt ++++ b/libcxx/CMakeLists.txt +@@ -769,6 +769,8 @@ function(cxx_link_system_libraries target) + target_link_libraries(${target} PRIVATE atomic) + endif() + ++#ssp target_link_libraries(${target} PRIVATE ssp_nonshared) ++ + if (MINGW) + target_link_libraries(${target} PRIVATE "${MINGW_LIBRARIES}") + endif() diff --git a/srcpkgs/llvm18/patches/libcxxabi-dl.patch b/srcpkgs/llvm18/patches/libcxxabi-dl.patch new file mode 100644 index 00000000000..e872d263de3 --- /dev/null +++ b/srcpkgs/llvm18/patches/libcxxabi-dl.patch @@ -0,0 +1,25 @@ +Also link to -ldl to prevent undefined references. + +--- a/libcxxabi/src/CMakeLists.txt ++++ b/libcxxabi/src/CMakeLists.txt +@@ -73,6 +73,7 @@ + endif() + + add_library_flags_if(LIBCXXABI_HAS_C_LIB c) ++ add_library_flags_if(LIBCXXABI_HAS_C_LIB dl) + endif() + + if (LIBCXXABI_USE_LLVM_UNWINDER) +--- a/libcxx/CMakeLists.txt ++++ b/libcxx/CMakeLists.txt +@@ -745,6 +745,10 @@ + if (LIBCXX_HAS_PTHREAD_LIB) + target_compile_definitions(${target} PRIVATE -D_LIBCPP_LINK_PTHREAD_LIB) + endif() ++ if (LIBCXX_HAS_C_LIB) ++ target_link_libraries(${target} PRIVATE dl) ++ endif() ++ + if (LIBCXX_HAS_RT_LIB) + target_compile_definitions(${target} PRIVATE -D_LIBCPP_LINK_RT_LIB) + endif() diff --git a/srcpkgs/llvm18/patches/libomp-soname.patch b/srcpkgs/llvm18/patches/libomp-soname.patch new file mode 100644 index 00000000000..9a622cd9254 --- /dev/null +++ b/srcpkgs/llvm18/patches/libomp-soname.patch @@ -0,0 +1,12 @@ +diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt +index df1ca9d90..9d2c3b7b9 100644 +--- a/openmp/runtime/src/CMakeLists.txt ++++ b/openmp/runtime/src/CMakeLists.txt +@@ -150,6 +150,7 @@ libomp_get_libflags(LIBOMP_CONFIGURED_LIBFLAGS) + # Build libomp library. Add LLVMSupport dependency if building in-tree with libomptarget profiling enabled. + if(OPENMP_STANDALONE_BUILD OR (NOT OPENMP_ENABLE_LIBOMP_PROFILING)) + add_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES}) ++ set_target_properties(omp PROPERTIES VERSION ${LIBOMP_VERSION_MAJOR} SOVERSION ${LIBOMP_VERSION_MAJOR}) + # Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS + target_link_libraries(omp ${LIBOMP_CONFIGURED_LIBFLAGS} ${LIBOMP_DL_LIBS}) + else() diff --git a/srcpkgs/llvm18/patches/llvm-001-musl.patch b/srcpkgs/llvm18/patches/llvm-001-musl.patch new file mode 100644 index 00000000000..8652e4af69f --- /dev/null +++ b/srcpkgs/llvm18/patches/llvm-001-musl.patch @@ -0,0 +1,32 @@ +From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Tue, 8 Sep 2015 22:03:02 +0200 +Subject: [PATCH 3/3] musl + +--- + include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++ + lib/Support/DynamicLibrary.cpp | 2 +- + lib/Support/Unix/Signals.inc | 6 +++--- + utils/unittest/googletest/src/gtest.cc | 1 + + 5 files changed, 17 insertions(+), 6 deletions(-) + +diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h +index 34a8a1e3..1214ece5 100644 +--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h ++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h +@@ -18,6 +18,15 @@ + #include "llvm/IR/PassManager.h" + #include "llvm/Pass.h" + ++#undef fopen64 ++#undef fseeko64 ++#undef fstat64 ++#undef fstatvfs64 ++#undef ftello64 ++#undef lstat64 ++#undef stat64 ++#undef tmpfile64 ++ + namespace llvm { + template class ArrayRef; + class Triple; diff --git a/srcpkgs/llvm18/patches/llvm-004-override-opt.patch b/srcpkgs/llvm18/patches/llvm-004-override-opt.patch new file mode 100644 index 00000000000..51d0e4b31b3 --- /dev/null +++ b/srcpkgs/llvm18/patches/llvm-004-override-opt.patch @@ -0,0 +1,18 @@ +This allows us to override the optimization level as not all platforms can +deal with -O3. + +--- a/llvm/CMakeLists.txt ++++ b/llvm/CMakeLists.txt +@@ -918,6 +918,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) + llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2") + endif() + ++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use") ++ ++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "") ++ llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}") ++endif() ++ + # Put this before tblgen. Else we have a circular dependence. + add_subdirectory(lib/Demangle) + add_subdirectory(lib/Support) diff --git a/srcpkgs/llvm18/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm18/patches/llvm-005-ppc-bigpic.patch new file mode 100644 index 00000000000..d332687b9d9 --- /dev/null +++ b/srcpkgs/llvm18/patches/llvm-005-ppc-bigpic.patch @@ -0,0 +1,36 @@ +From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 3 Nov 2019 10:57:27 -0600 +Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified + +--- + llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 2 +- + llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp +index cce21f32..87ca5f9b 100644 +--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp ++++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +@@ -520,7 +520,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI, + + // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI. + if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() && +- M->getPICLevel() == PICLevel::BigPIC) ++ M->getPICLevel() != PICLevel::SmallPIC) + TlsRef = MCBinaryExpr::createAdd( + TlsRef, MCConstantExpr::create(32768, OutContext), OutContext); + const MachineOperand &MO = MI->getOperand(2); +diff --git a/lib/Target/PowerPC/PPCMCInstLower.cpp b/lib/Target/PowerPC/PPCMCInstLower.cpp +index 5cc180d7..a5b02565 100644 +--- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp ++++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp +@@ -117,7 +117,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol, + const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx); + // If -msecure-plt -fPIC, add 32768 to symbol. + if (Subtarget->isSecurePlt() && TM.isPositionIndependent() && +- M->getPICLevel() == PICLevel::BigPIC && ++ M->getPICLevel() != PICLevel::SmallPIC && + MO.getTargetFlags() == PPCII::MO_PLT) + Expr = + MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx); diff --git a/srcpkgs/llvm18/patches/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm18/patches/llvm-006-aarch64-mf_exec.patch new file mode 100644 index 00000000000..192b4824b86 --- /dev/null +++ b/srcpkgs/llvm18/patches/llvm-006-aarch64-mf_exec.patch @@ -0,0 +1,24 @@ +Fix failures in AllocationTests/MappedMemoryTest.* on aarch64: + + Failing Tests (8): + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3 + +Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10 + +--- a/llvm/lib/Support/Unix/Memory.inc ++++ b/llvm/lib/Support/Unix/Memory.inc +@@ -58,7 +58,7 @@ static int getPosixProtectionFlags(unsigned Flags) { + return PROT_READ | PROT_WRITE | PROT_EXEC; + case llvm::sys::Memory::MF_EXEC: +-#if defined(__FreeBSD__) || defined(__powerpc__) ++#if defined(__FreeBSD__) || defined(__powerpc__) || (defined(__linux__) && defined(__aarch64__)) + // On PowerPC, having an executable page that has no read permission + // can have unintended consequences. The function InvalidateInstruction- + // Cache uses instructions dcbf and icbi, both of which are treated by diff --git a/srcpkgs/llvm18/patches/openmp-stdint.patch b/srcpkgs/llvm18/patches/openmp-stdint.patch new file mode 100644 index 00000000000..57e73521df8 --- /dev/null +++ b/srcpkgs/llvm18/patches/openmp-stdint.patch @@ -0,0 +1,12 @@ +diff --git a/openmp/libomptarget/include/Shared/SourceInfo.h b/openmp/libomptarget/include/Shared/SourceInfo.h +index 7ce5fd43efc0..c9ff20c59b43 100644 +--- a/openmp/libomptarget/include/Shared/SourceInfo.h ++++ b/openmp/libomptarget/include/Shared/SourceInfo.h +@@ -14,6 +14,7 @@ + #define OMPTARGET_SHARED_SOURCE_INFO_H + + #include ++#include + + #ifdef _WIN32 + constexpr bool OSWindows = true; diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template new file mode 100644 index 00000000000..61658c63e83 --- /dev/null +++ b/srcpkgs/llvm18/template @@ -0,0 +1,781 @@ +# Template file for 'llvm18' +pkgname=llvm18 +version=18.1.8 +revision=1 +build_wrksrc=llvm +build_style=cmake +_ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so" +configure_args=" + -DCMAKE_BUILD_TYPE=Release -Wno-dev + -DENABLE_LINKER_BUILD_ID=YES + -DLLDB_USE_SYSTEM_SIX=YES + -DLIBCXX_CXX_ABI=libcxxabi + -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES + -DLIBCXXABI_USE_LLVM_UNWINDER=YES + -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES + -DLIBOMP_ENABLE_SHARED=YES + -DLIBOMP_INSTALL_ALIASES=NO + -DLLVM_INCLUDE_DOCS=YES + -DLLVM_BUILD_DOCS=YES + -DLLVM_ENABLE_SPHINX=YES + -DLLVM_ENABLE_Z3_SOLVER=YES + -DSPHINX_WARNINGS_AS_ERRORS=NO + -DLLVM_INSTALL_UTILS=YES + -DLLVM_BUILD_LLVM_DYLIB=YES + -DLLVM_LINK_LLVM_DYLIB=YES + -DCLANG_LINK_CLANG_DYLIB=YES + -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang18 + -DLLVM_ENABLE_RTTI=YES + -DLLVM_ENABLE_FFI=YES + -DLLVM_BINUTILS_INCDIR=/usr/include + -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO + -DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages + -DLLDB_PYTHON_EXE_RELATIVE_PATH=bin/python${py3_ver} + -DLLDB_PYTHON_EXT_SUFFIX=$_ext_suffix " +hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx + python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config + python3-mdit-py-plugins python3-MyST-Parser python3-markdown-it graphviz" +makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel + libxml2-devel binutils-devel z3" +short_desc="LLVM Compiler Infrastructure Project - Version 18" +maintainer="Daniel Martinez " +license="Apache-2.0" +homepage="https://www.llvm.org" +distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz" +checksum=09c08693a9afd6236f27a2ebae62cda656eba19021ef3f94d59e931d662d4856 +conflicts="llvm17>=0 llvm15>=0" +lib32disabled=yes +python_version=3 + +build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp lto" +build_options_default="clang clang_tools_extra lld mlir libclc polly lldb openmp" + +if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then + build_options_default+=" flang bolt" +fi + +# only use lto on x86_64(-musl), since its probably +# not worth the added compile time on non x86_64 archs +case "$XBPS_TARGET_MACHINE" in + x86_64*) build_options_default+=" lto" ;; +esac + +# fails to build with libquadmth on musl +case "$XBPS_TARGET_MACHINE" in + x86_64|i686) makedepends+=" libquadmath-devel" ;; +esac + +# build fails because compiler_rt generates armv7 instructions when target is armv6 +case "$XBPS_TARGET_MACHINE" in + armv6*) ;; + *) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;; +esac + +if [ "$XBPS_TARGET_LIBC" = "musl" ]; then + configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES + -DCOMPILER_RT_BUILD_GWP_ASAN=OFF" +fi + +if [ "$build_option_lto" ]; then + configure_args+=" -DLLVM_ENABLE_LTO=On" +fi + +subpackages="libllvm18 llvm18-doc llvm18-devel" + +# use $(:) to silence xlint +_enabled_runtimes=$(:) + +if [ "$build_option_clang" ]; then + _enabled_projects+="clang;" + subpackages+=" clang18 clang18-headers clang18-devel libclang18 libclang-cpp18 clang-analyzer18 " +fi +if [ "$build_option_clang_tools_extra" ]; then + _enabled_projects+="clang-tools-extra;" + subpackages+=" clang-tools-extra18 " +fi +if [ "$build_option_bolt" ]; then + _enabled_projects+="bolt;" + subpackages+=" llvm-bolt18 " +fi +if [ "$build_option_polly" ]; then + _enabled_projects+="polly;" +fi +if [ "$build_option_lldb" ]; then + _enabled_projects+="lldb;" + subpackages+=" lldb18 lldb18-devel liblldb18" +fi +if [ "$build_option_lld" ]; then + _enabled_projects+="lld;" + subpackages+=" lld18 lld18-devel " +fi +if [ "$build_option_libclc" ]; then + _enabled_projects+="libclc;" +fi +if [ "$build_option_mlir" ]; then + _enabled_projects+="mlir;" + subpackages+=" mlir18 mlir18-devel " +fi +if [ "$build_option_flang" ]; then + _enabled_projects+="flang;" + subpackages+=" flang18 flang18-devel " +fi + +subpackages+=" compiler-rt18 " +_enabled_runtimes="compiler-rt" + +if [ "$build_option_openmp" ]; then + # openmp fails when built as runtime if cross-compiled + if [ "$CROSS_BUILD" ]; then + _enabled_projects+="openmp;" + else + _enabled_runtimes+=";openmp" + fi + subpackages+=" libomp18 libomp18-devel " +fi + +# enable if runtime subpackages link to this version of llvm +if true; then + subpackages+=" llvm-libunwind llvm-libunwind-devel " + _enabled_runtimes+=";libunwind" + + subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel " + _enabled_runtimes+=";libcxxabi;libcxx" + +fi + +configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}" +configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}" + +if [ "$CROSS_BUILD" ]; then + hostmakedepends+=" llvm18-cross-tools" +fi + +# For OCaml bindings and lldb lua scripting +if [ -z "$CROSS_BUILD" ]; then + if [ "$build_option_clang_tools_extra" ] && [ "$build_option_lldb" ]; then + subpackages+=" llvm18-cross-tools" + fi + # OCaml cross build is broken + hostmakedepends+=" ocaml ocaml-findlib " + # lldb cross build fails with lua + makedepends+=" lua53-devel " +fi + +post_patch() { + if [ "$build_option_lldb" ]; then + if [ "$XBPS_TARGET_LIBC" = "musl" ]; then + vsed -i 's|__ptrace_request|int|g' \ + ${wrksrc}/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp + fi + # disable docs for lldb as they fail to generate + vsed -i '/add_subdirectory(docs)/d' \ + ${wrksrc}/lldb/CMakeLists.txt + fi + + # update config.guess for better platform detection + cp $XBPS_COMMONDIR/environment/configure/automake/config.guess \ + ${wrksrc}/llvm/cmake + + # fix linker failures on some archs + vsed -i 's,check_library_exists(gcc_s .*,set(LIBCXXABI_HAS_GCC_S_LIB ON),' \ + ${wrksrc}/libcxxabi/cmake/config-ix.cmake + vsed -i 's,check_library_exists(gcc .*,set(LIBCXXABI_HAS_GCC_LIB ON),' \ + ${wrksrc}/libcxxabi/cmake/config-ix.cmake + + # need libssp_nonshared on some musl platforms (because of nodefaultlibs) + case "$XBPS_TARGET_MACHINE" in + ppc64*) ;; + ppc*-musl|i686-musl|mips*-musl) + vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \ + ${wrksrc}/libunwind/src/CMakeLists.txt + vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \ + ${wrksrc}/libcxxabi/src/CMakeLists.txt + vsed -i 's,#ssp,,' ${wrksrc}/libcxx/CMakeLists.txt + ;; + esac +} + +pre_configure() { + local triplet + + # Vastly reduce size of debugging symbols: + CFLAGS=${CFLAGS/ -g/ -g1} + CXXFLAGS=${CXXFLAGS/ -g/ -g1} + + # since gcc9, the build likes to blow up for ppc32 apparently because + # of clang being too large for a 24-bit relative call to the PLT, so + # optimize for size instead + case "$XBPS_TARGET_MACHINE" in + ppc64*) ;; + mips*-musl|ppc*) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;; + armv*) configure_args+=" -DLIBCXX_VOID_GCC_BUG_109180_WORKAROUND=ON ";; + esac + + if [ "$CROSS_BUILD" ]; then + configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/usr/bin" + configure_args+=" -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen" + configure_args+=" -DCLANG_TABLEGEN=/usr/bin/clang-tblgen" + configure_args+=" -DMLIR_TABLEGEN=/usr/bin/mlir-tblgen" + configure_args+=" -DMLIR_PDLL_TABLEGEN=/usr/bin/mlir-pdll" + configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/usr/bin/mlir-linalg-ods-yaml-gen" + configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/usr/bin/clang-tidy-confusable-chars-gen" + configure_args+=" -DCLANG_PSEUDO_GEN=/usr/bin/clang-pseudo-gen" + configure_args+=" -DLLVM_CONFIG_PATH=/usr/bin/llvm-config" + configure_args+=" -DLLDB_TABLEGEN_EXE=/usr/bin/lldb-tblgen" + fi + + case "$XBPS_TARGET_MACHINE" in + arm*-musl|i686-musl) + # sanitizer code is broken since it duplicates some libc bits + configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF" + ;; + esac + + case "$XBPS_TARGET_MACHINE" in + i686*) _arch="X86";; + x86_64*) _arch="X86";; + armv5*) _arch="Armv5te";; + armv6*) _arch="Armv6";; + armv7*) _arch="Armv7";; + aarch64*) _arch="AArch64";; + mips*) _arch="Mips";; + ppc*) _arch="PowerPC";; + riscv64*) _arch="RISCV64";; + esac + + triplet=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET} + + configure_args+=" -DLLVM_TARGET_ARCH=${_arch}" + configure_args+=" -DLLVM_HOST_TRIPLE=${triplet}" + configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${triplet}" +} + +post_build() { + + mkdir -p ${wrksrc}/${build_wrksrc}/runtimes-doc + cmake -G Ninja ${wrksrc}/runtimes -B ${wrksrc}/${build_wrksrc}/runtimes-doc \ + -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \ + -DLLVM_ENABLE_SPHINX=ON \ + -DSPHINX_WARNINGS_AS_ERRORS=OFF + + ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/runtimes-doc docs-libcxx-html docs-libunwind-html + + if [ -z "$CROSS_BUILD" ] && [ "$build_option_clang_tools_extra" ] && [ "$build_option_lldb" ]; then + # Binaries ONLY used during the process of building llvm, and aren't usually installed + vmkdir usr/bin + vcopy build/bin/lldb-tblgen usr/bin + vcopy build/bin/clang-tidy-confusable-chars-gen usr/bin + vcopy build/bin/clang-pseudo-gen usr/bin + fi +} + +post_install() { + + # Required for multilib. + if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then + for _header in llvm-config; do + mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h + vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \ + usr/include/llvm/Config ${_header}.h + done + fi + + # Remove llvm-config-host in cross builds. + if [ "$CROSS_BUILD" ]; then + rm -f ${DESTDIR}/usr/bin/llvm-config-host + fi + + rm -rf ${DESTDIR}/usr/share/gdb + + # Install libcxxabi headers + vinstall ${wrksrc}/libcxxabi/include/__cxxabi_config.h 644 usr/include + vinstall ${wrksrc}/libcxxabi/include/cxxabi.h 644 usr/include + + # Install libunwind headers + vinstall ${wrksrc}/libunwind/include/__libunwind_config.h 644 usr/include + vinstall ${wrksrc}/libunwind/include/libunwind.h 644 usr/include + vinstall ${wrksrc}/libunwind/include/unwind.h 644 usr/include + vinstall ${wrksrc}/libunwind/include/mach-o/compact_unwind_encoding.h \ + 644 usr/include/mach-o + + # Install libcxx and libunwind docs + cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P ${wrksrc}/${build_wrksrc}/runtimes-doc/libcxx/docs/cmake_install.cmake + cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P ${wrksrc}/${build_wrksrc}/runtimes-doc/libunwind/docs/cmake_install.cmake + + # Can this be disabled some other way? + rm -rf ${DESTDIR}/usr/lib64 +} + +clang18_package() { + lib32disabled=yes + depends="libstdc++-devel libgcc-devel binutils ${XBPS_TARGET_LIBC}-devel + compiler-rt18" + conflicts="clang17>=0 clang15>=0" + short_desc+=" - C language family frontend" + homepage="https://clang.llvm.org/" + pkg_install() { + vmove usr/bin/clang-18 + vmove usr/bin/clang + vmove usr/bin/clang++ + vmove usr/bin/clang-cl + vmove usr/bin/clang-cpp + vmove usr/bin/clang-check + vmove usr/bin/clang-extdef-mapping + vmove usr/bin/clang-format + vmove usr/bin/git-clang-format + vmove usr/bin/clang-linker-wrapper + vmove usr/bin/clang-offload-bundler + vmove usr/bin/clang-offload-packager + vmove usr/bin/clang-refactor + vmove usr/bin/clang-rename + vmove usr/bin/clang-repl + vmove usr/bin/clang-scan-deps + vmove usr/bin/clang-tblgen + vmove usr/bin/c-index-test + vmove usr/bin/diagtool + vmove usr/bin/amdgpu-arch + vmove usr/bin/nvptx-arch + vmove usr/bin/hmaptool + + vmove usr/share/man/man1/clang.1 + vmove usr/share/man/man1/diagtool.1 + if [ "$build_option_polly" ]; then + vmove usr/lib/LLVMPolly.so + vmove usr/share/man/man1/polly.1 + fi + } +} + +clang18-headers_package() { + lib32disabled=yes + short_desc+=" - C language family frontend - Headers" + homepage="https://clang.llvm.org/" + pkg_install() { + vmove usr/lib/clang/18/include + } +} + +clang18-devel_package() { + lib32disabled=yes + depends="libstdc++-devel libgcc-devel binutils ${XBPS_TARGET_LIBC}-devel + clang18>=${version}_${revision} clang-analyzer18>=${version}_${revision} + llvm18>=${version}_${revision}" + conflicts="clang17-devel clang15-devel" + if [ "$build_option_clang_tools_extra" ]; then + depends+=" clang-tools-extra18>=${version}_${revision}" + fi + short_desc+=" - C language family frontend - development Files" + homepage="https://clang.llvm.org/" + pkg_install() { + vmove usr/include/clang + vmove usr/include/clang-c + vmove usr/lib/libear + vmove usr/lib/cmake/clang + vmove "usr/lib/libclang*.a" + vmove "usr/lib/libclang*.so" + vmove usr/share/clang + if [ "$build_option_clang_tools_extra" ]; then + vmove usr/include/clang-tidy + vmove usr/lib/libfindAllSymbols.a + fi + if [ "$build_option_polly" ]; then + vmove usr/include/polly + vmove usr/lib/cmake/polly + vmove "usr/lib/libPolly*.a" + fi + } +} + +libclang18_package() { + depends="clang18-headers>=${version}_${revision}" + short_desc+=" - C frontend library" + pkg_install() { + vmove "usr/lib/libclang.so.*" + } +} + +libclang-cpp18_package() { + depends="clang18-headers>=${version}_${revision}" + short_desc+=" - C frontend library (C++ interface)" + pkg_install() { + vmove "usr/lib/libclang-cpp.so.*" + } +} + +clang-analyzer18_package() { + depends="clang18>=${version}_${revision} python3 perl" + conflicts="clang-analyzer17>=0 clang-analyzer15>=0" + short_desc+=" - A source code analysis framework" + homepage="https://clang-analyzer.llvm.org/" + pycompile_dirs="usr/share/scan-view" + pkg_install() { + vmove usr/share/scan-view + vmove usr/share/scan-build + vmove usr/lib/libscanbuild + vmove usr/libexec/analyze-c++ + vmove usr/libexec/analyze-cc + vmove usr/libexec/intercept-c++ + vmove usr/libexec/intercept-cc + vmove usr/libexec/c++-analyzer + vmove usr/libexec/ccc-analyzer + vmove usr/share/man/man1/scan-build.1 + vmove usr/bin/analyze-build + vmove usr/bin/scan-build + vmove usr/bin/scan-build-py + vmove usr/bin/scan-view + } +} + +clang-tools-extra18_package() { + lib32disabled=yes + depends="clang18>=${version}_${revision} python3" + conflicts="clang-tools-extra17>=0 clang-tools-extra15>=0" + short_desc+=" - Extra Clang tools" + homepage="https://clang.llvm.org/extra/" + pkg_install() { + vmove usr/bin/clang-apply-replacements + vmove usr/bin/clang-change-namespace + vmove usr/bin/clang-doc + vmove usr/bin/clang-include-cleaner + vmove usr/bin/clang-include-fixer + vmove usr/bin/clang-move + vmove usr/bin/clang-pseudo + vmove usr/bin/clang-query + vmove usr/bin/clang-reorder-fields + vmove usr/bin/clang-tidy + vmove usr/bin/clangd + vmove usr/bin/find-all-symbols + vmove usr/bin/modularize + vmove usr/bin/pp-trace + vmove usr/bin/run-clang-tidy + vmove usr/share/man/man1/extraclangtools.1 + } +} + +# "bolt" package name is already used +llvm-bolt18_package() { + lib32disabled=yes + depends="clang18>=${version}_${revision}" + conflicts="llvm-bolt17>=0" + short_desc+=" - post-link optimizer" + homepage="https://github.com/llvm/llvm-project/tree/main/bolt" + pkg_install() { + vmove usr/bin/llvm-bolt + vmove usr/bin/perf2bolt + vmove usr/bin/llvm-boltdiff + vmove usr/bin/merge-fdata + vmove usr/bin/llvm-bolt-heatmap + if [ -z "$CROSS_BUILD" ]; then + case "$XBPS_TARGET_MACHINE" in + x86_64*|aarch64*) + vmove usr/lib/libbolt_rt_instr.a + vmove usr/lib/libbolt_rt_hugify.a + ;; + esac + fi + } +} + +lldb18_package() { + lib32disabled=yes + depends+=" python3-six" + conflicts="lldb17>=0 lldb15>=0" + short_desc+=" - LLDB debugger" + homepage="https://lldb.llvm.org/" + pkg_install() { + vmove usr/bin/lldb + vmove usr/bin/lldb-argdumper + vmove usr/bin/lldb-instr + vmove usr/bin/lldb-server + vmove usr/bin/lldb-dap + vmove "usr/lib/python${py3_ver}/site-packages/lldb" + if [ -z "$CROSS_BUILD" ]; then + vmove /usr/lib/lua/5.3/lldb.so + fi + } +} + +lldb18-devel_package() { + lib32disabled=yes + depends="lldb18>=${version}_${revision}" + conflicts="lldb17-devel>=0 lldb15-devel>=0" + short_desc+=" - LLDB debugger - development files" + pkg_install() { + vmove usr/include/lldb + vmove "usr/lib/liblldb*.so" + } +} + +liblldb18_package() { + lib32disabled=yes + short_desc+=" - LLDB debugger - runtime library" + pkg_install() { + vmove "usr/lib/liblldb*.so.*" + } +} + +lld18_package() { + lib32disabled=yes + conflicts="lld17>=0 lld15>=0" + short_desc+=" - linker" + homepage="https://lld.llvm.org" + pkg_install() { + vmove usr/bin/lld + vmove usr/bin/lld-link + vmove usr/bin/ld.lld + vmove usr/bin/ld64.lld + vmove usr/bin/wasm-ld + } +} + +lld18-devel_package() { + lib32disabled=yes + depends="lld18>=${version}_${revision} llvm18>=${version}_${revision}" + conflicts="lld17-devel>=0 lld15-devel>=0" + short_desc+=" - linker - development files" + homepage="https://lld.llvm.org" + pkg_install() { + vmove usr/include/lld + vmove usr/lib/cmake/lld + vmove "usr/lib/liblld*.a" + } +} + +mlir18_package() { + lib32disabled=yes + short_desc+=" - multi-level IR compiler framework" + homepage="https://mlir.llvm.org/" + pkg_install() { + vmove "usr/lib/libMLIR*.so.*" + vmove "usr/lib/libmlir*.so.*" + } +} + +mlir18-devel_package() { + lib32disabled=yes + depends="mlir18>=${version}_${revision} llvm18>=${version}_${revision}" + conflicts="mlir17-devel>=0" + short_desc+=" - multi-level IR compiler framework - development files" + homepage="https://mlir.llvm.org/" + pkg_install() { + vmove usr/bin/mlir-cpu-runner + vmove usr/bin/mlir-linalg-ods-yaml-gen + vmove usr/bin/mlir-lsp-server + vmove usr/bin/mlir-opt + vmove usr/bin/mlir-pdll + vmove usr/bin/mlir-pdll-lsp-server + vmove usr/bin/mlir-reduce + vmove usr/bin/mlir-tblgen + vmove usr/bin/mlir-translate + vmove usr/bin/tblgen-lsp-server + vmove usr/include/mlir + vmove usr/include/mlir-c + vmove usr/lib/cmake/mlir + vmove "usr/lib/libMLIR*" + vmove "usr/lib/objects-Release/obj.MLIR*" + vmove "usr/lib/libmlir*" + vmove usr/share/man/man1/mlir-tblgen.1 + } +} + +flang18_package() { + lib32disabled=yes + depends="mlir18>=${version}_${revision}" + conflicts="flang17>=0" + short_desc+=" - Fortran language frontend" + homepage="https://flang.llvm.org/" + pkg_install() { + vmove usr/bin/flang-new + vmove usr/bin/flang-to-external-fc + } +} + +flang18-devel_package() { + lib32disabled=yes + depends="flang18>=${version}_${revision} llvm18>=${version}_${revision}" + conflicts="flang17-devel>=0" + short_desc+=" - Fortran language frontend - development files" + homepage="https://flang.llvm.org/" + pkg_install() { + vmove usr/bin/bbc + vmove usr/bin/f18-parse-demo + vmove usr/bin/fir-opt + vmove usr/bin/tco + vmove usr/include/flang + vmove usr/lib/cmake/flang + vmove "usr/lib/libflang*.a" + vmove "usr/lib/libFIR*.a" + vmove "usr/lib/libHLFIR*.a" + vmove "usr/lib/libFortran*.a" + } +} + +libomp18_package() { + short_desc+=" - Clang OpenMP support library" + conflicts="libomp17>=0" + pkg_install() { + vmove "usr/lib/libomp*.so.*" + } +} + +libomp18-devel_package() { + short_desc+=" - Clang OpenMP support library - development files" + depends="libomp18>=${version}_${revision}" + conflicts="libomp17-devel>=0" + pkg_install() { + if [ -f "${DESTDIR}/usr/bin/llvm-omp-device-info" ]; then + vmove usr/bin/llvm-omp-device-info + fi + if [ -f "${DESTDIR}/usr/bin/llvm-omp-kernel-replay" ]; then + vmove usr/bin/llvm-omp-kernel-replay + fi + if [ -f "${DESTDIR}/usr/lib/libarcher.so" ]; then + vmove "usr/lib/libarcher*.so" + fi + if [ -f "${DESTDIR}/usr/lib/libarcher_static.a" ]; then + vmove "usr/lib/libarcher*.a" + fi + + vmove "usr/lib/libomp*.so" + vmove usr/lib/cmake/openmp + if [ -f "${DESTDIR}/usr/share/man/man1/llvmopenmp.1" ]; then + vmove usr/share/man/man1/llvmopenmp.1 + fi + + if [ -z "$CROSS_BUILD" ]; then + case "$XBPS_TARGET_MACHINE" in + x86_64*|aarch64*) + vmove "usr/lib/libomptarget*.bc" + vmove "usr/lib/libomp*.a" + ;; + esac + fi + } +} + +llvm-libunwind_package() { + short_desc+=" - libunwind" + pkg_install() { + vmove "usr/lib/libunwind.so.*" + } +} + +llvm-libunwind-devel_package() { + short_desc+=" - libunwind - development files" + depends="llvm-libunwind>=${version}_${revision}" + conflicts="libunwind-devel>=0" + pkg_install() { + vmove usr/include/mach-o + vmove "usr/include/*unwind*" + vmove "usr/lib/libunwind.a" + vmove "usr/lib/libunwind.so" + + LIBUNWIND_DOCS=usr/share/doc/LLVM/libunwind + vmkdir ${LIBUNWIND_DOCS} + vcopy ${wrksrc}/${build_wrksrc}/runtimes-doc/libunwind/docs/html ${LIBUNWIND_DOCS} + } +} + +libcxxabi_package() { + short_desc+=" - low level support for libc++" + pkg_install() { + vmove "usr/lib/libc++abi.so.*" + } +} + +libcxxabi-devel_package() { + short_desc+=" - low level support for libc++ - development files" + depends="libcxxabi>=${version}_${revision}" + pkg_install() { + vmove "usr/include/*cxxabi*" + vmove "usr/lib/libc++abi.so" + vmove "usr/lib/libc++abi.a" + } +} + +libcxx_package() { + short_desc+=" - C++ standard library" + pkg_install() { + vmove "usr/lib/libc++.so.*" + } +} + +libcxx-devel_package() { + short_desc+=" - C++ standard library - development files" + depends="libcxx>=${version}_${revision}" + pkg_install() { + vmove usr/include/c++ + vmove "usr/lib/libc++.so" + vmove "usr/lib/libc++.a" + vmove "usr/lib/libc++experimental.a" + + LIBCXX_DOCS=usr/share/doc/LLVM/libcxx + vmkdir ${LIBCXX_DOCS} + vcopy ${wrksrc}/${build_wrksrc}/runtimes-doc/libcxx/docs/html ${LIBCXX_DOCS} + } +} + +compiler-rt18_package() { + short_desc+=" - runtime libraries" + homepage="https://compiler-rt.llvm.org/" + pkg_install() { + vmove usr/lib/clang/18/lib + if [ -d "${DESTDIR}/usr/lib/clang/18/bin" ]; then + vmove usr/lib/clang/18/bin + fi + if [ -d "${DESTDIR}/usr/lib/clang/18/share" ]; then + vmove usr/lib/clang/18/share + fi + } +} + +libllvm18_package() { + short_desc+=" - library" + pkg_install() { + vmove "usr/lib/libLLVM-*.so" + vmove "usr/lib/libLLVM.so.*" + } +} + +llvm18-doc_package() { + short_desc+=" - documentation" + pkg_install() { + vmove usr/share/doc + } +} + +llvm18-devel_package() { + depends="llvm18>=${version}_${revision}" + conflicts="llvm17-devel>=0 llvm15-devel>=0" + short_desc+=" - development files" + if [ "$build_option_openmp" ]; then + depends+=" libomp18-devel>=${version}_${revision} " + fi + if [ "$build_option_mlir" ]; then + depends+=" mlir18-devel>=${version}_${revision} " + fi + if [ "$build_option_clang" ]; then + depends+=" clang18-devel>=${version}_${revision} " + fi + pkg_install() { + vmove usr/lib/libLLVM.so + vmove usr/lib/libLTO.so + vmove usr/lib/libRemarks.so + vmove usr/include/llvm + vmove usr/include/llvm-c + vmove "usr/lib/libLLVM*.a" + vmove usr/lib/cmake/llvm + } +} + +# These binaries are ONLY used when building llvm, they aren't normally installed +llvm18-cross-tools_package() { + conflicts="llvm17-cross-tools>=0" + short_desc+=" - build tools for cross compiling LLVM" + depends="lldb18-devel>=${version}_${revision} llvm18-devel>=${version}_${revision}" + pkg_install() { + vmove usr/bin/lldb-tblgen + vmove usr/bin/clang-tidy-confusable-chars-gen + vmove usr/bin/clang-pseudo-gen + } +} diff --git a/srcpkgs/llvm18/update b/srcpkgs/llvm18/update new file mode 100644 index 00000000000..46844c65620 --- /dev/null +++ b/srcpkgs/llvm18/update @@ -0,0 +1,3 @@ +site="https://github.com/llvm/llvm-project/releases" +pattern="llvmorg-\K(18)\.(\d+)\.+\d+(-rc\d+)?" +ignore="*-rc*" diff --git a/srcpkgs/mlir18 b/srcpkgs/mlir18 new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/mlir18 @@ -0,0 +1 @@ +llvm18 \ No newline at end of file diff --git a/srcpkgs/mlir18-devel b/srcpkgs/mlir18-devel new file mode 120000 index 00000000000..1f418dc969a --- /dev/null +++ b/srcpkgs/mlir18-devel @@ -0,0 +1 @@ +llvm18 \ No newline at end of file