Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: llvm18
@ 2024-02-11 22:16 Calandracas606
  2024-02-12  2:16 ` [PR PATCH] [Updated] " Calandracas606
                   ` (34 more replies)
  0 siblings, 35 replies; 36+ messages in thread
From: Calandracas606 @ 2024-02-11 22:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]

There is a new pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 78028 bytes --]

From b85d9c87e61b314a9e2d16149c8b1a76fdc89cba Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 1/4] New package: llvm18-18.1.0

---
 srcpkgs/clang-analyzer18                      |   1 +
 srcpkgs/clang18                               |   1 +
 srcpkgs/flang-devel18                         |   1 +
 srcpkgs/flang18                               |   1 +
 srcpkgs/libclang-cpp18                        |   1 +
 srcpkgs/libclang18                            |   1 +
 srcpkgs/libcxx-devel18                        |   1 +
 srcpkgs/libcxx18                              |   1 +
 srcpkgs/libcxxabi-devel18                     |   1 +
 srcpkgs/libcxxabi18                           |   1 +
 srcpkgs/libllvm18                             |   1 +
 srcpkgs/lld-devel18                           |   1 +
 srcpkgs/lld18                                 |   1 +
 srcpkgs/lldb-devel18                          |   1 +
 srcpkgs/lldb18                                |   1 +
 srcpkgs/llvm-bolt18                           |   1 +
 srcpkgs/llvm-libunwind-devel18                |   1 +
 srcpkgs/llvm-libunwind18                      |   1 +
 .../llvm18/files/llvm-Config-llvm-config.h    |   9 +
 srcpkgs/llvm18/patches/SmallVector.patch      |  13 +
 ...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/template                       | 717 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 37 files changed, 1211 insertions(+)
 create mode 120000 srcpkgs/clang-analyzer18
 create mode 120000 srcpkgs/clang18
 create mode 120000 srcpkgs/flang-devel18
 create mode 120000 srcpkgs/flang18
 create mode 120000 srcpkgs/libclang-cpp18
 create mode 120000 srcpkgs/libclang18
 create mode 120000 srcpkgs/libcxx-devel18
 create mode 120000 srcpkgs/libcxx18
 create mode 120000 srcpkgs/libcxxabi-devel18
 create mode 120000 srcpkgs/libcxxabi18
 create mode 120000 srcpkgs/libllvm18
 create mode 120000 srcpkgs/lld-devel18
 create mode 120000 srcpkgs/lld18
 create mode 120000 srcpkgs/lldb-devel18
 create mode 120000 srcpkgs/lldb18
 create mode 120000 srcpkgs/llvm-bolt18
 create mode 120000 srcpkgs/llvm-libunwind-devel18
 create mode 120000 srcpkgs/llvm-libunwind18
 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/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/template
 create mode 100644 srcpkgs/llvm18/update
 create mode 120000 srcpkgs/mlir18

diff --git a/srcpkgs/clang-analyzer18 b/srcpkgs/clang-analyzer18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/clang-analyzer18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/clang18 b/srcpkgs/clang18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/clang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/flang-devel18 b/srcpkgs/flang-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/flang-devel18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/flang18 b/srcpkgs/flang18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/flang18
@@ -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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel18 b/srcpkgs/libcxx-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libcxx-devel18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx18 b/srcpkgs/libcxx18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libcxx18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel18 b/srcpkgs/libcxxabi-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libcxxabi-devel18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi18 b/srcpkgs/libcxxabi18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libcxxabi18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libllvm18 b/srcpkgs/libllvm18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/lld18
@@ -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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/lldb18
@@ -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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/llvm-bolt18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel18 b/srcpkgs/llvm-libunwind-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/llvm-libunwind18
@@ -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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` to make "
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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..aef0bf773d6be0
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,717 @@
+# Template file for 'llvm17'
+pkgname=llvm17
+version=17.0.6
+revision=2
+build_wrksrc=llvm
+build_style=cmake
+_ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
+pycompile_dirs="usr/share/scan-view"
+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
+ -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/clang17
+ -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 "
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel "
+short_desc="LLVM Compiler Infrastructure Project - Version 17"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
+checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+lib32disabled=yes
+python_version=3
+
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+esac
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+subpackages="libllvm17 llvm17-doc llvm17-devel"
+_enabled_projects=
+_enabled_runtimes=
+
+if [ "$build_option_clang" ]; then
+	_enabled_projects+="clang;"
+	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+fi
+if [ "$build_option_clang_tools_extra" ]; then
+	_enabled_projects+="clang-tools-extra;"
+	subpackages+=" clang-tools-extra17 "
+fi
+if [ "$build_option_bolt" ]; then
+	_enabled_projects+="bolt;"
+	subpackages+=" llvm-bolt17 "
+fi
+if [ "$build_option_polly" ]; then
+	_enabled_projects+="polly;"
+fi
+if [ "$build_option_lldb" ]; then
+	_enabled_projects+="lldb;"
+	subpackages+=" lldb17 lldb17-devel "
+fi
+if [ "$build_option_lld" ]; then
+	_enabled_projects+="lld;"
+	subpackages+=" lld17 lld17-devel "
+fi
+if [ "$build_option_libclc" ]; then
+	_enabled_projects+="libclc;"
+fi
+if [ "$build_option_mlir" ]; then
+	_enabled_projects+="mlir;"
+	subpackages+=" mlir17 mlir17-devel "
+fi
+if [ "$build_option_flang" ]; then
+	_enabled_projects+="flang;"
+	subpackages+=" flang17 flang17-devel "
+fi
+
+# enable if runtime subpackages link to this version of llvm
+if true; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*|aarch64*)
+			# openmp fails when built as runtime if cross-compiled
+			if [ "$CROSS_BUILD" ]; then
+				_enabled_projects+="openmp;"
+			else
+				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+			fi
+			subpackages+=" libomp libomp-devel "
+			;;
+	esac
+
+	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+fi
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm17-cross-tools"
+	# Seems to require a full host llvm/clang build
+	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+fi
+
+
+# For OCaml bindings and lldb lua scripting
+if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm17-cross-tools"
+	# 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" ]; 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
+}
+
+clang17_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/clang-17
+		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/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/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
+	}
+}
+
+clang17-headers_package() {
+	lib32disabled=yes
+	short_desc+=" - C language family frontend - Headers"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/include
+	}
+}
+
+clang17-devel_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
+	 llvm17>=${version}_${revision}"
+	if [ "$build_option_clang_tools_extra" ]; then
+		depends+=" clang-tools-extra17>=${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
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
+		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
+	}
+}
+
+libclang17_package() {
+	depends="clang17-headers>=${version}_${revision}"
+	short_desc+=" - C frontend library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp17_package() {
+	depends="clang17-headers>=${version}_${revision}"
+	short_desc+=" - C frontend library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+clang-analyzer17_package() {
+	depends="clang17>=${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	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-extra17_package() {
+	lib32disabled=yes
+	depends="clang17>=${version}_${revision} python3"
+	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-bolt17_package() {
+	lib32disabled=yes
+	short_desc+=" - post-link optimizer"
+	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
+	depends="clang17>=${version}_${revision}"
+	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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+lldb17_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	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-vscode
+		vmove "usr/lib/liblldb*.so.*"
+		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
+		if [ -z "$CROSS_BUILD" ]; then
+			vmove /usr/lib/lua/5.3/lldb.so
+		fi
+	}
+}
+
+lldb17-devel_package() {
+	lib32disabled=yes
+	depends="lldb17>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+lld17_package() {
+	lib32disabled=yes
+	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
+	}
+}
+
+lld17-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*.a"
+	}
+}
+
+mlir17_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.*"
+	}
+}
+
+mlir17-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - multi-level IR compiler framework - development files"
+	homepage="https://mlir.llvm.org/"
+	depends="mlir17>=${version}_${revision} llvm17>=${version}_${revision}"
+	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
+	}
+}
+
+flang17_package() {
+	lib32disabled=yes
+	short_desc+=" - Fortran language frontend"
+	homepage="https://flang.llvm.org/"
+	depends="mlir17>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/flang-new
+		vmove usr/bin/flang-to-external-fc
+	}
+}
+
+flang17-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - Fortran language frontend - development files"
+	homepage="https://flang.llvm.org/"
+	depends="flang17>=${version}_${revision} llvm17>=${version}_${revision}"
+	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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/llvm-omp-device-info
+		vmove usr/bin/llvm-omp-kernel-replay
+		vmove "usr/lib/libarcher*.so"
+		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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libarcher*.a"
+			vmove "usr/lib/libomp*.a"
+		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-rt_package() {
+	short_desc+=" - runtime libraries"
+	homepage="https://compiler-rt.llvm.org/"
+	pkg_install() {
+		vmove usr/lib/clang/17/lib
+		if [ -d "${DESTDIR}/usr/lib/clang/17/bin" ]; then
+			vmove usr/lib/clang/17/bin
+		fi
+		if [ -d "${DESTDIR}/usr/lib/clang/17/share" ]; then
+			vmove usr/lib/clang/17/share
+		fi
+	}
+}
+
+libllvm17_package() {
+	short_desc+=" - library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
+
+llvm17-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove usr/share/doc
+	}
+}
+
+llvm17-devel_package() {
+	short_desc+=" - development files"
+	depends="llvm17>=${version}_${revision}"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-devel>=${version}_${revision} "
+	fi
+	if [ "$build_option_mlir" ]; then
+		depends+=" mlir17-devel>=${version}_${revision} "
+	fi
+	if [ "$build_option_clang" ]; then
+		depends+=" clang17-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
+llvm17-cross-tools_package() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb17-devel>=${version}_${revision} llvm17-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 00000000000000..e95cf26b3586b7
--- /dev/null
+++ b/srcpkgs/llvm18/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"
diff --git a/srcpkgs/mlir18 b/srcpkgs/mlir18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From 528797d12e58a315cdef1e80516210c7adcbc455 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 2/4] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..533e06490df65f
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,22 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+#archs="i686 x86_64"
+#build_wrksrc=
+build_style=python3-pep517
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="python3-flit_core"
+makedepends=""
+depends=""
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+#changelog=""
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a

From 09f7893bd633d8f4e206fa731bd85be1d7bade30 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 3/4] New package: python3-myst-parser-2.0.0

---
 srcpkgs/python3-myst-parser/template | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 srcpkgs/python3-myst-parser/template

diff --git a/srcpkgs/python3-myst-parser/template b/srcpkgs/python3-myst-parser/template
new file mode 100644
index 00000000000000..d5576b8b201493
--- /dev/null
+++ b/srcpkgs/python3-myst-parser/template
@@ -0,0 +1,22 @@
+# Template file for 'python3-myst-parser'
+pkgname=python3-myst-parser
+version=2.0.0
+revision=1
+#archs="i686 x86_64"
+#build_wrksrc=
+build_style=python3-pep517
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="python3-flit_core"
+makedepends=""
+depends=""
+short_desc="A Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+#changelog=""
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579

From 3ad71ee2563a707d1030b6d31c6739af9d644fe7 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:13:32 -0500
Subject: [PATCH 4/4] fixup llvm18

---
 common/shlibs                                 |   3 +
 .../{flang-devel18 => clang-tools-extra18}    |   0
 srcpkgs/{libcxx-devel18 => clang18-devel}     |   0
 srcpkgs/{libcxx18 => clang18-headers}         |   0
 srcpkgs/compiler-rt                           |   2 +-
 srcpkgs/{libcxxabi-devel18 => flang18-devel}  |   0
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/{libcxxabi18 => lld18-devel}          |   0
 srcpkgs/lldb18-devel                          |   1 +
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 srcpkgs/llvm18-cross-tools                    |   1 +
 srcpkgs/llvm18-devel                          |   1 +
 srcpkgs/llvm18-doc                            |   1 +
 srcpkgs/llvm18/patches/openmp-stdint.patch    |  12 ++
 srcpkgs/llvm18/template                       | 131 +++++++++---------
 srcpkgs/mlir18-devel                          |   1 +
 22 files changed, 95 insertions(+), 74 deletions(-)
 rename srcpkgs/{flang-devel18 => clang-tools-extra18} (100%)
 rename srcpkgs/{libcxx-devel18 => clang18-devel} (100%)
 rename srcpkgs/{libcxx18 => clang18-headers} (100%)
 rename srcpkgs/{libcxxabi-devel18 => flang18-devel} (100%)
 rename srcpkgs/{libcxxabi18 => lld18-devel} (100%)
 create mode 120000 srcpkgs/lldb18-devel
 create mode 120000 srcpkgs/llvm18-cross-tools
 create mode 120000 srcpkgs/llvm18-devel
 create mode 120000 srcpkgs/llvm18-doc
 create mode 100644 srcpkgs/llvm18/patches/openmp-stdint.patch
 create mode 120000 srcpkgs/mlir18-devel

diff --git a/common/shlibs b/common/shlibs
index 93fb4b26087297..7212909d08250f 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -982,10 +982,13 @@ 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.18rc lldb18-18.1.0_1
 liblldb.so.17 lldb17-17.0.6_1
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18rc libclang18-18.1.0_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18rc libclang-cpp18-17.1.0_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
diff --git a/srcpkgs/flang-devel18 b/srcpkgs/clang-tools-extra18
similarity index 100%
rename from srcpkgs/flang-devel18
rename to srcpkgs/clang-tools-extra18
diff --git a/srcpkgs/libcxx-devel18 b/srcpkgs/clang18-devel
similarity index 100%
rename from srcpkgs/libcxx-devel18
rename to srcpkgs/clang18-devel
diff --git a/srcpkgs/libcxx18 b/srcpkgs/clang18-headers
similarity index 100%
rename from srcpkgs/libcxx18
rename to srcpkgs/clang18-headers
diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 96970d5c02c13a..1f418dc969a832 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/libcxxabi-devel18 b/srcpkgs/flang18-devel
similarity index 100%
rename from srcpkgs/libcxxabi-devel18
rename to srcpkgs/flang18-devel
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi18 b/srcpkgs/lld18-devel
similarity index 100%
rename from srcpkgs/libcxxabi18
rename to srcpkgs/lld18-devel
diff --git a/srcpkgs/lldb18-devel b/srcpkgs/lldb18-devel
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/lldb18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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/llvm18-cross-tools b/srcpkgs/llvm18-cross-tools
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/llvm18-doc
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/llvm18/patches/openmp-stdint.patch b/srcpkgs/llvm18/patches/openmp-stdint.patch
new file mode 100644
index 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
index aef0bf773d6be0..3b1434715fed9b 100644
--- a/srcpkgs/llvm18/template
+++ b/srcpkgs/llvm18/template
@@ -1,7 +1,7 @@
-# Template file for 'llvm17'
-pkgname=llvm17
-version=17.0.6
-revision=2
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.0
+revision=1
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -24,7 +24,7 @@ configure_args="
  -DLLVM_BUILD_LLVM_DYLIB=YES
  -DLLVM_LINK_LLVM_DYLIB=YES
  -DCLANG_LINK_CLANG_DYLIB=YES
- -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang17
+ -DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang18
  -DLLVM_ENABLE_RTTI=YES
  -DLLVM_ENABLE_FFI=YES
  -DLLVM_BINUTILS_INCDIR=/usr/include
@@ -33,15 +33,16 @@ configure_args="
  -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-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 "
-short_desc="LLVM Compiler Infrastructure Project - Version 17"
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
 maintainer="Daniel Martinez <danielmartinez@cock.li>"
 license="Apache-2.0"
 homepage="https://www.llvm.org"
-distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
-checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-18.1.0-rc2.tar.gz"
+checksum=a5c9640f47c8d80ccf23d3ee06a3090be4f70763e768e1e65fd20c131d1aa5f6
 lib32disabled=yes
 python_version=3
 
@@ -57,43 +58,43 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
 fi
 
-subpackages="libllvm17 llvm17-doc llvm17-devel"
+subpackages="libllvm18 llvm18-doc llvm18-devel"
 _enabled_projects=
 _enabled_runtimes=
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
-	subpackages+=" clang17 clang17-headers clang17-devel libclang17 libclang-cpp17 clang-analyzer17 "
+	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-extra17 "
+	subpackages+=" clang-tools-extra18 "
 fi
 if [ "$build_option_bolt" ]; then
 	_enabled_projects+="bolt;"
-	subpackages+=" llvm-bolt17 "
+	subpackages+=" llvm-bolt18 "
 fi
 if [ "$build_option_polly" ]; then
 	_enabled_projects+="polly;"
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb18 lldb18-devel "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
-	subpackages+=" lld17 lld17-devel "
+	subpackages+=" lld18 lld18-devel "
 fi
 if [ "$build_option_libclc" ]; then
 	_enabled_projects+="libclc;"
 fi
 if [ "$build_option_mlir" ]; then
 	_enabled_projects+="mlir;"
-	subpackages+=" mlir17 mlir17-devel "
+	subpackages+=" mlir18 mlir18-devel "
 fi
 if [ "$build_option_flang" ]; then
 	_enabled_projects+="flang;"
-	subpackages+=" flang17 flang17-devel "
+	subpackages+=" flang18 flang18-devel "
 fi
 
 # enable if runtime subpackages link to this version of llvm
@@ -125,7 +126,7 @@ fi
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" llvm17-cross-tools"
+	hostmakedepends+=" llvm18-cross-tools"
 	# Seems to require a full host llvm/clang build
 	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
 	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
@@ -134,7 +135,7 @@ fi
 
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
-	subpackages+=" llvm17-cross-tools"
+	subpackages+=" llvm18-cross-tools"
 	# OCaml cross build is broken
 	hostmakedepends+=" ocaml ocaml-findlib "
 	# lldb cross build fails with lua
@@ -286,13 +287,13 @@ post_install() {
 	rm -rf ${DESTDIR}/usr/lib64
 }
 
-clang17_package() {
+clang18_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
-		vmove usr/bin/clang-17
+		vmove usr/bin/clang-18
 		vmove usr/bin/clang
 		vmove usr/bin/clang++
 		vmove usr/bin/clang-cl
@@ -321,22 +322,22 @@ clang17_package() {
 	}
 }
 
-clang17-headers_package() {
+clang18-headers_package() {
 	lib32disabled=yes
 	short_desc+=" - C language family frontend - Headers"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
-		vmove usr/lib/clang/17/include
+		vmove usr/lib/clang/18/include
 	}
 }
 
-clang17-devel_package() {
+clang18-devel_package() {
 	lib32disabled=yes
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
-	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
-	 llvm17>=${version}_${revision}"
+	 clang18>=${version}_${revision} clang-analyzer18>=${version}_${revision}
+	 llvm18>=${version}_${revision}"
 	if [ "$build_option_clang_tools_extra" ]; then
-		depends+=" clang-tools-extra17>=${version}_${revision}"
+		depends+=" clang-tools-extra18>=${version}_${revision}"
 	fi
 	short_desc+=" - C language family frontend - development Files"
 	homepage="https://clang.llvm.org/"
@@ -362,24 +363,24 @@ clang17-devel_package() {
 	}
 }
 
-libclang17_package() {
-	depends="clang17-headers>=${version}_${revision}"
+libclang18_package() {
+	depends="clang18-headers>=${version}_${revision}"
 	short_desc+=" - C frontend library"
 	pkg_install() {
 		vmove "usr/lib/libclang.so.*"
 	}
 }
 
-libclang-cpp17_package() {
-	depends="clang17-headers>=${version}_${revision}"
+libclang-cpp18_package() {
+	depends="clang18-headers>=${version}_${revision}"
 	short_desc+=" - C frontend library (C++ interface)"
 	pkg_install() {
 		vmove "usr/lib/libclang-cpp.so.*"
 	}
 }
 
-clang-analyzer17_package() {
-	depends="clang17>=${version}_${revision} python3 perl"
+clang-analyzer18_package() {
+	depends="clang18>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
 	pkg_install() {
@@ -400,9 +401,9 @@ clang-analyzer17_package() {
 	}
 }
 
-clang-tools-extra17_package() {
+clang-tools-extra18_package() {
 	lib32disabled=yes
-	depends="clang17>=${version}_${revision} python3"
+	depends="clang18>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
 	pkg_install() {
@@ -426,11 +427,11 @@ clang-tools-extra17_package() {
 }
 
 # "bolt" package name is already used
-llvm-bolt17_package() {
+llvm-bolt18_package() {
 	lib32disabled=yes
 	short_desc+=" - post-link optimizer"
 	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
-	depends="clang17>=${version}_${revision}"
+	depends="clang18>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-bolt
 		vmove usr/bin/perf2bolt
@@ -445,7 +446,7 @@ llvm-bolt17_package() {
 	}
 }
 
-lldb17_package() {
+lldb18_package() {
 	lib32disabled=yes
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
@@ -455,7 +456,7 @@ lldb17_package() {
 		vmove usr/bin/lldb-argdumper
 		vmove usr/bin/lldb-instr
 		vmove usr/bin/lldb-server
-		vmove usr/bin/lldb-vscode
+		move usr/bin/lldb-dap
 		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
@@ -464,9 +465,9 @@ lldb17_package() {
 	}
 }
 
-lldb17-devel_package() {
+lldb18-devel_package() {
 	lib32disabled=yes
-	depends="lldb17>=${version}_${revision}"
+	depends="lldb18>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
 	pkg_install() {
 		vmove usr/include/lldb
@@ -474,7 +475,7 @@ lldb17-devel_package() {
 	}
 }
 
-lld17_package() {
+lld18_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
@@ -487,11 +488,11 @@ lld17_package() {
 	}
 }
 
-lld17-devel_package() {
+lld18-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
-	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	depends="lld18>=${version}_${revision} llvm18>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -499,7 +500,7 @@ lld17-devel_package() {
 	}
 }
 
-mlir17_package() {
+mlir18_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework"
 	homepage="https://mlir.llvm.org/"
@@ -509,11 +510,11 @@ mlir17_package() {
 	}
 }
 
-mlir17-devel_package() {
+mlir18-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - multi-level IR compiler framework - development files"
 	homepage="https://mlir.llvm.org/"
-	depends="mlir17>=${version}_${revision} llvm17>=${version}_${revision}"
+	depends="mlir18>=${version}_${revision} llvm18>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/mlir-cpu-runner
 		vmove usr/bin/mlir-linalg-ods-yaml-gen
@@ -535,22 +536,22 @@ mlir17-devel_package() {
 	}
 }
 
-flang17_package() {
+flang18_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend"
 	homepage="https://flang.llvm.org/"
-	depends="mlir17>=${version}_${revision}"
+	depends="mlir18>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/flang-new
 		vmove usr/bin/flang-to-external-fc
 	}
 }
 
-flang17-devel_package() {
+flang18-devel_package() {
 	lib32disabled=yes
 	short_desc+=" - Fortran language frontend - development files"
 	homepage="https://flang.llvm.org/"
-	depends="flang17>=${version}_${revision} llvm17>=${version}_${revision}"
+	depends="flang18>=${version}_${revision} llvm18>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/bbc
 		vmove usr/bin/f18-parse-demo
@@ -574,7 +575,7 @@ libomp_package() {
 
 libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/llvm-omp-device-info
 		vmove usr/bin/llvm-omp-kernel-replay
@@ -658,41 +659,41 @@ compiler-rt_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
-		vmove usr/lib/clang/17/lib
-		if [ -d "${DESTDIR}/usr/lib/clang/17/bin" ]; then
-			vmove usr/lib/clang/17/bin
+		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/17/share" ]; then
-			vmove usr/lib/clang/17/share
+		if [ -d "${DESTDIR}/usr/lib/clang/18/share" ]; then
+			vmove usr/lib/clang/18/share
 		fi
 	}
 }
 
-libllvm17_package() {
+libllvm18_package() {
 	short_desc+=" - library"
 	pkg_install() {
 		vmove "usr/lib/libLLVM-*.so*"
 	}
 }
 
-llvm17-doc_package() {
+llvm18-doc_package() {
 	short_desc+=" - documentation"
 	pkg_install() {
 		vmove usr/share/doc
 	}
 }
 
-llvm17-devel_package() {
+llvm18-devel_package() {
 	short_desc+=" - development files"
-	depends="llvm17>=${version}_${revision}"
+	depends="llvm18>=${version}_${revision}"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
-		depends+=" mlir17-devel>=${version}_${revision} "
+		depends+=" mlir18-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_clang" ]; then
-		depends+=" clang17-devel>=${version}_${revision} "
+		depends+=" clang18-devel>=${version}_${revision} "
 	fi
 	pkg_install() {
 		vmove usr/lib/libLLVM.so
@@ -706,9 +707,9 @@ llvm17-devel_package() {
 }
 
 # These binaries are ONLY used when building llvm, they aren't normally installed
-llvm17-cross-tools_package() {
+llvm18-cross-tools_package() {
 	short_desc+=" - build tools for cross compiling LLVM"
-	depends="lldb17-devel>=${version}_${revision} llvm17-devel>=${version}_${revision}"
+	depends="lldb18-devel>=${version}_${revision} llvm18-devel>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/bin/lldb-tblgen
 		vmove usr/bin/clang-tidy-confusable-chars-gen
diff --git a/srcpkgs/mlir18-devel b/srcpkgs/mlir18-devel
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
@ 2024-02-12  2:16 ` Calandracas606
  2024-02-12  3:02 ` Calandracas606
                   ` (33 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-02-12  2:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 63926 bytes --]

From 5b2324c20259291c11c2600cf7253f796395fd21 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 1/3] New package: llvm18-18.1.0

---
 common/shlibs                                 |   3 +
 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/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/libllvm18                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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 +
 ...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                       | 719 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 53 files changed, 1242 insertions(+), 9 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/flang18
 create mode 120000 srcpkgs/flang18-devel
 create mode 120000 srcpkgs/libclang-cpp18
 create mode 120000 srcpkgs/libclang18
 create mode 120000 srcpkgs/libllvm18
 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/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 93fb4b2608729..7212909d08250 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -982,10 +982,13 @@ 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.18rc lldb18-18.1.0_1
 liblldb.so.17 lldb17-17.0.6_1
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18rc libclang18-18.1.0_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18rc libclang-cpp18-17.1.0_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
diff --git a/srcpkgs/clang-analyzer18 b/srcpkgs/clang-analyzer18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 96970d5c02c13..1f418dc969a83 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/flang18 b/srcpkgs/flang18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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/libllvm18 b/srcpkgs/libllvm18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13..1f418dc969a83 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13..1f418dc969a83 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..2fa08c9be6962
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 0000000000000..ac10d306c4346
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` to make "
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 0000000000000..e4eaa7783e7a6
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 0000000000000..0ef4c7e75d6b5
--- /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 0000000000000..4ad6412d1e6c6
--- /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 0000000000000..3aed07b856940
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 0000000000000..c9b9286ac37b3
--- /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 0000000000000..700ab13479045
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 0000000000000..0dd5f0e7eb8a8
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 0000000000000..70292beb2fcdb
--- /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 0000000000000..e872d263de30f
--- /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 0000000000000..9a622cd9254c2
--- /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 0000000000000..8652e4af69f7c
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 0000000000000..51d0e4b31b32c
--- /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 0000000000000..d332687b9d929
--- /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 <samuel@sholland.org>
+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 0000000000000..192b4824b8695
--- /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 0000000000000..57e73521df869
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 0000000000000..0a850e041c44a
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,719 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.0
+revision=1
+build_wrksrc=llvm
+build_style=cmake
+_ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
+pycompile_dirs="usr/share/scan-view"
+configure_args="
+ -DCMAKE_BUILD_TYPE=Release -Wno-dev
+ -DLLVM_ENABLE_LTO=On
+ -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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-18.1.0-rc2.tar.gz"
+checksum=a5c9640f47c8d80ccf23d3ee06a3090be4f70763e768e1e65fd20c131d1aa5f6
+lib32disabled=yes
+python_version=3
+
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+esac
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+subpackages="libllvm18 llvm18-doc llvm18-devel"
+_enabled_projects=
+_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 "
+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
+
+# enable if runtime subpackages link to this version of llvm
+if true; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*|aarch64*)
+			# openmp fails when built as runtime if cross-compiled
+			if [ "$CROSS_BUILD" ]; then
+				_enabled_projects+="openmp;"
+			else
+				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+			fi
+			subpackages+=" libomp libomp-devel "
+			;;
+	esac
+
+	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+fi
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm18-cross-tools"
+	# Seems to require a full host llvm/clang build
+	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+fi
+
+
+# For OCaml bindings and lldb lua scripting
+if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm18-cross-tools"
+	# 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" ]; 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"
+	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/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/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}"
+	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
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
+		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"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	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"
+	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
+	short_desc+=" - post-link optimizer"
+	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
+	depends="clang18>=${version}_${revision}"
+	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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+lldb18_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	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/liblldb*.so.*"
+		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}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+lld18_package() {
+	lib32disabled=yes
+	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
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - multi-level IR compiler framework - development files"
+	homepage="https://mlir.llvm.org/"
+	depends="mlir18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - Fortran language frontend"
+	homepage="https://flang.llvm.org/"
+	depends="mlir18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/flang-new
+		vmove usr/bin/flang-to-external-fc
+	}
+}
+
+flang18-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - Fortran language frontend - development files"
+	homepage="https://flang.llvm.org/"
+	depends="flang18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/llvm-omp-device-info
+		vmove usr/bin/llvm-omp-kernel-replay
+		vmove "usr/lib/libarcher*.so"
+		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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libarcher*.a"
+			vmove "usr/lib/libomp*.a"
+		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-rt_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*"
+	}
+}
+
+llvm18-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove usr/share/doc
+	}
+}
+
+llvm18-devel_package() {
+	short_desc+=" - development files"
+	depends="llvm18>=${version}_${revision}"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-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() {
+	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 0000000000000..e95cf26b3586b
--- /dev/null
+++ b/srcpkgs/llvm18/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"
diff --git a/srcpkgs/mlir18 b/srcpkgs/mlir18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From 4f73b8b2c8841b085695c3b7539af3a6e06f6ce0 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 2/3] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 0000000000000..533e06490df65
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,22 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+#archs="i686 x86_64"
+#build_wrksrc=
+build_style=python3-pep517
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="python3-flit_core"
+makedepends=""
+depends=""
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+#changelog=""
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a

From 5edd2bd882a1f3bf88b67c941abd156646246f27 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 3/3] New package: python3-myst-parser-2.0.0

---
 srcpkgs/python3-myst-parser/template | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 srcpkgs/python3-myst-parser/template

diff --git a/srcpkgs/python3-myst-parser/template b/srcpkgs/python3-myst-parser/template
new file mode 100644
index 0000000000000..d5576b8b20149
--- /dev/null
+++ b/srcpkgs/python3-myst-parser/template
@@ -0,0 +1,22 @@
+# Template file for 'python3-myst-parser'
+pkgname=python3-myst-parser
+version=2.0.0
+revision=1
+#archs="i686 x86_64"
+#build_wrksrc=
+build_style=python3-pep517
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="python3-flit_core"
+makedepends=""
+depends=""
+short_desc="A Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+#changelog=""
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
  2024-02-12  2:16 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-02-12  3:02 ` Calandracas606
  2024-02-12  3:18 ` Calandracas606
                   ` (32 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-02-12  3:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 64002 bytes --]

From 9eaee25a7f664fdc068bd104c9de8055d4e103c9 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 1/3] New package: llvm18-18.1.0

---
 common/shlibs                                 |   3 +
 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/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/libllvm18                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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 +
 ...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                       | 723 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 53 files changed, 1246 insertions(+), 9 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/flang18
 create mode 120000 srcpkgs/flang18-devel
 create mode 120000 srcpkgs/libclang-cpp18
 create mode 120000 srcpkgs/libclang18
 create mode 120000 srcpkgs/libllvm18
 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/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 93fb4b2608729..7212909d08250 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -982,10 +982,13 @@ 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.18rc lldb18-18.1.0_1
 liblldb.so.17 lldb17-17.0.6_1
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18rc libclang18-18.1.0_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18rc libclang-cpp18-17.1.0_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
diff --git a/srcpkgs/clang-analyzer18 b/srcpkgs/clang-analyzer18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 96970d5c02c13..1f418dc969a83 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/flang18 b/srcpkgs/flang18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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/libllvm18 b/srcpkgs/libllvm18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13..1f418dc969a83 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13..1f418dc969a83 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..2fa08c9be6962
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 0000000000000..ac10d306c4346
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` to make "
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 0000000000000..e4eaa7783e7a6
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 0000000000000..0ef4c7e75d6b5
--- /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 0000000000000..4ad6412d1e6c6
--- /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 0000000000000..3aed07b856940
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 0000000000000..c9b9286ac37b3
--- /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 0000000000000..700ab13479045
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 0000000000000..0dd5f0e7eb8a8
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 0000000000000..70292beb2fcdb
--- /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 0000000000000..e872d263de30f
--- /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 0000000000000..9a622cd9254c2
--- /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 0000000000000..8652e4af69f7c
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 0000000000000..51d0e4b31b32c
--- /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 0000000000000..d332687b9d929
--- /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 <samuel@sholland.org>
+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 0000000000000..192b4824b8695
--- /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 0000000000000..57e73521df869
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 0000000000000..c74fbda6cf216
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,723 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.0
+revision=1
+build_wrksrc=llvm
+build_style=cmake
+_ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
+pycompile_dirs="usr/share/scan-view"
+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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-18.1.0-rc2.tar.gz"
+checksum=a5c9640f47c8d80ccf23d3ee06a3090be4f70763e768e1e65fd20c131d1aa5f6
+lib32disabled=yes
+python_version=3
+
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt lto"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb lto"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+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"
+
+_enabled_projects=$(:)
+_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 "
+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
+
+# enable if runtime subpackages link to this version of llvm
+if true; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*|aarch64*)
+			# openmp fails when built as runtime if cross-compiled
+			if [ "$CROSS_BUILD" ]; then
+				_enabled_projects+="openmp;"
+			else
+				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+			fi
+			subpackages+=" libomp libomp-devel "
+			;;
+	esac
+
+	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+fi
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm18-cross-tools"
+	# Seems to require a full host llvm/clang build
+	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+fi
+
+
+# For OCaml bindings and lldb lua scripting
+if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm18-cross-tools"
+	# 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" ]; 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"
+	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/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/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}"
+	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
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
+		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"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	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"
+	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
+	short_desc+=" - post-link optimizer"
+	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
+	depends="clang18>=${version}_${revision}"
+	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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+lldb18_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	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/liblldb*.so.*"
+		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}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+lld18_package() {
+	lib32disabled=yes
+	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
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - multi-level IR compiler framework - development files"
+	homepage="https://mlir.llvm.org/"
+	depends="mlir18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - Fortran language frontend"
+	homepage="https://flang.llvm.org/"
+	depends="mlir18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/flang-new
+		vmove usr/bin/flang-to-external-fc
+	}
+}
+
+flang18-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - Fortran language frontend - development files"
+	homepage="https://flang.llvm.org/"
+	depends="flang18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/llvm-omp-device-info
+		vmove usr/bin/llvm-omp-kernel-replay
+		vmove "usr/lib/libarcher*.so"
+		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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libarcher*.a"
+			vmove "usr/lib/libomp*.a"
+		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-rt_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*"
+	}
+}
+
+llvm18-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove usr/share/doc
+	}
+}
+
+llvm18-devel_package() {
+	short_desc+=" - development files"
+	depends="llvm18>=${version}_${revision}"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-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() {
+	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 0000000000000..e95cf26b3586b
--- /dev/null
+++ b/srcpkgs/llvm18/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"
diff --git a/srcpkgs/mlir18 b/srcpkgs/mlir18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From b9496c5fff66a85477d37168b9d877f8160b56da Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 2/3] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 0000000000000..533e06490df65
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,22 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+#archs="i686 x86_64"
+#build_wrksrc=
+build_style=python3-pep517
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="python3-flit_core"
+makedepends=""
+depends=""
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+#changelog=""
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a

From d0bf53cd93eefbe4710105420b7a855c742ac228 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 3/3] New package: python3-myst-parser-2.0.0

---
 srcpkgs/python3-myst-parser/template | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 srcpkgs/python3-myst-parser/template

diff --git a/srcpkgs/python3-myst-parser/template b/srcpkgs/python3-myst-parser/template
new file mode 100644
index 0000000000000..d5576b8b20149
--- /dev/null
+++ b/srcpkgs/python3-myst-parser/template
@@ -0,0 +1,22 @@
+# Template file for 'python3-myst-parser'
+pkgname=python3-myst-parser
+version=2.0.0
+revision=1
+#archs="i686 x86_64"
+#build_wrksrc=
+build_style=python3-pep517
+#configure_args=""
+#make_build_args=""
+#make_install_args=""
+#conf_files=""
+#make_dirs="/var/log/dir 0755 root root"
+hostmakedepends="python3-flit_core"
+makedepends=""
+depends=""
+short_desc="A Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+#changelog=""
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
  2024-02-12  2:16 ` [PR PATCH] [Updated] " Calandracas606
  2024-02-12  3:02 ` Calandracas606
@ 2024-02-12  3:18 ` Calandracas606
  2024-02-12 15:56 ` Calandracas606
                   ` (31 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-02-12  3:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 63872 bytes --]

From aa783557f903314c35b49dd28cf01edec33ae967 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 1/3] New package: llvm18-18.1.0

---
 common/shlibs                                 |   3 +
 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/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/libllvm18                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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 +
 ...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                       | 723 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 53 files changed, 1246 insertions(+), 9 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/flang18
 create mode 120000 srcpkgs/flang18-devel
 create mode 120000 srcpkgs/libclang-cpp18
 create mode 120000 srcpkgs/libclang18
 create mode 120000 srcpkgs/libllvm18
 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/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 93fb4b2608729..7212909d08250 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -982,10 +982,13 @@ 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.18rc lldb18-18.1.0_1
 liblldb.so.17 lldb17-17.0.6_1
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18rc libclang18-18.1.0_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18rc libclang-cpp18-17.1.0_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
diff --git a/srcpkgs/clang-analyzer18 b/srcpkgs/clang-analyzer18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 96970d5c02c13..1f418dc969a83 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/flang18 b/srcpkgs/flang18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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/libllvm18 b/srcpkgs/libllvm18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13..1f418dc969a83 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13..1f418dc969a83 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..2fa08c9be6962
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 0000000000000..ac10d306c4346
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` to make "
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 0000000000000..e4eaa7783e7a6
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 0000000000000..0ef4c7e75d6b5
--- /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 0000000000000..4ad6412d1e6c6
--- /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 0000000000000..3aed07b856940
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 0000000000000..c9b9286ac37b3
--- /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 0000000000000..700ab13479045
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 0000000000000..0dd5f0e7eb8a8
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 0000000000000..70292beb2fcdb
--- /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 0000000000000..e872d263de30f
--- /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 0000000000000..9a622cd9254c2
--- /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 0000000000000..8652e4af69f7c
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 0000000000000..51d0e4b31b32c
--- /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 0000000000000..d332687b9d929
--- /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 <samuel@sholland.org>
+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 0000000000000..192b4824b8695
--- /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 0000000000000..57e73521df869
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 0000000000000..76b0e1d825dd2
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,723 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.0
+revision=1
+build_wrksrc=llvm
+build_style=cmake
+_ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
+pycompile_dirs="usr/share/scan-view"
+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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-18.1.0-rc2.tar.gz"
+checksum=a5c9640f47c8d80ccf23d3ee06a3090be4f70763e768e1e65fd20c131d1aa5f6
+lib32disabled=yes
+python_version=3
+
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt lto"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb lto"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+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"
+
+_enabled_projects=$(:)
+_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 "
+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
+
+# enable if runtime subpackages link to this version of llvm
+if true; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*|aarch64*)
+			# openmp fails when built as runtime if cross-compiled
+			if [ "$CROSS_BUILD" ]; then
+				_enabled_projects+="openmp;"
+			else
+				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+			fi
+			subpackages+=" libomp libomp-devel "
+			;;
+	esac
+
+	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+fi
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm18-cross-tools"
+	# Seems to require a full host llvm/clang build
+	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+fi
+
+
+# For OCaml bindings and lldb lua scripting
+if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm18-cross-tools"
+	# 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" ]; 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"
+	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/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/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}"
+	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
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
+		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"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	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"
+	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
+	short_desc+=" - post-link optimizer"
+	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
+	depends="clang18>=${version}_${revision}"
+	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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+lldb18_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	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/liblldb*.so.*"
+		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}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+lld18_package() {
+	lib32disabled=yes
+	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
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - multi-level IR compiler framework - development files"
+	homepage="https://mlir.llvm.org/"
+	depends="mlir18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - Fortran language frontend"
+	homepage="https://flang.llvm.org/"
+	depends="mlir18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/flang-new
+		vmove usr/bin/flang-to-external-fc
+	}
+}
+
+flang18-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - Fortran language frontend - development files"
+	homepage="https://flang.llvm.org/"
+	depends="flang18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/llvm-omp-device-info
+		vmove usr/bin/llvm-omp-kernel-replay
+		vmove "usr/lib/libarcher*.so"
+		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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libarcher*.a"
+			vmove "usr/lib/libomp*.a"
+		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-rt_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*"
+	}
+}
+
+llvm18-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove usr/share/doc
+	}
+}
+
+llvm18-devel_package() {
+	short_desc+=" - development files"
+	depends="llvm18>=${version}_${revision}"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-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() {
+	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 0000000000000..e95cf26b3586b
--- /dev/null
+++ b/srcpkgs/llvm18/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"
diff --git a/srcpkgs/mlir18 b/srcpkgs/mlir18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From 4094768ea7fd3d7994a8decd17b532793c7e6a59 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 2/3] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 0000000000000..86d8855ec232b
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From b6ca7dae5dcc3d43674e041e7bef25d12ccb4185 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 3/3] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 0000000000000..aa89dcc2d5a5d
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (2 preceding siblings ...)
  2024-02-12  3:18 ` Calandracas606
@ 2024-02-12 15:56 ` Calandracas606
  2024-02-15 11:51 ` [PR REVIEW] " sgn
                   ` (30 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-02-12 15:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 68562 bytes --]

From 7e606d92d11dc5f55dc7c2a55515ec94eab18746 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 1/5] New package: llvm18-18.1.0

---
 common/shlibs                                 |   3 +
 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/libllvm18                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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 +
 ...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                       | 725 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 54 files changed, 1249 insertions(+), 9 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/libllvm18
 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/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 93fb4b2608729..245cf6ee1e485 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -982,10 +982,13 @@ 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.18rc lldb18-18.1.0_1
 liblldb.so.17 lldb17-17.0.6_1
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18rc libclang18-18.1.0_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18rc libclang-cpp18-18.1.0_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
diff --git a/srcpkgs/clang-analyzer18 b/srcpkgs/clang-analyzer18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 96970d5c02c13..1f418dc969a83 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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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/libllvm18 b/srcpkgs/libllvm18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13..1f418dc969a83 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13..1f418dc969a83 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 96970d5c02c13..1f418dc969a83 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 96970d5c02c13..1f418dc969a83 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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /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 0000000000000..2fa08c9be6962
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 0000000000000..ac10d306c4346
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` to make "
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 0000000000000..e4eaa7783e7a6
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 0000000000000..0ef4c7e75d6b5
--- /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 0000000000000..4ad6412d1e6c6
--- /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 0000000000000..3aed07b856940
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 0000000000000..c9b9286ac37b3
--- /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 0000000000000..700ab13479045
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 0000000000000..0dd5f0e7eb8a8
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 0000000000000..70292beb2fcdb
--- /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 0000000000000..e872d263de30f
--- /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 0000000000000..9a622cd9254c2
--- /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 0000000000000..8652e4af69f7c
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 0000000000000..51d0e4b31b32c
--- /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 0000000000000..d332687b9d929
--- /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 <samuel@sholland.org>
+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 0000000000000..192b4824b8695
--- /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 0000000000000..57e73521df869
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 0000000000000..15ae1c1c9d7a5
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,725 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.0
+revision=1
+build_wrksrc=llvm
+build_style=cmake
+_ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
+pycompile_dirs="usr/share/scan-view"
+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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-18.1.0-rc2.tar.gz"
+checksum=a5c9640f47c8d80ccf23d3ee06a3090be4f70763e768e1e65fd20c131d1aa5f6
+lib32disabled=yes
+python_version=3
+
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt lto"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb lto"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+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"
+
+_enabled_projects=$(:)
+_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 "
+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
+
+# enable if runtime subpackages link to this version of llvm
+if true; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt18 "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*|aarch64*)
+			# openmp fails when built as runtime if cross-compiled
+			if [ "$CROSS_BUILD" ]; then
+				_enabled_projects+="openmp;"
+			else
+				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+			fi
+			subpackages+=" libomp libomp-devel "
+			;;
+	esac
+
+	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+fi
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm18-cross-tools"
+	# Seems to require a full host llvm/clang build
+	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+fi
+
+
+# For OCaml bindings and lldb lua scripting
+if [ -z "$CROSS_BUILD" ]; then
+	subpackages+=" llvm18-cross-tools"
+	# 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" ]; 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"
+	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/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/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}"
+	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
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
+		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"
+	shlib_provides="libclang.so.18rc"
+	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"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	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"
+	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
+	short_desc+=" - post-link optimizer"
+	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
+	depends="clang18>=${version}_${revision}"
+	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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+lldb18_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	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/liblldb*.so.*"
+		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}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+lld18_package() {
+	lib32disabled=yes
+	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
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - multi-level IR compiler framework - development files"
+	homepage="https://mlir.llvm.org/"
+	depends="mlir18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - Fortran language frontend"
+	homepage="https://flang.llvm.org/"
+	depends="mlir18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/flang-new
+		vmove usr/bin/flang-to-external-fc
+	}
+}
+
+flang18-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - Fortran language frontend - development files"
+	homepage="https://flang.llvm.org/"
+	depends="flang18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/llvm-omp-device-info
+		vmove usr/bin/llvm-omp-kernel-replay
+		vmove "usr/lib/libarcher*.so"
+		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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libarcher*.a"
+			vmove "usr/lib/libomp*.a"
+		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*"
+	}
+}
+
+llvm18-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove usr/share/doc
+	}
+}
+
+llvm18-devel_package() {
+	short_desc+=" - development files"
+	depends="llvm18>=${version}_${revision}"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-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() {
+	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 0000000000000..e95cf26b3586b
--- /dev/null
+++ b/srcpkgs/llvm18/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"
diff --git a/srcpkgs/mlir18 b/srcpkgs/mlir18
new file mode 120000
index 0000000000000..1f418dc969a83
--- /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 0000000000000..1f418dc969a83
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From fbb279b27d12d44f7a48e61af5e6bcddf8b0aa55 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 2/5] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 0000000000000..86d8855ec232b
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From 073bfacc8b5b25dad9dec86c949ed1e1e6951248 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 3/5] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 0000000000000..aa89dcc2d5a5d
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From 9b8eedf597d1a02b952762a081c8fb024cb2680f Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 4/5] llvm: update to 18.

---
 srcpkgs/compiler-rt   |  2 +-
 srcpkgs/llvm/template | 10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a83..0d68131b9b308 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b90adfdd09333..89cf7cf69a1c7 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,6 +1,6 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=17
+version=18
 revision=1
 build_style=meta
 depends="llvm${version}"
@@ -8,7 +8,7 @@ short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
 homepage="https://www.voidlinux.org"
-replaces="llvm15>=0 llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+replaces="llvm17>=0 llvm15>=0 llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 
 clang_package() {
 	build_style=meta
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

From 7ea6877959c9fb65d582a621449dde6bd0aa251b Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 5/5] llvm17: new llvm

---
 srcpkgs/compiler-rt17   |  1 +
 srcpkgs/llvm17/template | 21 +++++++++++----------
 2 files changed, 12 insertions(+), 10 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17

diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 0000000000000..96970d5c02c13
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index aef0bf773d6be..3dfbe2b378487 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -58,8 +58,8 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+_enabled_projects=$(:)
+_enabled_runtimes=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -96,17 +96,17 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
 
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
 	case "$XBPS_TARGET_MACHINE" in
 		x86_64*|aarch64*)
 			# openmp fails when built as runtime if cross-compiled
@@ -119,9 +119,9 @@ if true; then
 			;;
 	esac
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
@@ -288,7 +288,8 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -654,7 +655,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR REVIEW] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (3 preceding siblings ...)
  2024-02-12 15:56 ` Calandracas606
@ 2024-02-15 11:51 ` sgn
  2024-02-15 11:51 ` sgn
                   ` (29 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: sgn @ 2024-02-15 11:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#discussion_r1490894895

Comment:
`hmaptool` goes to `-tools-extra`, `git-clang-format` goes to same packages with `clang-format`.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR REVIEW] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (4 preceding siblings ...)
  2024-02-15 11:51 ` [PR REVIEW] " sgn
@ 2024-02-15 11:51 ` sgn
  2024-02-15 11:52 ` sgn
                   ` (28 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: sgn @ 2024-02-15 11:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#discussion_r1490895298

Comment:
Honestly, I think `hmaptool` should go to clang

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR REVIEW] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (5 preceding siblings ...)
  2024-02-15 11:51 ` sgn
@ 2024-02-15 11:52 ` sgn
  2024-03-13 14:53 ` [PR PATCH] [Updated] " Calandracas606
                   ` (27 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: sgn @ 2024-02-15 11:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 190 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#discussion_r1490896061

Comment:
This `pycompile_dirs` goes to `clang-analyzer`

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (6 preceding siblings ...)
  2024-02-15 11:52 ` sgn
@ 2024-03-13 14:53 ` Calandracas606
  2024-03-13 16:49 ` Calandracas606
                   ` (26 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-03-13 14:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 68848 bytes --]

From 0b239d2ca0f2777c6242dd5ebf76b14c36a5c432 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 1/5] New package: llvm18-18.1.0

---
 common/shlibs                                 |   3 +
 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/libllvm18                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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 +
 ...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                       | 728 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 54 files changed, 1252 insertions(+), 9 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/libllvm18
 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/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 7ce38e9fa3bb15..27a7c8d5ac8397 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -983,10 +983,13 @@ 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.18 lldb18-18.1.0_1
 liblldb.so.17 lldb17-17.0.6_1
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18.1rc libclang18-18.1.0_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.0_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
diff --git a/srcpkgs/clang-analyzer18 b/srcpkgs/clang-analyzer18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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/libllvm18 b/srcpkgs/libllvm18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` to make "
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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..cc046106d5944e
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,728 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.0
+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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=eb18f65a68981e94ea1a5aae4f02321b17da9e99f76bfdb983b953f4ba2d3550
+lib32disabled=yes
+python_version=3
+
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt lto"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb lto"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+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"
+
+_enabled_projects=$(:)
+_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 "
+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
+
+# enable if runtime subpackages link to this version of llvm
+if true; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt18 "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*|aarch64*)
+			# openmp fails when built as runtime if cross-compiled
+			if [ "$CROSS_BUILD" ]; then
+				_enabled_projects+="openmp;"
+			else
+				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+			fi
+			subpackages+=" libomp libomp-devel "
+			;;
+	esac
+
+	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+fi
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm18-cross-tools"
+	# Seems to require a full host llvm/clang build
+	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+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"
+	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}"
+	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"
+        # shlib_provides="libclang.so.18.1rc"
+	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"
+	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"
+	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
+	short_desc+=" - post-link optimizer"
+	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
+	depends="clang18>=${version}_${revision}"
+	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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+lldb18_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	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/liblldb*.so.*"
+		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}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+lld18_package() {
+	lib32disabled=yes
+	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
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - multi-level IR compiler framework - development files"
+	homepage="https://mlir.llvm.org/"
+	depends="mlir18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - Fortran language frontend"
+	homepage="https://flang.llvm.org/"
+	depends="mlir18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/flang-new
+		vmove usr/bin/flang-to-external-fc
+	}
+}
+
+flang18-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - Fortran language frontend - development files"
+	homepage="https://flang.llvm.org/"
+	depends="flang18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/llvm-omp-device-info
+		vmove usr/bin/llvm-omp-kernel-replay
+		vmove "usr/lib/libarcher*.so"
+		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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libarcher*.a"
+			vmove "usr/lib/libomp*.a"
+		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*"
+	}
+}
+
+llvm18-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove usr/share/doc
+	}
+}
+
+llvm18-devel_package() {
+	short_desc+=" - development files"
+	depends="llvm18>=${version}_${revision}"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-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() {
+	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 00000000000000..e95cf26b3586b7
--- /dev/null
+++ b/srcpkgs/llvm18/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"
diff --git a/srcpkgs/mlir18 b/srcpkgs/mlir18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From b2ce5c8dbce16fe51e6350a0bae3d3c05968a2ce Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 2/5] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From 0be6288e181bcf28b347bf02c624cb93d7cd40da Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 3/5] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From 11c7777c94c55d92f0e291c02bd71b094ea2ab50 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 4/5] llvm: update to 18.

---
 srcpkgs/compiler-rt   |  2 +-
 srcpkgs/llvm/template | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..aa3c11ee1eef71 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,14 +1,14 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=17
-revision=2
+version=18
+revision=1
 build_style=meta
 depends="llvm${version}"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
 homepage="https://www.voidlinux.org"
-replaces="llvm15>=0 llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+replaces="llvm17>=0 llvm15>=0 llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 
 clang_package() {
 	build_style=meta
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

From 58f62b8bc4fa51d8391fdca48e5fb5b1c9da66c6 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 5/5] llvm17: new llvm

---
 srcpkgs/compiler-rt17   |  1 +
 srcpkgs/llvm17/template | 21 +++++++++++----------
 2 files changed, 12 insertions(+), 10 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17

diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..8ed0ee6c4c8b84 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -58,8 +58,8 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+_enabled_projects=$(:)
+_enabled_runtimes=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -96,17 +96,17 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
 
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
 	case "$XBPS_TARGET_MACHINE" in
 		x86_64*|aarch64*)
 			# openmp fails when built as runtime if cross-compiled
@@ -119,9 +119,9 @@ if true; then
 			;;
 	esac
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
@@ -288,7 +288,8 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -654,7 +655,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (7 preceding siblings ...)
  2024-03-13 14:53 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-03-13 16:49 ` Calandracas606
  2024-04-02 14:50 ` Calandracas606
                   ` (25 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-03-13 16:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 69140 bytes --]

From 275728af39c9f0ebb54e75a018f23bdb428b5629 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 1/5] New package: llvm18-18.1.0

---
 common/shlibs                                 |   5 +-
 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/libllvm18                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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 +
 ...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                       | 727 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 54 files changed, 1252 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/libllvm18
 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/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 d3298e21003df2..6ed916182e608c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -983,10 +983,13 @@ 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.18 lldb18-18.1.0_1
 liblldb.so.17 lldb17-17.0.6_1
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18 libclang18-18.1.1_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.0_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
@@ -995,7 +998,7 @@ libLLVM-15.so libllvm15-15.0.7_4
 libLLVM-17.so libllvm17-17.0.6_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.1_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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/libllvm18 b/srcpkgs/libllvm18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` to make "
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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..544a4516f8f29b
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,727 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.1
+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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=62439f733311869dbbaf704ce2e02141d2a07092d952fc87ef52d1d636a9b1e4
+lib32disabled=yes
+python_version=3
+
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt lto"
+build_options_default="clang clang_tools_extra lld mlir libclc polly lldb lto"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+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"
+
+_enabled_projects=$(:)
+_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 "
+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
+
+# enable if runtime subpackages link to this version of llvm
+if true; then
+	subpackages+=" llvm-libunwind llvm-libunwind-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+
+	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
+	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
+
+	subpackages+=" compiler-rt18 "
+	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
+	case "$XBPS_TARGET_MACHINE" in
+		x86_64*|aarch64*)
+			# openmp fails when built as runtime if cross-compiled
+			if [ "$CROSS_BUILD" ]; then
+				_enabled_projects+="openmp;"
+			else
+				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
+			fi
+			subpackages+=" libomp libomp-devel "
+			;;
+	esac
+
+	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+fi
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" llvm18-cross-tools"
+	# Seems to require a full host llvm/clang build
+	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+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"
+	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}"
+	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"
+	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"
+	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
+	short_desc+=" - post-link optimizer"
+	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
+	depends="clang18>=${version}_${revision}"
+	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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+lldb18_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	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/liblldb*.so.*"
+		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}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+lld18_package() {
+	lib32disabled=yes
+	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
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - multi-level IR compiler framework - development files"
+	homepage="https://mlir.llvm.org/"
+	depends="mlir18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - Fortran language frontend"
+	homepage="https://flang.llvm.org/"
+	depends="mlir18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/flang-new
+		vmove usr/bin/flang-to-external-fc
+	}
+}
+
+flang18-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - Fortran language frontend - development files"
+	homepage="https://flang.llvm.org/"
+	depends="flang18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/llvm-omp-device-info
+		vmove usr/bin/llvm-omp-kernel-replay
+		vmove "usr/lib/libarcher*.so"
+		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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libarcher*.a"
+			vmove "usr/lib/libomp*.a"
+		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*"
+	}
+}
+
+llvm18-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove usr/share/doc
+	}
+}
+
+llvm18-devel_package() {
+	short_desc+=" - development files"
+	depends="llvm18>=${version}_${revision}"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-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() {
+	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 00000000000000..e95cf26b3586b7
--- /dev/null
+++ b/srcpkgs/llvm18/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"
diff --git a/srcpkgs/mlir18 b/srcpkgs/mlir18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From fe55c9478eed7113b2b2eb3bb57ae4154f0150a5 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 2/5] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From d0a7b26139cfaad5f4effea17b98465efd62712f Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 3/5] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From df4d2ba32a7b616d39f617768630b953c2c9ae81 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 4/5] llvm: update to 18.

---
 srcpkgs/compiler-rt   |  2 +-
 srcpkgs/llvm/template | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..aa3c11ee1eef71 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,14 +1,14 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=17
-revision=2
+version=18
+revision=1
 build_style=meta
 depends="llvm${version}"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
 homepage="https://www.voidlinux.org"
-replaces="llvm15>=0 llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+replaces="llvm17>=0 llvm15>=0 llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 
 clang_package() {
 	build_style=meta
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

From 231ecfd8bbdeafb3eafb1c66994e56afc8e7d55d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 5/5] llvm17: new llvm

---
 srcpkgs/compiler-rt17   |  1 +
 srcpkgs/llvm17/template | 21 +++++++++++----------
 2 files changed, 12 insertions(+), 10 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17

diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..8ed0ee6c4c8b84 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
@@ -58,8 +58,8 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+_enabled_projects=$(:)
+_enabled_runtimes=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -96,17 +96,17 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
 	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
 
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
 	case "$XBPS_TARGET_MACHINE" in
 		x86_64*|aarch64*)
 			# openmp fails when built as runtime if cross-compiled
@@ -119,9 +119,9 @@ if true; then
 			;;
 	esac
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
@@ -288,7 +288,8 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -654,7 +655,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (8 preceding siblings ...)
  2024-03-13 16:49 ` Calandracas606
@ 2024-04-02 14:50 ` Calandracas606
  2024-04-02 15:52 ` Calandracas606
                   ` (24 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-02 14:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 78132 bytes --]

From 68647e991c88ee9f0883f5401a6f948c7bc271ce Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 804acbd699e8a876f1011a608faff5f1761089f6 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |  2 +
 srcpkgs/compiler-rt17   |  1 +
 srcpkgs/liblldb17       |  1 +
 srcpkgs/llvm17/template | 97 ++++++++++++++++++++++++-----------------
 srcpkgs/llvm17/update   |  2 +-
 5 files changed, 62 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 1ee5b1f0544b5c..87547a6e279d78 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -984,6 +984,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..99f28e32985351 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -45,11 +44,17 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
-build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
+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
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +63,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +84,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +102,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -288,7 +287,8 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +312,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -348,8 +350,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +382,7 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	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
@@ -456,7 +457,6 @@ lldb17_package() {
 		vmove usr/bin/lldb-instr
 		vmove usr/bin/lldb-server
 		vmove usr/bin/lldb-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -474,6 +474,14 @@ lldb17-devel_package() {
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
@@ -576,17 +584,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +671,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 075b18d56a47d3aa8be2a301f6b04f53e55a9b4c Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.0

---
 common/shlibs                                 |   7 +-
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 744 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1307 insertions(+), 12 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/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 87547a6e279d78..c0b0039367c304 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -983,12 +983,13 @@ 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 liblldb18-18.1.0_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18 libclang18-18.1.1_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.0_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
@@ -997,7 +998,7 @@ libLLVM-15.so libllvm15-15.0.7_4
 libLLVM-17.so libllvm17-17.0.6_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.1_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..f6616caffa3fe1
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,744 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.1
+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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=62439f733311869dbbaf704ce2e02141d2a07092d952fc87ef52d1d636a9b1e4
+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 lto"
+
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# 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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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"
+	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}"
+	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"
+	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"
+	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
+	short_desc+=" - post-link optimizer"
+	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
+	depends="clang18>=${version}_${revision}"
+	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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+lldb18_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	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}"
+	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
+	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
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - multi-level IR compiler framework - development files"
+	homepage="https://mlir.llvm.org/"
+	depends="mlir18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - Fortran language frontend"
+	homepage="https://flang.llvm.org/"
+	depends="mlir18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/flang-new
+		vmove usr/bin/flang-to-external-fc
+	}
+}
+
+flang18-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - Fortran language frontend - development files"
+	homepage="https://flang.llvm.org/"
+	depends="flang18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libomp*.a"
+		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*"
+	}
+}
+
+llvm18-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove usr/share/doc
+	}
+}
+
+llvm18-devel_package() {
+	short_desc+=" - development files"
+	depends="llvm18>=${version}_${revision}"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-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() {
+	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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From a3c49ec5a2d1500502a72cd489decbc9d041dac2 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From 3a65d2d34333ced046e67420560085f69f1a9e02 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From 31e490d369d65d7d42161828492813fb36e22145 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: update to 18.

---
 srcpkgs/compiler-rt   |  2 +-
 srcpkgs/llvm/template | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..aa3c11ee1eef71 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,14 +1,14 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=17
-revision=2
+version=18
+revision=1
 build_style=meta
 depends="llvm${version}"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
 homepage="https://www.voidlinux.org"
-replaces="llvm15>=0 llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+replaces="llvm17>=0 llvm15>=0 llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 
 clang_package() {
 	build_style=meta
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (9 preceding siblings ...)
  2024-04-02 14:50 ` Calandracas606
@ 2024-04-02 15:52 ` Calandracas606
  2024-04-06  0:24 ` zlice
                   ` (23 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-02 15:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 78320 bytes --]

From 9649ebb273b5f05c587d96d80bba14d27d681009 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From c79df2d147869b18ce079145880e81d07a638169 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |  2 +
 srcpkgs/compiler-rt17   |  1 +
 srcpkgs/liblldb17       |  1 +
 srcpkgs/llvm17/template | 97 ++++++++++++++++++++++++-----------------
 srcpkgs/llvm17/update   |  2 +-
 5 files changed, 62 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 1ee5b1f0544b5c..87547a6e279d78 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -984,6 +984,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..99f28e32985351 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -45,11 +44,17 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
-build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
+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
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +63,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +84,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +102,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -288,7 +287,8 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +312,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -348,8 +350,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +382,7 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	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
@@ -456,7 +457,6 @@ lldb17_package() {
 		vmove usr/bin/lldb-instr
 		vmove usr/bin/lldb-server
 		vmove usr/bin/lldb-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -474,6 +474,14 @@ lldb17-devel_package() {
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
@@ -576,17 +584,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +671,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 97676254bef584cff11da48bda9b8adcff8da4a5 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.0

---
 common/shlibs                                 |   7 +-
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 750 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1313 insertions(+), 12 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/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 87547a6e279d78..c0b0039367c304 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -983,12 +983,13 @@ 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 liblldb18-18.1.0_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18 libclang18-18.1.1_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.0_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
@@ -997,7 +998,7 @@ libLLVM-15.so libllvm15-15.0.7_4
 libLLVM-17.so libllvm17-17.0.6_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.1_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..0fd5aeca160901
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,750 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.1
+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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=62439f733311869dbbaf704ce2e02141d2a07092d952fc87ef52d1d636a9b1e4
+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
+
+# 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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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"
+	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}"
+	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"
+	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"
+	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
+	short_desc+=" - post-link optimizer"
+	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
+	depends="clang18>=${version}_${revision}"
+	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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+lldb18_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	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}"
+	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
+	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
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - multi-level IR compiler framework - development files"
+	homepage="https://mlir.llvm.org/"
+	depends="mlir18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+	short_desc+=" - Fortran language frontend"
+	homepage="https://flang.llvm.org/"
+	depends="mlir18>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/flang-new
+		vmove usr/bin/flang-to-external-fc
+	}
+}
+
+flang18-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - Fortran language frontend - development files"
+	homepage="https://flang.llvm.org/"
+	depends="flang18>=${version}_${revision} llvm18>=${version}_${revision}"
+	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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libomp*.a"
+		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*"
+	}
+}
+
+llvm18-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove usr/share/doc
+	}
+}
+
+llvm18-devel_package() {
+	short_desc+=" - development files"
+	depends="llvm18>=${version}_${revision}"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-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() {
+	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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From e7997b506645cc7c8fe73a52ef125aff31e0e76a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From 9181a29b731e2ca0a836861bba6a0979fef2d42e Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From ae3f22f3e538a5799e15946a2147b737fb4c7bfc Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: update to 18.

---
 srcpkgs/compiler-rt   |  2 +-
 srcpkgs/llvm/template | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..aa3c11ee1eef71 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,14 +1,14 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=17
-revision=2
+version=18
+revision=1
 build_style=meta
 depends="llvm${version}"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
 homepage="https://www.voidlinux.org"
-replaces="llvm15>=0 llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+replaces="llvm17>=0 llvm15>=0 llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 
 clang_package() {
 	build_style=meta
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (10 preceding siblings ...)
  2024-04-02 15:52 ` Calandracas606
@ 2024-04-06  0:24 ` zlice
  2024-04-06  1:37 ` Calandracas606
                   ` (22 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: zlice @ 2024-04-06  0:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

New comment by zlice on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#issuecomment-2040822251

Comment:
I saw this while checking on where zig was at. I have [intel opencl](https://github.com/void-linux/void-packages/pull/43084) that was working with llvm15 but from intel's open issues 16, and I assume 17, will be in the air for a while. With 18 being updated, should I just mark intel opencl as a lost cause? I don't know that they will ever be "caught up" and things will be able to compile with void's versions.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (11 preceding siblings ...)
  2024-04-06  0:24 ` zlice
@ 2024-04-06  1:37 ` Calandracas606
  2024-04-06  1:41 ` zlice
                   ` (21 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-06  1:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 731 bytes --]

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#issuecomment-2040847876

Comment:
> I saw this while checking on where zig was at. I have [intel opencl](https://github.com/void-linux/void-packages/pull/43084) that was working with llvm15 but from intel's open issues 16, and I assume 17, will be in the air for a while. With 18 being updated, should I just mark intel opencl as a lost cause? I don't know that they will ever be "caught up" and things will be able to compile with void's versions.

llvm15 won't be going anywhere. the libraries (libllvm15, libclang15, etc) will likely stick around as long as they are needed, llvm12 is still packaged for example

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (12 preceding siblings ...)
  2024-04-06  1:37 ` Calandracas606
@ 2024-04-06  1:41 ` zlice
  2024-04-06 13:23 ` zlice
                   ` (20 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: zlice @ 2024-04-06  1:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 243 bytes --]

New comment by zlice on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#issuecomment-2040848800

Comment:
I'll try again with 15 sometime, I thought the `-devel` package was needed and that seems to be gone.


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (13 preceding siblings ...)
  2024-04-06  1:41 ` zlice
@ 2024-04-06 13:23 ` zlice
  2024-04-10 15:00 ` leahneukirchen
                   ` (19 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: zlice @ 2024-04-06 13:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

New comment by zlice on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#issuecomment-2041081248

Comment:
So it may not be llvm/clang needed devel, but SPIRV devel packages. I assume that conflicts between versions which is why only the latest (17) is in the repos?

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (14 preceding siblings ...)
  2024-04-06 13:23 ` zlice
@ 2024-04-10 15:00 ` leahneukirchen
  2024-04-10 17:11 ` Calandracas606
                   ` (18 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: leahneukirchen @ 2024-04-10 15:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 237 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#issuecomment-2047795290

Comment:
Please add libomp-devel to the dependency hull of llvm18-devel, this breaks cmake often.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (15 preceding siblings ...)
  2024-04-10 15:00 ` leahneukirchen
@ 2024-04-10 17:11 ` Calandracas606
  2024-04-11  2:48 ` Calandracas606
                   ` (17 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-10 17:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 285 bytes --]

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#issuecomment-2048076023

Comment:
> Please add libomp-devel to the dependency hull of llvm18-devel, this breaks cmake often.

that fix should already be part of this PR

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (16 preceding siblings ...)
  2024-04-10 17:11 ` Calandracas606
@ 2024-04-11  2:48 ` Calandracas606
  2024-04-18 14:29 ` Calandracas606
                   ` (16 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-11  2:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#issuecomment-2048840709

Comment:
template seems mostly fine.

only remaining issue is that compiler-rt17 fails to build on `armv*-musl` due to failing a static assertion. (works fine with compiler-rt18)

seems to only occur when the only runtime built is compiler-rt. if libcxx and unwinder are built alongside it, the error does not occur.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (17 preceding siblings ...)
  2024-04-11  2:48 ` Calandracas606
@ 2024-04-18 14:29 ` Calandracas606
  2024-04-18 14:40 ` [PR PATCH] [Updated] " Calandracas606
                   ` (15 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-18 14:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#issuecomment-2064012368

Comment:
> So it may not be llvm/clang needed devel, but SPIRV devel packages. I assume that conflicts between versions which is why only the latest (17) is in the repos?

@zlice at one point I did have a working intel level-zero and intel opencl template with llvm15, but never got around to figuring out how to patch it for musl

it probably makes sense to version SPIRV, there's no reason why libLLVMSPRIVLib.so.18 and libLLVMSPIRVLib.so.17 can't co-exist.



^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (18 preceding siblings ...)
  2024-04-18 14:29 ` Calandracas606
@ 2024-04-18 14:40 ` Calandracas606
  2024-04-18 14:42 ` Calandracas606
                   ` (14 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-18 14:40 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 78990 bytes --]

From fef99f821cec42aea753b3d7be3eeae4b264ee87 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 3648c65204cd62a67cb32ba5be7506f5832fbf28 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |  2 +
 srcpkgs/compiler-rt17   |  1 +
 srcpkgs/liblldb17       |  1 +
 srcpkgs/llvm17/template | 99 ++++++++++++++++++++++++-----------------
 srcpkgs/llvm17/update   |  2 +-
 5 files changed, 64 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 7e56fe664a4515..e47f9787481537 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -982,6 +982,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..be5d9c0e161468 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -45,11 +44,17 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +63,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +84,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +102,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +206,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +289,8 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +314,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -348,8 +352,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +384,7 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	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
@@ -456,7 +459,6 @@ lldb17_package() {
 		vmove usr/bin/lldb-instr
 		vmove usr/bin/lldb-server
 		vmove usr/bin/lldb-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -474,6 +476,14 @@ lldb17-devel_package() {
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
@@ -576,17 +586,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +673,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 45393ebf8a4add5d04a798ea634b4c5a110f763a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.0

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 762 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1326 insertions(+), 12 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/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 e47f9787481537..8527486b058484 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -981,21 +981,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 liblldb18-18.1.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18 libclang18-18.1.4_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.4_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-18.so libllvm18-18.1.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..43af41fc4ba170
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,762 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+conflicts="llvm17"
+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
+
+# 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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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"
+	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"
+	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"
+	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"
+	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
+	short_desc+=" - post-link optimizer"
+	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
+	depends="clang18>=${version}_${revision}"
+	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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+lldb18_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	conflicts="lldb17"
+	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}"
+	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb17-devel"
+	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
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	conflicts="lld17"
+	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
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld18>=${version}_${revision} llvm18>=${version}_${revision}"
+	conflicts="lld17-devel"
+	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
+	short_desc+=" - multi-level IR compiler framework - development files"
+	homepage="https://mlir.llvm.org/"
+	depends="mlir18>=${version}_${revision} llvm18>=${version}_${revision}"
+	conflicts="mlir17-devel"
+	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
+	short_desc+=" - Fortran language frontend"
+	homepage="https://flang.llvm.org/"
+	depends="mlir18>=${version}_${revision}"
+	conflicts="flang17"
+	pkg_install() {
+		vmove usr/bin/flang-new
+		vmove usr/bin/flang-to-external-fc
+	}
+}
+
+flang18-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - Fortran language frontend - development files"
+	homepage="https://flang.llvm.org/"
+	depends="flang18>=${version}_${revision} llvm18>=${version}_${revision}"
+	conflicts="flang17-devel"
+	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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libomp*.a"
+		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*"
+	}
+}
+
+llvm18-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove usr/share/doc
+	}
+}
+
+llvm18-devel_package() {
+	short_desc+=" - development files"
+	depends="llvm18>=${version}_${revision}"
+	conflicts="llvm17-devel"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-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() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb18-devel>=${version}_${revision} llvm18-devel>=${version}_${revision}"
+	conflicts="llvm17-cross-tools"
+	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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From 5acccc293a8a0d13b108db2d8bd3cc924d2cfe6d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From 2c9effc85c6b5c4c5f06cb9376ac9b7c4aae9228 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From 068465b3782de948d3070ed97b4e44e1e6c4df43 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: update to 18.

---
 srcpkgs/compiler-rt   |  2 +-
 srcpkgs/llvm/template | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..aa3c11ee1eef71 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,14 +1,14 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=17
-revision=2
+version=18
+revision=1
 build_style=meta
 depends="llvm${version}"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"
 homepage="https://www.voidlinux.org"
-replaces="llvm15>=0 llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
+replaces="llvm17>=0 llvm15>=0 llvm12>=0 llvm11>=0 llvm10>=0 llvm9>=0 llvm8>=0 llvm7>=0 llvm6.0>=0 llvm3.9>=0"
 
 clang_package() {
 	build_style=meta
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (19 preceding siblings ...)
  2024-04-18 14:40 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-04-18 14:42 ` Calandracas606
  2024-04-18 14:55 ` Calandracas606
                   ` (13 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-18 14:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 78435 bytes --]

From fef99f821cec42aea753b3d7be3eeae4b264ee87 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 3648c65204cd62a67cb32ba5be7506f5832fbf28 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |  2 +
 srcpkgs/compiler-rt17   |  1 +
 srcpkgs/liblldb17       |  1 +
 srcpkgs/llvm17/template | 99 ++++++++++++++++++++++++-----------------
 srcpkgs/llvm17/update   |  2 +-
 5 files changed, 64 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 7e56fe664a4515..e47f9787481537 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -982,6 +982,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..be5d9c0e161468 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -45,11 +44,17 @@ checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +63,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +84,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +102,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +206,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +289,8 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +314,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -348,8 +352,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +384,7 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	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
@@ -456,7 +459,6 @@ lldb17_package() {
 		vmove usr/bin/lldb-instr
 		vmove usr/bin/lldb-server
 		vmove usr/bin/lldb-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -474,6 +476,14 @@ lldb17-devel_package() {
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
@@ -576,17 +586,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +673,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 45393ebf8a4add5d04a798ea634b4c5a110f763a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.0

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 762 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1326 insertions(+), 12 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/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 e47f9787481537..8527486b058484 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -981,21 +981,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 liblldb18-18.1.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18 libclang18-18.1.4_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.4_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-18.so libllvm18-18.1.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..43af41fc4ba170
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,762 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+conflicts="llvm17"
+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
+
+# 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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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"
+	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"
+	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"
+	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"
+	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
+	short_desc+=" - post-link optimizer"
+	homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
+	depends="clang18>=${version}_${revision}"
+	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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+lldb18_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	conflicts="lldb17"
+	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}"
+	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb17-devel"
+	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
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	conflicts="lld17"
+	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
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld18>=${version}_${revision} llvm18>=${version}_${revision}"
+	conflicts="lld17-devel"
+	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
+	short_desc+=" - multi-level IR compiler framework - development files"
+	homepage="https://mlir.llvm.org/"
+	depends="mlir18>=${version}_${revision} llvm18>=${version}_${revision}"
+	conflicts="mlir17-devel"
+	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
+	short_desc+=" - Fortran language frontend"
+	homepage="https://flang.llvm.org/"
+	depends="mlir18>=${version}_${revision}"
+	conflicts="flang17"
+	pkg_install() {
+		vmove usr/bin/flang-new
+		vmove usr/bin/flang-to-external-fc
+	}
+}
+
+flang18-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - Fortran language frontend - development files"
+	homepage="https://flang.llvm.org/"
+	depends="flang18>=${version}_${revision} llvm18>=${version}_${revision}"
+	conflicts="flang17-devel"
+	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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libomp*.a"
+		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*"
+	}
+}
+
+llvm18-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove usr/share/doc
+	}
+}
+
+llvm18-devel_package() {
+	short_desc+=" - development files"
+	depends="llvm18>=${version}_${revision}"
+	conflicts="llvm17-devel"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-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() {
+	short_desc+=" - build tools for cross compiling LLVM"
+	depends="lldb18-devel>=${version}_${revision} llvm18-devel>=${version}_${revision}"
+	conflicts="llvm17-cross-tools"
+	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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From 5acccc293a8a0d13b108db2d8bd3cc924d2cfe6d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From 2c9effc85c6b5c4c5f06cb9376ac9b7c4aae9228 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From b11889a2d98dd06e3ca24c18922152bd01873779 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..465cf877b3526c 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (20 preceding siblings ...)
  2024-04-18 14:42 ` Calandracas606
@ 2024-04-18 14:55 ` Calandracas606
  2024-04-18 15:07 ` [PR PATCH] [Updated] " Calandracas606
                   ` (12 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-18 14:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 222 bytes --]

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#issuecomment-2064110071

Comment:
I think the PR is nearly ready to go, just doing some final build testing

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (21 preceding siblings ...)
  2024-04-18 14:55 ` Calandracas606
@ 2024-04-18 15:07 ` Calandracas606
  2024-04-18 15:54 ` Calandracas606
                   ` (11 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-18 15:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 80637 bytes --]

From fef99f821cec42aea753b3d7be3eeae4b264ee87 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 66b3a04e705747c9dcf491ab78f76d6a0d3b8ee2 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |   2 +
 srcpkgs/compiler-rt17   |   1 +
 srcpkgs/liblldb17       |   1 +
 srcpkgs/llvm17/template | 109 +++++++++++++++++++++++++---------------
 srcpkgs/llvm17/update   |   2 +-
 5 files changed, 74 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 7e56fe664a4515..e47f9787481537 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -982,6 +982,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..15ee6c55dba5ac 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -42,14 +41,21 @@ license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
 checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+conflicts="llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +64,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +85,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +103,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +207,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +290,9 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
+	conflicts="clang15>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +316,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -335,6 +341,7 @@ clang17-devel_package() {
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
 	 llvm17>=${version}_${revision}"
+	conflicts="clang15-devel>=0"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17>=${version}_${revision}"
 	fi
@@ -348,8 +355,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +387,8 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
+	pycompile_dirs="usr/share/scan-view"
+	conflicts="clang-analyzer15>=0"
 	pkg_install() {
 		vmove usr/share/scan-view
 		vmove usr/share/scan-build
@@ -405,6 +412,7 @@ clang-tools-extra17_package() {
 	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
+	conflicts="clang-tools-extra15>=0"
 	pkg_install() {
 		vmove usr/bin/clang-apply-replacements
 		vmove usr/bin/clang-change-namespace
@@ -450,13 +458,13 @@ lldb17_package() {
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
 	homepage="https://lldb.llvm.org/"
+	conflicts="lldb15>=0"
 	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-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -468,16 +476,26 @@ lldb17-devel_package() {
 	lib32disabled=yes
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
+	conflicts="lld15>=0"
 	pkg_install() {
 		vmove usr/bin/lld
 		vmove usr/bin/lld-link
@@ -492,6 +510,7 @@ lld17-devel_package() {
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
 	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	conflicts="lld15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -576,17 +595,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +682,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
@@ -685,6 +713,7 @@ llvm17-doc_package() {
 llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
+	conflicts="llvm15-devel>=0"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From a6769dfb2b2d8067dcd1cea5cee4a629cfb13a02 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.4

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 765 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1329 insertions(+), 12 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/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 e47f9787481537..8527486b058484 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -981,21 +981,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 liblldb18-18.1.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18 libclang18-18.1.4_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.4_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-18.so libllvm18-18.1.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..3ca964f5c96fb7
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,765 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+conflicts="llvm17>=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
+
+# 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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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"
+	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"
+	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"
+	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"
+	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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+lldb18_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	conflicts="lldb17>=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"
+	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"
+	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"
+	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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libomp*.a"
+		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*"
+	}
+}
+
+llvm18-doc_package() {
+	short_desc+=" - documentation"
+	pkg_install() {
+		vmove usr/share/doc
+	}
+}
+
+llvm18-devel_package() {
+	depends="llvm18>=${version}_${revision}"
+	conflicts="llvm17-devel>=0"
+	short_desc+=" - development files"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From 588169035fd33fecd53b9a1042371dca46f0e0f5 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From a6cd5395d2b603ce98c557d825fc9a6ee7320514 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From c8a011c0637db6dd190724f03e928e89e714118a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..465cf877b3526c 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (22 preceding siblings ...)
  2024-04-18 15:07 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-04-18 15:54 ` Calandracas606
  2024-04-18 21:08 ` Calandracas606
                   ` (10 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-18 15:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 80781 bytes --]

From fef99f821cec42aea753b3d7be3eeae4b264ee87 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 66b3a04e705747c9dcf491ab78f76d6a0d3b8ee2 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |   2 +
 srcpkgs/compiler-rt17   |   1 +
 srcpkgs/liblldb17       |   1 +
 srcpkgs/llvm17/template | 109 +++++++++++++++++++++++++---------------
 srcpkgs/llvm17/update   |   2 +-
 5 files changed, 74 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 7e56fe664a4515..e47f9787481537 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -982,6 +982,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..15ee6c55dba5ac 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -42,14 +41,21 @@ license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
 checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+conflicts="llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +64,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +85,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +103,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +207,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +290,9 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
+	conflicts="clang15>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +316,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -335,6 +341,7 @@ clang17-devel_package() {
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
 	 llvm17>=${version}_${revision}"
+	conflicts="clang15-devel>=0"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17>=${version}_${revision}"
 	fi
@@ -348,8 +355,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +387,8 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
+	pycompile_dirs="usr/share/scan-view"
+	conflicts="clang-analyzer15>=0"
 	pkg_install() {
 		vmove usr/share/scan-view
 		vmove usr/share/scan-build
@@ -405,6 +412,7 @@ clang-tools-extra17_package() {
 	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
+	conflicts="clang-tools-extra15>=0"
 	pkg_install() {
 		vmove usr/bin/clang-apply-replacements
 		vmove usr/bin/clang-change-namespace
@@ -450,13 +458,13 @@ lldb17_package() {
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
 	homepage="https://lldb.llvm.org/"
+	conflicts="lldb15>=0"
 	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-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -468,16 +476,26 @@ lldb17-devel_package() {
 	lib32disabled=yes
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
+	conflicts="lld15>=0"
 	pkg_install() {
 		vmove usr/bin/lld
 		vmove usr/bin/lld-link
@@ -492,6 +510,7 @@ lld17-devel_package() {
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
 	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	conflicts="lld15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -576,17 +595,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +682,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
@@ -685,6 +713,7 @@ llvm17-doc_package() {
 llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
+	conflicts="llvm15-devel>=0"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From fe2ecbd14bdc0829ded312e092ae4f6fa1747aab Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.4

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 765 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1329 insertions(+), 12 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/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 e47f9787481537..8527486b058484 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -981,21 +981,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 liblldb18-18.1.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18 libclang18-18.1.4_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.4_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-18.so libllvm18-18.1.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..01a73d9a241cbb
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,765 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+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
+
+# 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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+			vmove "usr/lib/libomptarget*.bc"
+			vmove "usr/lib/libomp*.a"
+		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*"
+	}
+}
+
+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+=" libomp-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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From d01a4851251ddfd709ec55e53a28ff6120c42df3 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From b7c853468d1dbc2267849d833e629cb4e1ca58c8 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From 70a0eb3a0fbf8fd9ee2dab8fcedaedf4f63aab19 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..465cf877b3526c 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (23 preceding siblings ...)
  2024-04-18 15:54 ` Calandracas606
@ 2024-04-18 21:08 ` Calandracas606
  2024-04-18 21:52 ` Calandracas606
                   ` (9 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-18 21:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**


#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**


<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - x86_64-musl
  - i686
  - aarch64-musl (cross)
  - armv7l (cross)
  - armv6l-musl (cross)

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 80805 bytes --]

From fef99f821cec42aea753b3d7be3eeae4b264ee87 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 66b3a04e705747c9dcf491ab78f76d6a0d3b8ee2 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |   2 +
 srcpkgs/compiler-rt17   |   1 +
 srcpkgs/liblldb17       |   1 +
 srcpkgs/llvm17/template | 109 +++++++++++++++++++++++++---------------
 srcpkgs/llvm17/update   |   2 +-
 5 files changed, 74 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 7e56fe664a4515..e47f9787481537 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -982,6 +982,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..15ee6c55dba5ac 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -42,14 +41,21 @@ license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
 checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+conflicts="llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +64,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +85,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +103,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +207,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +290,9 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
+	conflicts="clang15>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +316,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -335,6 +341,7 @@ clang17-devel_package() {
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
 	 llvm17>=${version}_${revision}"
+	conflicts="clang15-devel>=0"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17>=${version}_${revision}"
 	fi
@@ -348,8 +355,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +387,8 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
+	pycompile_dirs="usr/share/scan-view"
+	conflicts="clang-analyzer15>=0"
 	pkg_install() {
 		vmove usr/share/scan-view
 		vmove usr/share/scan-build
@@ -405,6 +412,7 @@ clang-tools-extra17_package() {
 	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
+	conflicts="clang-tools-extra15>=0"
 	pkg_install() {
 		vmove usr/bin/clang-apply-replacements
 		vmove usr/bin/clang-change-namespace
@@ -450,13 +458,13 @@ lldb17_package() {
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
 	homepage="https://lldb.llvm.org/"
+	conflicts="lldb15>=0"
 	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-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -468,16 +476,26 @@ lldb17-devel_package() {
 	lib32disabled=yes
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
+	conflicts="lld15>=0"
 	pkg_install() {
 		vmove usr/bin/lld
 		vmove usr/bin/lld-link
@@ -492,6 +510,7 @@ lld17-devel_package() {
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
 	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	conflicts="lld15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -576,17 +595,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +682,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
@@ -685,6 +713,7 @@ llvm17-doc_package() {
 llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
+	conflicts="llvm15-devel>=0"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From e3083092c4dcb8393ec636735a83f6998828b088 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.4

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 767 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1331 insertions(+), 12 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/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 e47f9787481537..8527486b058484 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -981,21 +981,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 liblldb18-18.1.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18 libclang18-18.1.4_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.4_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-18.so libllvm18-18.1.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..efceaaf63881bc
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,767 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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
+ -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 "
+short_desc="LLVM Compiler Infrastructure Project - Version 18"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+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
+
+# 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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*)
+				vmove "usr/lib/libomptarget*.bc"
+				vmove "usr/lib/libomp*.a"
+			;;
+		esac
+	}
+}
+
+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*"
+	}
+}
+
+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+=" libomp-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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From 591710bb725a4644fc09c92bd8ed38fb487c6509 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From 820cbef47afe2c61551c5502d4f7b47f21a880bc Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From 6e79b4f67f3022950c92f7779a7cdc26e06daa4d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..465cf877b3526c 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (24 preceding siblings ...)
  2024-04-18 21:08 ` Calandracas606
@ 2024-04-18 21:52 ` Calandracas606
  2024-04-22 22:28 ` [PR PATCH] [Updated] " Calandracas606
                   ` (8 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-18 21:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

New comment by Calandracas606 on void-packages repository

https://github.com/void-linux/void-packages/pull/48661#issuecomment-2065385937

Comment:
PR is ready for merge.

Should be relatively safe, it only adds llvm18, but doesn't actually build anything against it. Having it available ahead of time will be useful for when rust and chromium are eventually dependent on it

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (25 preceding siblings ...)
  2024-04-18 21:52 ` Calandracas606
@ 2024-04-22 22:28 ` Calandracas606
  2024-04-23  3:12 ` Calandracas606
                   ` (7 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-22 22:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**


#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**


<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - x86_64-musl
  - i686
  - aarch64-musl (cross)
  - armv7l (cross)
  - armv6l-musl (cross)

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 81002 bytes --]

From f0a004fb9e717380ad614c92bdcd16810d4e38b4 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 55afeb3a5de763f316ac64f97b379fc915c8f54d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |   2 +
 srcpkgs/compiler-rt17   |   1 +
 srcpkgs/liblldb17       |   1 +
 srcpkgs/llvm17/template | 109 +++++++++++++++++++++++++---------------
 srcpkgs/llvm17/update   |   2 +-
 5 files changed, 74 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 531f1431305d49..241050dd1b56be 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -982,6 +982,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..15ee6c55dba5ac 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -42,14 +41,21 @@ license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
 checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+conflicts="llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +64,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +85,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +103,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +207,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +290,9 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
+	conflicts="clang15>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +316,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -335,6 +341,7 @@ clang17-devel_package() {
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
 	 llvm17>=${version}_${revision}"
+	conflicts="clang15-devel>=0"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17>=${version}_${revision}"
 	fi
@@ -348,8 +355,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +387,8 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
+	pycompile_dirs="usr/share/scan-view"
+	conflicts="clang-analyzer15>=0"
 	pkg_install() {
 		vmove usr/share/scan-view
 		vmove usr/share/scan-build
@@ -405,6 +412,7 @@ clang-tools-extra17_package() {
 	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
+	conflicts="clang-tools-extra15>=0"
 	pkg_install() {
 		vmove usr/bin/clang-apply-replacements
 		vmove usr/bin/clang-change-namespace
@@ -450,13 +458,13 @@ lldb17_package() {
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
 	homepage="https://lldb.llvm.org/"
+	conflicts="lldb15>=0"
 	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-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -468,16 +476,26 @@ lldb17-devel_package() {
 	lib32disabled=yes
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
+	conflicts="lld15>=0"
 	pkg_install() {
 		vmove usr/bin/lld
 		vmove usr/bin/lld-link
@@ -492,6 +510,7 @@ lld17-devel_package() {
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
 	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	conflicts="lld15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -576,17 +595,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +682,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
@@ -685,6 +713,7 @@ llvm17-doc_package() {
 llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
+	conflicts="llvm15-devel>=0"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From d35dd53fe59e9bec6604039ed808c9f877457d9d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.4

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 774 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1338 insertions(+), 12 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/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 241050dd1b56be..90a9b2c715dd88 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -981,21 +981,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 liblldb18-18.1.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18 libclang18-18.1.4_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.4_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-18.so libllvm18-18.1.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..209b30b5c93d1c
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,774 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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 <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision} llvm18>=${version}_${revision}"
+	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
+
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*)
+				vmove "usr/lib/libomptarget*.bc"
+				vmove "usr/lib/libomp*.a"
+			;;
+		esac
+	}
+}
+
+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+=" libomp-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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From 91e54f56eb743148d867a1f6bebf7de24afdd069 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From fe8bf1da1b76527ea0348bc6acadf97dfec0a342 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From 7a9183d5957585603cc019dce51b2053e3bf9f80 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..465cf877b3526c 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (26 preceding siblings ...)
  2024-04-22 22:28 ` [PR PATCH] [Updated] " Calandracas606
@ 2024-04-23  3:12 ` Calandracas606
  2024-04-29  2:54 ` Calandracas606
                   ` (6 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-23  3:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**


#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**


<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - x86_64-musl
  - i686
  - aarch64-musl (cross)
  - armv7l (cross)
  - armv6l-musl (cross)

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 80971 bytes --]

From f0a004fb9e717380ad614c92bdcd16810d4e38b4 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 55afeb3a5de763f316ac64f97b379fc915c8f54d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |   2 +
 srcpkgs/compiler-rt17   |   1 +
 srcpkgs/liblldb17       |   1 +
 srcpkgs/llvm17/template | 109 +++++++++++++++++++++++++---------------
 srcpkgs/llvm17/update   |   2 +-
 5 files changed, 74 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 531f1431305d49..241050dd1b56be 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -982,6 +982,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..15ee6c55dba5ac 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -42,14 +41,21 @@ license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
 checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+conflicts="llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +64,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +85,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +103,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +207,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +290,9 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
+	conflicts="clang15>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +316,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -335,6 +341,7 @@ clang17-devel_package() {
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
 	 llvm17>=${version}_${revision}"
+	conflicts="clang15-devel>=0"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17>=${version}_${revision}"
 	fi
@@ -348,8 +355,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +387,8 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
+	pycompile_dirs="usr/share/scan-view"
+	conflicts="clang-analyzer15>=0"
 	pkg_install() {
 		vmove usr/share/scan-view
 		vmove usr/share/scan-build
@@ -405,6 +412,7 @@ clang-tools-extra17_package() {
 	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
+	conflicts="clang-tools-extra15>=0"
 	pkg_install() {
 		vmove usr/bin/clang-apply-replacements
 		vmove usr/bin/clang-change-namespace
@@ -450,13 +458,13 @@ lldb17_package() {
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
 	homepage="https://lldb.llvm.org/"
+	conflicts="lldb15>=0"
 	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-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -468,16 +476,26 @@ lldb17-devel_package() {
 	lib32disabled=yes
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
+	conflicts="lld15>=0"
 	pkg_install() {
 		vmove usr/bin/lld
 		vmove usr/bin/lld-link
@@ -492,6 +510,7 @@ lld17-devel_package() {
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
 	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	conflicts="lld15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -576,17 +595,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +682,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
@@ -685,6 +713,7 @@ llvm17-doc_package() {
 llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
+	conflicts="llvm15-devel>=0"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From a4c7194c599c8820c8335f8ddd250a60505ffb5a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.4

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 774 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1338 insertions(+), 12 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/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 241050dd1b56be..90a9b2c715dd88 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -981,21 +981,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 liblldb18-18.1.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18 libclang18-18.1.4_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.4_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-18.so libllvm18-18.1.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..ac0f5fdbb7ac8b
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,774 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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 <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	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
+
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*)
+				vmove "usr/lib/libomptarget*.bc"
+				vmove "usr/lib/libomp*.a"
+			;;
+		esac
+	}
+}
+
+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+=" libomp-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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From 41443b655b8c7bfa2fa43b4ac0bdcf2a1aad2439 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From 291e6d145a5a629da1b3a5299a622097f511f0f2 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From d47eb51ad28a1c34a34488ff36fe2ec2a3c33bc3 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..465cf877b3526c 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (27 preceding siblings ...)
  2024-04-23  3:12 ` Calandracas606
@ 2024-04-29  2:54 ` Calandracas606
  2024-04-29  2:55 ` Calandracas606
                   ` (5 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-29  2:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**


#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**


<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - x86_64-musl
  - i686
  - aarch64-musl (cross)
  - armv7l (cross)
  - armv6l-musl (cross)

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 80973 bytes --]

From 6e669f6bfc0eee03bae9083dce82831de0a30e8c Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 89f84737f5616b8834e998ac0c5b7f47c110fb89 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |   2 +
 srcpkgs/compiler-rt17   |   1 +
 srcpkgs/liblldb17       |   1 +
 srcpkgs/llvm17/template | 109 +++++++++++++++++++++++++---------------
 srcpkgs/llvm17/update   |   2 +-
 5 files changed, 74 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 794290d3a2f77d..6918ae542a4844 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -979,6 +979,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..15ee6c55dba5ac 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -42,14 +41,21 @@ license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
 checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+conflicts="llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +64,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +85,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +103,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +207,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +290,9 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
+	conflicts="clang15>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +316,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -335,6 +341,7 @@ clang17-devel_package() {
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
 	 llvm17>=${version}_${revision}"
+	conflicts="clang15-devel>=0"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17>=${version}_${revision}"
 	fi
@@ -348,8 +355,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +387,8 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
+	pycompile_dirs="usr/share/scan-view"
+	conflicts="clang-analyzer15>=0"
 	pkg_install() {
 		vmove usr/share/scan-view
 		vmove usr/share/scan-build
@@ -405,6 +412,7 @@ clang-tools-extra17_package() {
 	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
+	conflicts="clang-tools-extra15>=0"
 	pkg_install() {
 		vmove usr/bin/clang-apply-replacements
 		vmove usr/bin/clang-change-namespace
@@ -450,13 +458,13 @@ lldb17_package() {
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
 	homepage="https://lldb.llvm.org/"
+	conflicts="lldb15>=0"
 	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-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -468,16 +476,26 @@ lldb17-devel_package() {
 	lib32disabled=yes
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
+	conflicts="lld15>=0"
 	pkg_install() {
 		vmove usr/bin/lld
 		vmove usr/bin/lld-link
@@ -492,6 +510,7 @@ lld17-devel_package() {
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
 	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	conflicts="lld15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -576,17 +595,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +682,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
@@ -685,6 +713,7 @@ llvm17-doc_package() {
 llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
+	conflicts="llvm15-devel>=0"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 64134485527928a78ab628b3a524d9d69b43bcdf Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.4

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 774 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1338 insertions(+), 12 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/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 6918ae542a4844..4d07e7fffc9771 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -978,21 +978,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 liblldb18-18.1.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18 libclang18-18.1.4_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.4_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.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..ac0f5fdbb7ac8b
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,774 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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 <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	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
+
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*)
+				vmove "usr/lib/libomptarget*.bc"
+				vmove "usr/lib/libomp*.a"
+			;;
+		esac
+	}
+}
+
+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+=" libomp-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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From 7d33608de04f02ce61005267dc13652fa5f3101b Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From b05e6b60d701e20864021d99102ebdc1147481ba Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From f9c57b2ff182e282b9fe70cb8545ad6964b477b8 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..465cf877b3526c 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (28 preceding siblings ...)
  2024-04-29  2:54 ` Calandracas606
@ 2024-04-29  2:55 ` Calandracas606
  2024-04-29 21:58 ` Calandracas606
                   ` (4 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-29  2:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**


#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**


<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - x86_64-musl
  - i686
  - aarch64-musl (cross)
  - armv7l (cross)
  - armv6l-musl (cross)

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 80973 bytes --]

From 8d8664ed5f726ab5d82f664c8ab9dd13a1b3ec2c Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 56000912377f29842c6424b82af33eed8761cbe3 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |   2 +
 srcpkgs/compiler-rt17   |   1 +
 srcpkgs/liblldb17       |   1 +
 srcpkgs/llvm17/template | 109 +++++++++++++++++++++++++---------------
 srcpkgs/llvm17/update   |   2 +-
 5 files changed, 74 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 794290d3a2f77d..6918ae542a4844 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -979,6 +979,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..15ee6c55dba5ac 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -42,14 +41,21 @@ license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
 checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+conflicts="llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +64,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +85,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +103,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +207,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +290,9 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
+	conflicts="clang15>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +316,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -335,6 +341,7 @@ clang17-devel_package() {
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
 	 llvm17>=${version}_${revision}"
+	conflicts="clang15-devel>=0"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17>=${version}_${revision}"
 	fi
@@ -348,8 +355,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +387,8 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
+	pycompile_dirs="usr/share/scan-view"
+	conflicts="clang-analyzer15>=0"
 	pkg_install() {
 		vmove usr/share/scan-view
 		vmove usr/share/scan-build
@@ -405,6 +412,7 @@ clang-tools-extra17_package() {
 	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
+	conflicts="clang-tools-extra15>=0"
 	pkg_install() {
 		vmove usr/bin/clang-apply-replacements
 		vmove usr/bin/clang-change-namespace
@@ -450,13 +458,13 @@ lldb17_package() {
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
 	homepage="https://lldb.llvm.org/"
+	conflicts="lldb15>=0"
 	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-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -468,16 +476,26 @@ lldb17-devel_package() {
 	lib32disabled=yes
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
+	conflicts="lld15>=0"
 	pkg_install() {
 		vmove usr/bin/lld
 		vmove usr/bin/lld-link
@@ -492,6 +510,7 @@ lld17-devel_package() {
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
 	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	conflicts="lld15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -576,17 +595,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +682,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
@@ -685,6 +713,7 @@ llvm17-doc_package() {
 llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
+	conflicts="llvm15-devel>=0"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 846c611ea596307ec2e67b2b249872993807fd69 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.4

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 774 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1338 insertions(+), 12 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/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 6918ae542a4844..4d07e7fffc9771 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -978,21 +978,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 liblldb18-18.1.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18 libclang18-18.1.4_1
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
+libclang-cpp.so.18 libclang-cpp18-18.1.4_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.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..ac0f5fdbb7ac8b
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,774 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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 <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	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
+
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*)
+				vmove "usr/lib/libomptarget*.bc"
+				vmove "usr/lib/libomp*.a"
+			;;
+		esac
+	}
+}
+
+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+=" libomp-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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From ce92dfca078dc8c39f1ceeff4917070c701b3913 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From d31df94ee30c4fadf84fc9ef32431643e9aeea64 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From f021e1fb471fb88b38761a48fa76aacebe1258b2 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..465cf877b3526c 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (29 preceding siblings ...)
  2024-04-29  2:55 ` Calandracas606
@ 2024-04-29 21:58 ` Calandracas606
  2024-05-01 12:41 ` Calandracas606
                   ` (3 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-04-29 21:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**


#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**


<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - x86_64-musl
  - i686
  - aarch64-musl (cross)
  - armv7l (cross)
  - armv6l-musl (cross)

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 80979 bytes --]

From df729402d3efff121f54a34e03a46c4d2e4cf18d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 2bf323a303e925bbdcc817253e712e9c08e56b98 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |   2 +
 srcpkgs/compiler-rt17   |   1 +
 srcpkgs/liblldb17       |   1 +
 srcpkgs/llvm17/template | 109 +++++++++++++++++++++++++---------------
 srcpkgs/llvm17/update   |   2 +-
 5 files changed, 74 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 105196bea39154..bc9eb978e05681 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -980,6 +980,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..15ee6c55dba5ac 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -42,14 +41,21 @@ license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
 checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+conflicts="llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +64,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +85,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +103,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +207,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +290,9 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
+	conflicts="clang15>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +316,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -335,6 +341,7 @@ clang17-devel_package() {
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
 	 llvm17>=${version}_${revision}"
+	conflicts="clang15-devel>=0"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17>=${version}_${revision}"
 	fi
@@ -348,8 +355,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +387,8 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
+	pycompile_dirs="usr/share/scan-view"
+	conflicts="clang-analyzer15>=0"
 	pkg_install() {
 		vmove usr/share/scan-view
 		vmove usr/share/scan-build
@@ -405,6 +412,7 @@ clang-tools-extra17_package() {
 	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
+	conflicts="clang-tools-extra15>=0"
 	pkg_install() {
 		vmove usr/bin/clang-apply-replacements
 		vmove usr/bin/clang-change-namespace
@@ -450,13 +458,13 @@ lldb17_package() {
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
 	homepage="https://lldb.llvm.org/"
+	conflicts="lldb15>=0"
 	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-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -468,16 +476,26 @@ lldb17-devel_package() {
 	lib32disabled=yes
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
+	conflicts="lld15>=0"
 	pkg_install() {
 		vmove usr/bin/lld
 		vmove usr/bin/lld-link
@@ -492,6 +510,7 @@ lld17-devel_package() {
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
 	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	conflicts="lld15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -576,17 +595,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +682,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
@@ -685,6 +713,7 @@ llvm17-doc_package() {
 llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
+	conflicts="llvm15-devel>=0"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From b5a5694f24ffbee532738f67ca49910f4efafe51 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.4

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 774 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1338 insertions(+), 12 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/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 bc9eb978e05681..20903b123b8e1c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -979,21 +979,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.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18.1 libclang18-18.1.4_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.4_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.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..ac0f5fdbb7ac8b
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,774 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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 <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	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
+
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*)
+				vmove "usr/lib/libomptarget*.bc"
+				vmove "usr/lib/libomp*.a"
+			;;
+		esac
+	}
+}
+
+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+=" libomp-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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From d67c6653c76b489f85e88c7374ba942bc6fdcb9a Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From 7da641d9797da71bb815b872c1167ecf4924a5d9 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From 238564ac086b9bffd5e740d10ae8ac26200249c2 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..465cf877b3526c 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (30 preceding siblings ...)
  2024-04-29 21:58 ` Calandracas606
@ 2024-05-01 12:41 ` Calandracas606
  2024-05-01 13:05 ` Calandracas606
                   ` (2 subsequent siblings)
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-05-01 12:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**


#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**


<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - x86_64-musl
  - i686
  - aarch64-musl (cross)
  - armv7l (cross)
  - armv6l-musl (cross)

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 81071 bytes --]

From de7f5271f3083593ec07ed4f306b66275b9a4f09 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 06bcd7832acb193e145b02fcc2e939da1c1220bd Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |   2 +
 srcpkgs/compiler-rt17   |   1 +
 srcpkgs/liblldb17       |   1 +
 srcpkgs/llvm17/template | 109 +++++++++++++++++++++++++---------------
 srcpkgs/llvm17/update   |   2 +-
 5 files changed, 74 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 105196bea39154..bc9eb978e05681 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -980,6 +980,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..15ee6c55dba5ac 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -42,14 +41,21 @@ license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
 checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+conflicts="llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +64,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +85,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +103,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +207,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +290,9 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
+	conflicts="clang15>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +316,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -335,6 +341,7 @@ clang17-devel_package() {
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
 	 llvm17>=${version}_${revision}"
+	conflicts="clang15-devel>=0"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17>=${version}_${revision}"
 	fi
@@ -348,8 +355,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +387,8 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
+	pycompile_dirs="usr/share/scan-view"
+	conflicts="clang-analyzer15>=0"
 	pkg_install() {
 		vmove usr/share/scan-view
 		vmove usr/share/scan-build
@@ -405,6 +412,7 @@ clang-tools-extra17_package() {
 	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
+	conflicts="clang-tools-extra15>=0"
 	pkg_install() {
 		vmove usr/bin/clang-apply-replacements
 		vmove usr/bin/clang-change-namespace
@@ -450,13 +458,13 @@ lldb17_package() {
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
 	homepage="https://lldb.llvm.org/"
+	conflicts="lldb15>=0"
 	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-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -468,16 +476,26 @@ lldb17-devel_package() {
 	lib32disabled=yes
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
+	conflicts="lld15>=0"
 	pkg_install() {
 		vmove usr/bin/lld
 		vmove usr/bin/lld-link
@@ -492,6 +510,7 @@ lld17-devel_package() {
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
 	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	conflicts="lld15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -576,17 +595,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +682,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
@@ -685,6 +713,7 @@ llvm17-doc_package() {
 llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
+	conflicts="llvm15-devel>=0"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From f0da03f063b28464fa555b9d0981f0e9b5cc74cb Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.4

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 775 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1339 insertions(+), 12 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/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 bc9eb978e05681..20903b123b8e1c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -979,21 +979,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.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18.1 libclang18-18.1.4_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.4_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.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..48148772ebbbc4
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,775 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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 <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	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
+
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*)
+				vmove "usr/lib/libomptarget*.bc"
+				vmove "usr/lib/libomp*.a"
+			;;
+		esac
+	}
+}
+
+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}
+	 libffi-devel ncurses-libtinfo-devel zlib-devel libxml2-devel libzstd-devel libedit-devel"
+	conflicts="llvm17-devel>=0 llvm15-devel>=0"
+	short_desc+=" - development files"
+	if [ "$build_option_openmp" ]; then
+		depends+=" libomp-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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From 3112c195b81a62d5a900484e4075b18c54883f88 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From ed241ecdf0328eff8725eb17f342701d80ea2a43 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From 3224ff8d64f2326d6d39a6efc42ce47a55c5ab41 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..465cf877b3526c 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (31 preceding siblings ...)
  2024-05-01 12:41 ` Calandracas606
@ 2024-05-01 13:05 ` Calandracas606
  2024-05-03 15:04 ` Calandracas606
  2024-05-04  3:08 ` Calandracas606
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-05-01 13:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**


#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**


<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - x86_64-musl
  - i686
  - aarch64-musl (cross)
  - armv7l (cross)
  - armv6l-musl (cross)

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 80979 bytes --]

From de7f5271f3083593ec07ed4f306b66275b9a4f09 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 06bcd7832acb193e145b02fcc2e939da1c1220bd Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |   2 +
 srcpkgs/compiler-rt17   |   1 +
 srcpkgs/liblldb17       |   1 +
 srcpkgs/llvm17/template | 109 +++++++++++++++++++++++++---------------
 srcpkgs/llvm17/update   |   2 +-
 5 files changed, 74 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 105196bea39154..bc9eb978e05681 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -980,6 +980,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..15ee6c55dba5ac 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -42,14 +41,21 @@ license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
 checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+conflicts="llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +64,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +85,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +103,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +207,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +290,9 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
+	conflicts="clang15>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +316,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -335,6 +341,7 @@ clang17-devel_package() {
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
 	 llvm17>=${version}_${revision}"
+	conflicts="clang15-devel>=0"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17>=${version}_${revision}"
 	fi
@@ -348,8 +355,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +387,8 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
+	pycompile_dirs="usr/share/scan-view"
+	conflicts="clang-analyzer15>=0"
 	pkg_install() {
 		vmove usr/share/scan-view
 		vmove usr/share/scan-build
@@ -405,6 +412,7 @@ clang-tools-extra17_package() {
 	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
+	conflicts="clang-tools-extra15>=0"
 	pkg_install() {
 		vmove usr/bin/clang-apply-replacements
 		vmove usr/bin/clang-change-namespace
@@ -450,13 +458,13 @@ lldb17_package() {
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
 	homepage="https://lldb.llvm.org/"
+	conflicts="lldb15>=0"
 	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-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -468,16 +476,26 @@ lldb17-devel_package() {
 	lib32disabled=yes
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
+	conflicts="lld15>=0"
 	pkg_install() {
 		vmove usr/bin/lld
 		vmove usr/bin/lld-link
@@ -492,6 +510,7 @@ lld17-devel_package() {
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
 	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	conflicts="lld15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -576,17 +595,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +682,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
@@ -685,6 +713,7 @@ llvm17-doc_package() {
 llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
+	conflicts="llvm15-devel>=0"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 0fed7fdb7d8a5073e61784266a2b128116df1e64 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.4

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 774 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1338 insertions(+), 12 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/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 bc9eb978e05681..20903b123b8e1c 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -979,21 +979,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.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18.1 libclang18-18.1.4_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.4_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.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..ac0f5fdbb7ac8b
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,774 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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 <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	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
+
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*)
+				vmove "usr/lib/libomptarget*.bc"
+				vmove "usr/lib/libomp*.a"
+			;;
+		esac
+	}
+}
+
+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+=" libomp-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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From c230403023f27a681683e2b3f1bfad57ac6b23c2 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From b69b6dbe5d25acdde5fad7e3327198ab0deeb215 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From 17ca21eb6f288175486d066f39308d2d1ae5199d Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..465cf877b3526c 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (32 preceding siblings ...)
  2024-05-01 13:05 ` Calandracas606
@ 2024-05-03 15:04 ` Calandracas606
  2024-05-04  3:08 ` Calandracas606
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-05-03 15:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**


#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**


<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - x86_64-musl
  - i686
  - aarch64-musl (cross)
  - armv7l (cross)
  - armv6l-musl (cross)

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 80979 bytes --]

From 6675b0232c2a764f5e1fccf2e214def41aa7fde0 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 9026a345c9c24e5db25eb5e06865becd13613bed Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |   2 +
 srcpkgs/compiler-rt17   |   1 +
 srcpkgs/liblldb17       |   1 +
 srcpkgs/llvm17/template | 109 +++++++++++++++++++++++++---------------
 srcpkgs/llvm17/update   |   2 +-
 5 files changed, 74 insertions(+), 41 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17

diff --git a/common/shlibs b/common/shlibs
index 1ec4e5b0c6abd7..b65ce9eb059372 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -981,6 +981,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..15ee6c55dba5ac 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -42,14 +41,21 @@ license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
 checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+conflicts="llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
 build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
 
+if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
+	build_options_default+=" flang bolt"
+fi
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +64,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +85,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +103,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_enabled_runtimes="compiler-rt"
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
+	_enabled_runtimes+=";libcxxabi;libcxx"
 
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	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+=" libomp libomp-devel "
+	fi
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +207,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +290,9 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
+	conflicts="clang15>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +316,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -335,6 +341,7 @@ clang17-devel_package() {
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
 	 llvm17>=${version}_${revision}"
+	conflicts="clang15-devel>=0"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17>=${version}_${revision}"
 	fi
@@ -348,8 +355,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +387,8 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
+	pycompile_dirs="usr/share/scan-view"
+	conflicts="clang-analyzer15>=0"
 	pkg_install() {
 		vmove usr/share/scan-view
 		vmove usr/share/scan-build
@@ -405,6 +412,7 @@ clang-tools-extra17_package() {
 	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
+	conflicts="clang-tools-extra15>=0"
 	pkg_install() {
 		vmove usr/bin/clang-apply-replacements
 		vmove usr/bin/clang-change-namespace
@@ -450,13 +458,13 @@ lldb17_package() {
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
 	homepage="https://lldb.llvm.org/"
+	conflicts="lldb15>=0"
 	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-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -468,16 +476,26 @@ lldb17-devel_package() {
 	lib32disabled=yes
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
+	conflicts="lld15>=0"
 	pkg_install() {
 		vmove usr/bin/lld
 		vmove usr/bin/lld-link
@@ -492,6 +510,7 @@ lld17-devel_package() {
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
 	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	conflicts="lld15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -576,17 +595,26 @@ libomp-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
 	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
 			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
 			vmove "usr/lib/libomp*.a"
 		fi
 	}
@@ -654,7 +682,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
@@ -685,6 +713,7 @@ llvm17-doc_package() {
 llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
+	conflicts="llvm15-devel>=0"
 	if [ "$build_option_openmp" ]; then
 		depends+=" libomp-devel>=${version}_${revision} "
 	fi
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 34eff85e2909dbbb9a5aa562ffbc9c3b838c0500 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.4

---
 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/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 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                       | 774 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1338 insertions(+), 12 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/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 b65ce9eb059372..29270e1d395dbb 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -980,21 +980,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.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18.1 libclang18-18.1.4_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.4_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.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libllvm18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..1f418dc969a832 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/lld-devel18 b/srcpkgs/lld-devel18
new file mode 120000
index 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..ac0f5fdbb7ac8b
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,774 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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 <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+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"
+
+# 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"
+
+	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+=" libomp libomp-devel "
+	fi
+
+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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+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"
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	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
+
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*)
+				vmove "usr/lib/libomptarget*.bc"
+				vmove "usr/lib/libomp*.a"
+			;;
+		esac
+	}
+}
+
+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+=" libomp-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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From 5d057119d09f8e53a91addf3a9be45af16ce5e7f Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From a2490a700e1b76f8094c220388348f715c9ae3bc Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From 240326caf798a5ac1ffe1dc2cfd15f6ab59f62f5 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..465cf877b3526c 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PR PATCH] [Updated] New package: llvm18
  2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
                   ` (33 preceding siblings ...)
  2024-05-03 15:04 ` Calandracas606
@ 2024-05-04  3:08 ` Calandracas606
  34 siblings, 0 replies; 36+ messages in thread
From: Calandracas606 @ 2024-05-04  3:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

There is an updated pull request by Calandracas606 against master on the void-packages repository

https://github.com/Calandracas606/void-packages llvm18
https://github.com/void-linux/void-packages/pull/48661

New package: llvm18
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**


#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**


<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64-musl
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - x86_64-musl
  - i686
  - aarch64-musl (cross)
  - armv7l (cross)
  - armv6l-musl (cross)

[ci skip]



A patch file from https://github.com/void-linux/void-packages/pull/48661.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-llvm18-48661.patch --]
[-- Type: text/x-diff, Size: 83360 bytes --]

From 6675b0232c2a764f5e1fccf2e214def41aa7fde0 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Wed, 14 Feb 2024 11:41:33 -0500
Subject: [PATCH 1/6] llvm15: fix update file

---
 srcpkgs/llvm15/update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm15/update b/srcpkgs/llvm15/update
index e95cf26b3586b7..baa6a6b6acf9a7 100644
--- a/srcpkgs/llvm15/update
+++ b/srcpkgs/llvm15/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(15)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 224916c45a8c0ce1a9da4d6f2cd65638aaa592de Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:40:47 -0500
Subject: [PATCH 2/6] llvm17: cross compile compiler-rt properly, add liblldb17

---
 common/shlibs           |   2 +
 srcpkgs/compiler-rt17   |   1 +
 srcpkgs/liblldb17       |   1 +
 srcpkgs/libomp          |   2 +-
 srcpkgs/libomp-devel    |   2 +-
 srcpkgs/libomp17        |   1 +
 srcpkgs/libomp17-devel  |   1 +
 srcpkgs/llvm/template   |  12 ++++
 srcpkgs/llvm17/template | 131 +++++++++++++++++++++++++---------------
 srcpkgs/llvm17/update   |   2 +-
 10 files changed, 102 insertions(+), 53 deletions(-)
 create mode 120000 srcpkgs/compiler-rt17
 create mode 120000 srcpkgs/liblldb17
 create mode 120000 srcpkgs/libomp17
 create mode 120000 srcpkgs/libomp17-devel

diff --git a/common/shlibs b/common/shlibs
index 1ec4e5b0c6abd7..b65ce9eb059372 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -981,6 +981,8 @@ 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.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
 libclang.so.17 libclang17-17.0.6_1
 libclang.so.15 libclang15-15.0.7_4
diff --git a/srcpkgs/compiler-rt17 b/srcpkgs/compiler-rt17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/compiler-rt17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/liblldb17 b/srcpkgs/liblldb17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/liblldb17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index 96970d5c02c13a..0d68131b9b3088 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index 96970d5c02c13a..0d68131b9b3088 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm17
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/libomp17 b/srcpkgs/libomp17
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/libomp17
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/libomp17-devel b/srcpkgs/libomp17-devel
new file mode 120000
index 00000000000000..96970d5c02c13a
--- /dev/null
+++ b/srcpkgs/libomp17-devel
@@ -0,0 +1 @@
+llvm17
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index b27a80da2fee1e..cfd6911fc8719b 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -57,3 +57,15 @@ libllvm_package() {
 	depends="libllvm${version}>=0"
 	short_desc+=" - transitional meta package"
 }
+
+libomp_package() {
+	build_style=meta
+	depends="libomp${version}>=0"
+	short_desc+=" - transitional meta package"
+}
+
+libomp-devel_package() {
+	build_style=meta
+	depends="libomp${version}-devel>=0"
+	short_desc+=" - transitional meta package"
+}
diff --git a/srcpkgs/llvm17/template b/srcpkgs/llvm17/template
index de5603085382c1..4f6d15e1e0c932 100644
--- a/srcpkgs/llvm17/template
+++ b/srcpkgs/llvm17/template
@@ -1,11 +1,10 @@
 # Template file for 'llvm17'
 pkgname=llvm17
 version=17.0.6
-revision=2
+revision=3
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
-pycompile_dirs="usr/share/scan-view"
 configure_args="
  -DCMAKE_BUILD_TYPE=Release -Wno-dev
  -DENABLE_LINKER_BUILD_ID=YES
@@ -42,14 +41,21 @@ license="Apache-2.0"
 homepage="https://www.llvm.org"
 distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz"
 checksum=58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813
+conflicts="llvm15>=0"
 lib32disabled=yes
 python_version=3
 
-build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt"
-build_options_default="clang clang_tools_extra lld mlir libclc polly lldb"
+build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt openmp"
+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
+
+# build fails because compiler_rt generates armv7 instructions when target is armv6
 case "$XBPS_TARGET_MACHINE" in
-	x86_64*|aarch64*) build_options_default+=" flang bolt ";;
+	armv6*) ;;
+	*) configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" ;;
 esac
 
 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
@@ -58,8 +64,9 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 subpackages="libllvm17 llvm17-doc llvm17-devel"
-_enabled_projects=
-_enabled_runtimes=
+
+# use $(:) to silence xlint
+_enabled_projects=$(:)
 
 if [ "$build_option_clang" ]; then
 	_enabled_projects+="clang;"
@@ -78,7 +85,7 @@ if [ "$build_option_polly" ]; then
 fi
 if [ "$build_option_lldb" ]; then
 	_enabled_projects+="lldb;"
-	subpackages+=" lldb17 lldb17-devel "
+	subpackages+=" lldb17 lldb17-devel liblldb17 "
 fi
 if [ "$build_option_lld" ]; then
 	_enabled_projects+="lld;"
@@ -96,42 +103,35 @@ if [ "$build_option_flang" ]; then
 	subpackages+=" flang17 flang17-devel "
 fi
 
+subpackages+=" compiler-rt17 "
+_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+=" libomp17 libomp17-devel "
+fi
+
 # enable if runtime subpackages link to this version of llvm
-if true; then
+if false; then
 	subpackages+=" llvm-libunwind llvm-libunwind-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libunwind"
+	_enabled_runtimes+=";libunwind"
 
 	subpackages+=" libcxx libcxx-devel libcxxabi libcxxabi-devel "
-	_enabled_runtimes+="${_enabled_runtimes:+;}libcxxabi;libcxx"
-
-	subpackages+=" compiler-rt "
-	_enabled_runtimes+="${_enabled_runtimes:+;}compiler-rt"
-
-	case "$XBPS_TARGET_MACHINE" in
-		x86_64*|aarch64*)
-			# openmp fails when built as runtime if cross-compiled
-			if [ "$CROSS_BUILD" ]; then
-				_enabled_projects+="openmp;"
-			else
-				_enabled_runtimes+="${_enabled_runtimes:+;}openmp"
-			fi
-			subpackages+=" libomp libomp-devel "
-			;;
-	esac
-
-	configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+	_enabled_runtimes+=";libcxxabi;libcxx"
 fi
 
+configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
 configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" llvm17-cross-tools"
-	# Seems to require a full host llvm/clang build
-	configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
-	configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
 fi
 
-
 # For OCaml bindings and lldb lua scripting
 if [ -z "$CROSS_BUILD" ]; then
 	subpackages+=" llvm17-cross-tools"
@@ -207,7 +207,9 @@ pre_configure() {
 	case "$XBPS_TARGET_MACHINE" in
 	arm*-musl|i686-musl|riscv64-musl)
 		# sanitizer code is broken since it duplicates some libc bits
-		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+		configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_XRAY=NO"
+		configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=NO"
 		;;
 	esac
 
@@ -288,7 +290,9 @@ post_install() {
 
 clang17_package() {
 	lib32disabled=yes
-	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel"
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 compiler-rt17>=0"
+	conflicts="clang15>=0"
 	short_desc+=" - C language family frontend"
 	homepage="https://clang.llvm.org/"
 	pkg_install() {
@@ -312,6 +316,8 @@ clang17_package() {
 		vmove usr/bin/diagtool
 		vmove usr/bin/amdgpu-arch
 		vmove usr/bin/nvptx-arch
+		vmove usr/bin/hmaptool
+		vmove usr/bin/git-clang-format
 		vmove usr/share/man/man1/clang.1
 		vmove usr/share/man/man1/diagtool.1
 		if [ "$build_option_polly" ]; then
@@ -335,6 +341,7 @@ clang17-devel_package() {
 	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
 	 clang17>=${version}_${revision} clang-analyzer17>=${version}_${revision}
 	 llvm17>=${version}_${revision}"
+	conflicts="clang15-devel>=0"
 	if [ "$build_option_clang_tools_extra" ]; then
 		depends+=" clang-tools-extra17>=${version}_${revision}"
 	fi
@@ -348,8 +355,6 @@ clang17-devel_package() {
 		vmove "usr/lib/libclang*.a"
 		vmove "usr/lib/libclang*.so"
 		vmove usr/share/clang
-		vmove usr/bin/hmaptool
-		vmove usr/bin/git-clang-format
 		if [ "$build_option_clang_tools_extra" ]; then
 			vmove usr/include/clang-tidy
 			vmove usr/lib/libfindAllSymbols.a
@@ -382,6 +387,8 @@ clang-analyzer17_package() {
 	depends="clang17>=${version}_${revision} python3 perl"
 	short_desc+=" - A source code analysis framework"
 	homepage="https://clang-analyzer.llvm.org/"
+	pycompile_dirs="usr/share/scan-view"
+	conflicts="clang-analyzer15>=0"
 	pkg_install() {
 		vmove usr/share/scan-view
 		vmove usr/share/scan-build
@@ -405,6 +412,7 @@ clang-tools-extra17_package() {
 	depends="clang17>=${version}_${revision} python3"
 	short_desc+=" - Extra Clang tools"
 	homepage="https://clang.llvm.org/extra/"
+	conflicts="clang-tools-extra15>=0"
 	pkg_install() {
 		vmove usr/bin/clang-apply-replacements
 		vmove usr/bin/clang-change-namespace
@@ -450,13 +458,13 @@ lldb17_package() {
 	depends+=" python3-six"
 	short_desc+=" - LLDB debugger"
 	homepage="https://lldb.llvm.org/"
+	conflicts="lldb15>=0"
 	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-vscode
-		vmove "usr/lib/liblldb*.so.*"
 		vmove "usr/lib/python${py3_ver}/site-packages/lldb"
 		if [ -z "$CROSS_BUILD" ]; then
 			vmove /usr/lib/lua/5.3/lldb.so
@@ -468,16 +476,26 @@ lldb17-devel_package() {
 	lib32disabled=yes
 	depends="lldb17>=${version}_${revision}"
 	short_desc+=" - LLDB debugger - development files"
+	conflicts="lldb15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lldb
 		vmove "usr/lib/liblldb*.so"
 	}
 }
 
+liblldb17_package() {
+	lib32disabled=yes
+	short_desc+=" - LLDB debugger - runtime library"
+	pkg_install() {
+		vmove "usr/lib/liblldb*.so.*"
+	}
+}
+
 lld17_package() {
 	lib32disabled=yes
 	short_desc+=" - linker"
 	homepage="https://lld.llvm.org"
+	conflicts="lld15>=0"
 	pkg_install() {
 		vmove usr/bin/lld
 		vmove usr/bin/lld-link
@@ -492,6 +510,7 @@ lld17-devel_package() {
 	short_desc+=" - linker - development files"
 	homepage="https://lld.llvm.org"
 	depends="lld17>=${version}_${revision} llvm17>=${version}_${revision}"
+	conflicts="lld15-devel>=0"
 	pkg_install() {
 		vmove usr/include/lld
 		vmove usr/lib/cmake/lld
@@ -565,30 +584,41 @@ flang17-devel_package() {
 	}
 }
 
-libomp_package() {
+libomp17_package() {
 	short_desc+=" - Clang OpenMP support library"
 	pkg_install() {
 		vmove "usr/lib/libomp*.so.*"
 	}
 }
 
-libomp-devel_package() {
+libomp17-devel_package() {
 	short_desc+=" - Clang OpenMP support library - development files"
-	depends="libomp>=${version}_${revision} llvm17>=${version}_${revision}"
+	depends="libomp17>=${version}_${revision} llvm17>=${version}_${revision}"
 	pkg_install() {
-		vmove usr/bin/llvm-omp-device-info
-		vmove usr/bin/llvm-omp-kernel-replay
-		vmove "usr/lib/libarcher*.so"
+		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
-			vmove "usr/lib/libomptarget*.bc"
-			vmove "usr/lib/libarcher*.a"
-			vmove "usr/lib/libomp*.a"
-		fi
+
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*)
+				vmove "usr/lib/libomptarget*.bc"
+				vmove "usr/lib/libomp*.a"
+			;;
+		esac
 	}
 }
 
@@ -654,7 +684,7 @@ libcxx-devel_package() {
 	}
 }
 
-compiler-rt_package() {
+compiler-rt17_package() {
 	short_desc+=" - runtime libraries"
 	homepage="https://compiler-rt.llvm.org/"
 	pkg_install() {
@@ -685,8 +715,9 @@ llvm17-doc_package() {
 llvm17-devel_package() {
 	short_desc+=" - development files"
 	depends="llvm17>=${version}_${revision}"
+	conflicts="llvm15-devel>=0"
 	if [ "$build_option_openmp" ]; then
-		depends+=" libomp-devel>=${version}_${revision} "
+		depends+=" libomp17-devel>=${version}_${revision} "
 	fi
 	if [ "$build_option_mlir" ]; then
 		depends+=" mlir17-devel>=${version}_${revision} "
diff --git a/srcpkgs/llvm17/update b/srcpkgs/llvm17/update
index e95cf26b3586b7..cc8edb6c005acb 100644
--- a/srcpkgs/llvm17/update
+++ b/srcpkgs/llvm17/update
@@ -1,3 +1,3 @@
 site="https://github.com/llvm/llvm-project/releases"
-pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+pattern="llvmorg-\K(17)\.(\d+)\.+\d+(-rc\d+)?"
 ignore="*-rc*"

From 6e48a4794e23f8d05de9199153e12f949ec146b2 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Tue, 30 Jan 2024 10:43:36 -0500
Subject: [PATCH 3/6] New package: llvm18-18.1.4

---
 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                       | 776 ++++++++++++++++++
 srcpkgs/llvm18/update                         |   3 +
 srcpkgs/mlir18                                |   1 +
 srcpkgs/mlir18-devel                          |   1 +
 56 files changed, 1340 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 b65ce9eb059372..29270e1d395dbb 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -980,21 +980,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.4_1
 liblldb.so.17 liblldb17-17.0.6_3
 liblldb.so.15 lldb15-15.0.7_4
+libclang.so.18.1 libclang18-18.1.4_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.4_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.4_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.4_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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/libclang18
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 96970d5c02c13a..1f418dc969a832 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 96970d5c02c13a..1f418dc969a832 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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..2fa08c9be69621
--- /dev/null
+++ b/srcpkgs/llvm18/files/llvm-Config-llvm-config.h
@@ -0,0 +1,9 @@
+#include <bits/wordsize.h>
+
+#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 00000000000000..ac10d306c4346d
--- /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 <typename T> 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<T>` but `sizeof(T)` is really big! Please use an "
+       "explicit number of inlined elements with `SmallVector<T, N>` 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 00000000000000..cb17121dea2021
--- /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 <q66@chimera-linux.org>
+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<unsigned> 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<unsigned> llvm::thread::DefaultStackSize = 4 * 1024 * 1024;
+-#else
+-const std::optional<unsigned> 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 00000000000000..e4eaa7783e7a6c
--- /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 <miwaxe@gmail.com>
+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(<unwind.h>)
+ /* 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 <stdint.h>
+ 
+ #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 00000000000000..0ef4c7e75d6b58
--- /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 00000000000000..4ad6412d1e6c63
--- /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 00000000000000..3aed07b8569404
--- /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 <sys/utsname.h>
+ #  endif
+ 
++#if SANITIZER_LINUX && defined(__powerpc__)
++#include <asm/ptrace.h>
++#endif
++
+ #  if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #    include <sys/personality.h>
+ #  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 <utime.h>
+ # include <sys/ptrace.h>
+ #    if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
+-        defined(__hexagon__) || defined(__loongarch__) ||SANITIZER_RISCV64
++        defined(__hexagon__) || defined(__powerpc__) || defined(__loongarch__) ||SANITIZER_RISCV64
+ #      include <asm/ptrace.h>
+ #      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 <sys/types.h> // for pid_t
+ #include <sys/uio.h> // for iovec
+ #include <elf.h> // 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 <asm/ptrace.h>
+ #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 00000000000000..c9b9286ac37b31
--- /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 00000000000000..700ab134790452
--- /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<char>::__x() const [clone .localalias]':
+locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE3__xEv+0xb4): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~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<char>::__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 00000000000000..0dd5f0e7eb8a8b
--- /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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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<decltype(errno)> __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 00000000000000..70292beb2fcdbd
--- /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 00000000000000..e872d263de30f5
--- /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 00000000000000..9a622cd9254c2e
--- /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 00000000000000..8652e4af69f7c2
--- /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 <miwaxe@gmail.com>
+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 <typename T> 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 00000000000000..51d0e4b31b32c3
--- /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 00000000000000..d332687b9d9295
--- /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 <samuel@sholland.org>
+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 00000000000000..192b4824b8695c
--- /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 00000000000000..57e73521df8690
--- /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 <string>
++#include <stdint.h>
+ 
+ #ifdef _WIN32
+ constexpr bool OSWindows = true;
diff --git a/srcpkgs/llvm18/template b/srcpkgs/llvm18/template
new file mode 100644
index 00000000000000..86c786b114616e
--- /dev/null
+++ b/srcpkgs/llvm18/template
@@ -0,0 +1,776 @@
+# Template file for 'llvm18'
+pkgname=llvm18
+version=18.1.4
+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 <danielmartinez@cock.li>"
+license="Apache-2.0"
+homepage="https://www.llvm.org"
+distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
+checksum=deca5a29e8b1d103ecc4badb3c304aca50d5cac6453364d88ee415dc55699dfb
+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
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*) vmove usr/lib/libbolt_rt_instr.a
+				 vmove usr/lib/libbolt_rt_hugify.a
+				;;
+		esac
+	}
+}
+
+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
+
+		case "$XBPS_TARGET_MACHINE" in
+			x86_64*)
+				vmove "usr/lib/libomptarget*.bc"
+				vmove "usr/lib/libomp*.a"
+			;;
+		esac
+	}
+}
+
+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 00000000000000..46844c65620f4c
--- /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 00000000000000..1f418dc969a832
--- /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 00000000000000..1f418dc969a832
--- /dev/null
+++ b/srcpkgs/mlir18-devel
@@ -0,0 +1 @@
+llvm18
\ No newline at end of file

From a59f65c93942eaefbab6ee6daf0a48ba53c283a6 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:08 -0500
Subject: [PATCH 4/6] New package: python3-mdit-py-plugins-0.4.0

---
 srcpkgs/python3-mdit-py-plugins/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-mdit-py-plugins/template

diff --git a/srcpkgs/python3-mdit-py-plugins/template b/srcpkgs/python3-mdit-py-plugins/template
new file mode 100644
index 00000000000000..86d8855ec232bc
--- /dev/null
+++ b/srcpkgs/python3-mdit-py-plugins/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-mdit-py-plugins'
+pkgname=python3-mdit-py-plugins
+version=0.4.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Markdown-It-Py Plugin Extensions"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://mdit-py-plugins.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/mdit-py-plugins/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/mdit-py-plugins/archive/refs/tags/v${version}.tar.gz"
+checksum=e156efb677d0a660b8f9a5807bf48c6754d94f4f95996b36e17f131056a69e1a
+
+post_install() {
+	vlicense LICENSE
+}

From 4e038e64e6502aedf8af34901c3ab1b3ae05885e Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Sun, 11 Feb 2024 17:07:17 -0500
Subject: [PATCH 5/6] New package: python3-MyST-Parser-2.0.0

---
 srcpkgs/python3-MyST-Parser/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/python3-MyST-Parser/template

diff --git a/srcpkgs/python3-MyST-Parser/template b/srcpkgs/python3-MyST-Parser/template
new file mode 100644
index 00000000000000..aa89dcc2d5a5d8
--- /dev/null
+++ b/srcpkgs/python3-MyST-Parser/template
@@ -0,0 +1,17 @@
+# Template file for 'python3-MyST-Parser'
+pkgname=python3-MyST-Parser
+version=2.0.0
+revision=1
+build_style=python3-pep517
+hostmakedepends="python3-flit_core"
+short_desc="Sphinx and Docutils extension to parse MyST"
+maintainer="Daniel Martinez <danielmartinez@cock.li>"
+license="MIT"
+homepage="https://myst-parser.readthedocs.io"
+changelog="https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md"
+distfiles="https://github.com/executablebooks/MyST-Parser/archive/refs/tags/v${version}.tar.gz"
+checksum=6d03d257af6e7a4f336aaccd400e13537a85a0c260a58f95de51618c46b51579
+
+post_install() {
+	vlicense LICENSE
+}

From b561d1a88d103e2d2830025928030754f8a870e9 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez@cock.li>
Date: Mon, 12 Feb 2024 08:37:36 -0500
Subject: [PATCH 6/6] llvm: add compiler-rt.

---
 srcpkgs/compiler-rt   | 2 +-
 srcpkgs/llvm/template | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/compiler-rt b/srcpkgs/compiler-rt
index 1f418dc969a832..0d68131b9b3088 120000
--- a/srcpkgs/compiler-rt
+++ b/srcpkgs/compiler-rt
@@ -1 +1 @@
-llvm18
\ No newline at end of file
+llvm
\ No newline at end of file
diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index cfd6911fc8719b..6eda76b757c931 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -40,6 +40,12 @@ lldb_package() {
 	short_desc+=" - lldb"
 }
 
+compiler-rt_package() {
+	build_style=meta
+	depends="compiler-rt${version}>=0"
+	short_desc+=" - compiler-rt"
+}
+
 libclang_package() {
 	build_style=meta
 	depends="libclang${version}>=0"

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2024-05-04  3:08 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-11 22:16 [PR PATCH] New package: llvm18 Calandracas606
2024-02-12  2:16 ` [PR PATCH] [Updated] " Calandracas606
2024-02-12  3:02 ` Calandracas606
2024-02-12  3:18 ` Calandracas606
2024-02-12 15:56 ` Calandracas606
2024-02-15 11:51 ` [PR REVIEW] " sgn
2024-02-15 11:51 ` sgn
2024-02-15 11:52 ` sgn
2024-03-13 14:53 ` [PR PATCH] [Updated] " Calandracas606
2024-03-13 16:49 ` Calandracas606
2024-04-02 14:50 ` Calandracas606
2024-04-02 15:52 ` Calandracas606
2024-04-06  0:24 ` zlice
2024-04-06  1:37 ` Calandracas606
2024-04-06  1:41 ` zlice
2024-04-06 13:23 ` zlice
2024-04-10 15:00 ` leahneukirchen
2024-04-10 17:11 ` Calandracas606
2024-04-11  2:48 ` Calandracas606
2024-04-18 14:29 ` Calandracas606
2024-04-18 14:40 ` [PR PATCH] [Updated] " Calandracas606
2024-04-18 14:42 ` Calandracas606
2024-04-18 14:55 ` Calandracas606
2024-04-18 15:07 ` [PR PATCH] [Updated] " Calandracas606
2024-04-18 15:54 ` Calandracas606
2024-04-18 21:08 ` Calandracas606
2024-04-18 21:52 ` Calandracas606
2024-04-22 22:28 ` [PR PATCH] [Updated] " Calandracas606
2024-04-23  3:12 ` Calandracas606
2024-04-29  2:54 ` Calandracas606
2024-04-29  2:55 ` Calandracas606
2024-04-29 21:58 ` Calandracas606
2024-05-01 12:41 ` Calandracas606
2024-05-01 13:05 ` Calandracas606
2024-05-03 15:04 ` Calandracas606
2024-05-04  3:08 ` Calandracas606

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).