Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: llvm16-16.0.3
@ 2023-05-03 23:51 Duncaen
  2023-05-04  1:10 ` [PR PATCH] [Updated] " Duncaen
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Duncaen @ 2023-05-03 23:51 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From 48864f058720cf2f9f8f59310b1cb6eae39c40e2 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH] New package: llvm16-16.0.3

---
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 srcpkgs/llvm16/template                       | 453 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 33 files changed, 966 insertions(+), 15 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/srcpkgs/clang b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..bc7f23f71f9c
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,453 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
@ 2023-05-04  1:10 ` Duncaen
  2023-05-04  1:12 ` Duncaen
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-04  1:10 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From 47a6a338a52139543f5d6f84566dd813c8c887f9 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH] New package: llvm16-16.0.3

---
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 35 files changed, 1098 insertions(+), 15 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/srcpkgs/clang b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..83c84186c543
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
  2023-05-04  1:10 ` [PR PATCH] [Updated] " Duncaen
@ 2023-05-04  1:12 ` Duncaen
  2023-05-04  1:21 ` Duncaen
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-04  1:12 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From f8cd4e95642c3a3eb165c96540703ec684c9327d Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH] New package: llvm16-16.0.3

---
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 35 files changed, 1098 insertions(+), 15 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/srcpkgs/clang b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..c02e8f3d6fa2
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS=YES
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
  2023-05-04  1:10 ` [PR PATCH] [Updated] " Duncaen
  2023-05-04  1:12 ` Duncaen
@ 2023-05-04  1:21 ` Duncaen
  2023-05-04  1:34 ` Duncaen
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-04  1:21 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From 6fde1348e39d5d1c3e01f5edb059542c8b6d00c9 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH] New package: llvm16-16.0.3

---
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 35 files changed, 1098 insertions(+), 15 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/srcpkgs/clang b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..e1f9280b690b
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS=YES
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		# vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (2 preceding siblings ...)
  2023-05-04  1:21 ` Duncaen
@ 2023-05-04  1:34 ` Duncaen
  2023-05-04 11:33 ` Duncaen
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-04  1:34 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From ee2e097149f84be9f7d47762ced4295f03cc41fa Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH] New package: llvm16-16.0.3

---
 common/shlibs                                 |  11 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 38 files changed, 1106 insertions(+), 22 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/common/shlibs b/common/shlibs
index 8c47e79b8c43..85617f9a4884 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -990,15 +990,16 @@ 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.15 lldb-15.0.7_1
-libclang.so.15 libclang-15.0.7_1
-libclang-cpp.so.15 libclang-cpp-15.0.7_1
+liblldb.so.16 lldb-16.0.7_1
+libclang.so.16 libclang-16.0.3_1
+libclang-cpp.so.16 libclang-cpp-16.0.3_1
 libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
-libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
+libLLVM-16.so libllvm16-16.0.3_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.3_1
 libomp.so.5 libomp-15.0.7_1
-libomptarget.so.15 libomp-15.0.7_1
+libomptarget.so.16 libomp-16.0.7_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 b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..e1f9280b690b
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS=YES
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		# vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (3 preceding siblings ...)
  2023-05-04  1:34 ` Duncaen
@ 2023-05-04 11:33 ` Duncaen
  2023-05-04 11:40 ` Duncaen
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-04 11:33 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From 8c04f9e9b505c146bda9b8d128d0d34d084fd191 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH 01/17] New package: llvm16-16.0.3

---
 common/shlibs                                 |  11 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 38 files changed, 1106 insertions(+), 22 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/common/shlibs b/common/shlibs
index 8c47e79b8c43..85617f9a4884 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -990,15 +990,16 @@ 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.15 lldb-15.0.7_1
-libclang.so.15 libclang-15.0.7_1
-libclang-cpp.so.15 libclang-cpp-15.0.7_1
+liblldb.so.16 lldb-16.0.7_1
+libclang.so.16 libclang-16.0.3_1
+libclang-cpp.so.16 libclang-cpp-16.0.3_1
 libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
-libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
+libLLVM-16.so libllvm16-16.0.3_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.3_1
 libomp.so.5 libomp-15.0.7_1
-libomptarget.so.15 libomp-15.0.7_1
+libomptarget.so.16 libomp-16.0.7_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 b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..e1f9280b690b
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS=YES
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		# vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

From bfacd6d80206befc77d31d66d3209a274a63d3e9 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 02/17] CastXML: rebuild for llvm16-16.0.3_1

---
 srcpkgs/CastXML/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/CastXML/template b/srcpkgs/CastXML/template
index de0920900ae4..323f61224ba9 100644
--- a/srcpkgs/CastXML/template
+++ b/srcpkgs/CastXML/template
@@ -1,7 +1,7 @@
 # Template file for 'CastXML'
 pkgname=CastXML
 version=0.5.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DSPHINX_MAN=YES -DCastXML_INSTALL_MAN_DIR=share/man"
 hostmakedepends="clang python3-Sphinx"

From 8128a6062ff655bacb61ed1ece38a5eed230dc2c Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 03/17] SPIRV-LLVM-Translator: rebuild for llvm16-16.0.3_1

---
 srcpkgs/SPIRV-LLVM-Translator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index bee99f9bcbb2..bb358d38c142 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -1,7 +1,7 @@
 # Template file for 'SPIRV-LLVM-Translator'
 pkgname=SPIRV-LLVM-Translator
 version=15.0.0
-revision=1
+revision=2
 build_style=cmake
 make_build_args="llvm-spirv"
 configure_args="-Wno-dev -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_SKIP_RPATH=ON

From c7b53be9d20dd5cd89646c5444e125da7f68be80 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 04/17] bcc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bcc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 1b690066612f..970178656ddd 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.27.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version} -DENABLE_LLVM_SHARED=1"
 hostmakedepends="flex python3-setuptools"

From 9ddf558e171492427415a6b52fed6eda60994b83 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 05/17] bpftrace: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bpftrace/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index ad1bd0f50e73..549e8ad670a1 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.17.1
-revision=1
+revision=2
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
 configure_args="-DUSE_SYSTEM_BPF_BCC=ON -DBUILD_TESTING=OFF" # needs root to run

From eb78e9de040d6f8d676d6cb8a9a89c6f6181d08a Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 06/17] ccls: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index ecc9f3e38a5d..ff74d135a1c4 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20220729
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang-tools-extra libxml2-devel llvm ncurses-devel rapidjson zlib-devel"

From 2825046a086b0959637118fbfb5e72f98f550417 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 07/17] clazy: rebuild for llvm16-16.0.3_1

---
 srcpkgs/clazy/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index f81de08ab836..bdec40488d6a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.11
-revision=2
+revision=3
 build_style=cmake
 build_helper=qemu
 hostmakedepends="llvm"

From 26be23918f9859bcc7427d2c118b29dbe09a6689 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 08/17] include-what-you-use: rebuild for llvm16-16.0.3_1

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 1a30bc04bb2d..b9190c260eda 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.19
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
 hostmakedepends="python3"

From fa875abf11f98629c7a199174855d8c3f5b02edf Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 09/17] ispc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index fbfa4f6db420..44489dee9a2e 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.19.0
-revision=2
+revision=3
 archs="aarch64* x86_64*"
 build_style=cmake
 configure_args="-DISPC_INCLUDE_EXAMPLES=OFF -DISPC_INCLUDE_RT=OFF"

From b60cbc26cd0e1129f03dd0c3660b19fbf4fb572a Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 10/17] ldc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ldc/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index f6d8b7ffbe98..90953ae27fcc 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,7 +1,7 @@
 # Template file for 'ldc'
 pkgname=ldc
 version=1.31.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="
  -DINCLUDE_INSTALL_DIR=/usr/include/dlang/ldc
@@ -11,7 +11,7 @@ configure_args="
  -DCOMPILE_D_MODULES_SEPARATELY=ON
  -DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm15 perl pkg-config"
+hostmakedepends="dmd llvm16 perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
  llvm-libunwind-devel"
 depends="ldc-runtime llvm-libunwind-devel"

From 4b49b61963e2c4d8be3914face57e1d7bed9e360 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 11/17] llvm16: rebuild for llvm16-16.0.3_1

---
 srcpkgs/llvm16/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
index e1f9280b690b..574089d68044 100644
--- a/srcpkgs/llvm16/template
+++ b/srcpkgs/llvm16/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm16'
 pkgname=llvm16
 version=16.0.3
-revision=1
+revision=2
 build_wrksrc=llvm
 build_style=cmake
 _ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"

From 36e7e6fd8dbe586f7d3552c2ef298d77d16b6a2d Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 12/17] mesa: rebuild for llvm16-16.0.3_1

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 132263d3599f..f95c2f2f5736 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=22.3.5
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled

From 4fe2c4898398e596589f0416a7d42d4eff6ab311 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 13/17] qt6-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt6-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index d5ad1618e3a7..c49c69f73901 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'qt6-tools'
 pkgname=qt6-tools
 version=6.4.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON

From 76b97bc996c0eb409467ed605b45b376ec96055e Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 14/17] qtcreator: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index b1dffd304198..046ca9cba57c 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=9.0.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="$(vopt_bool qbs BUILD_QBS) -DWITH_DOCS=ON -DBUILD_WITH_PCH=OFF
  -DQT_HOST_PATH=/usr/ -DQT_HOST_PATH_CMAKE_DIR=/usr/lib64/cmake/Qt6"

From c4d607b0729da0a2e9ad3960a1b7ee347c4eee31 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 15/17] rust: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rust/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template
index 88e35a5a43ad..53de9ac72231 100644
--- a/srcpkgs/rust/template
+++ b/srcpkgs/rust/template
@@ -9,9 +9,9 @@
 #
 pkgname=rust
 version=1.69.0
-revision=1
+revision=2
 hostmakedepends="cmake curl pkg-config python3 tar cargo-bootstrap"
-makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm15"
+makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm16"
 depends="rust-std"
 short_desc="Safe, concurrent, practical systems language"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -33,7 +33,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" rust llvm15"
+	hostmakedepends+=" rust llvm16"
 	# These are required for building the buildhost's stage0/1
 	hostmakedepends+=" libffi-devel libxml2-devel ncurses-devel zlib-devel"
 else

From b0481cfc01d5920e55c0ab326a0c0c470da24410 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 16/17] zig: rebuild for llvm16-16.0.3_1

---
 srcpkgs/zig/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index 9807f7ab206b..606e22c93d88 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,13 +1,13 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.10.1
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
 # we add xml2, zstd, zlib and ncurses
 # because our lld is static-only and requires those to work
-makedepends="clang llvm15 lld-devel libxml2-devel libzstd-devel ncurses-devel zlib-devel"
+makedepends="clang llvm16 lld-devel libxml2-devel libzstd-devel ncurses-devel zlib-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Isaac Freund <mail@isaacfreund.com>"
 license="MIT"

From 3ada2e0024b0d3dc7579957296dd39077a3f9219 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:28:52 +0200
Subject: [PATCH 17/17] llvm: update to 16.

---
 srcpkgs/llvm/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index fc1c850bd26f..5a88372fb672 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=15
+version=16
 revision=1
 build_style=meta
-depends="llvm15"
+depends="llvm16"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (4 preceding siblings ...)
  2023-05-04 11:33 ` Duncaen
@ 2023-05-04 11:40 ` Duncaen
  2023-05-04 19:41 ` Duncaen
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-04 11:40 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From 8c04f9e9b505c146bda9b8d128d0d34d084fd191 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH 01/16] New package: llvm16-16.0.3

---
 common/shlibs                                 |  11 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 38 files changed, 1106 insertions(+), 22 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/common/shlibs b/common/shlibs
index 8c47e79b8c43..85617f9a4884 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -990,15 +990,16 @@ 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.15 lldb-15.0.7_1
-libclang.so.15 libclang-15.0.7_1
-libclang-cpp.so.15 libclang-cpp-15.0.7_1
+liblldb.so.16 lldb-16.0.7_1
+libclang.so.16 libclang-16.0.3_1
+libclang-cpp.so.16 libclang-cpp-16.0.3_1
 libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
-libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
+libLLVM-16.so libllvm16-16.0.3_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.3_1
 libomp.so.5 libomp-15.0.7_1
-libomptarget.so.15 libomp-15.0.7_1
+libomptarget.so.16 libomp-16.0.7_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 b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..e1f9280b690b
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS=YES
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		# vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

From bfacd6d80206befc77d31d66d3209a274a63d3e9 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 02/16] CastXML: rebuild for llvm16-16.0.3_1

---
 srcpkgs/CastXML/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/CastXML/template b/srcpkgs/CastXML/template
index de0920900ae4..323f61224ba9 100644
--- a/srcpkgs/CastXML/template
+++ b/srcpkgs/CastXML/template
@@ -1,7 +1,7 @@
 # Template file for 'CastXML'
 pkgname=CastXML
 version=0.5.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DSPHINX_MAN=YES -DCastXML_INSTALL_MAN_DIR=share/man"
 hostmakedepends="clang python3-Sphinx"

From 8128a6062ff655bacb61ed1ece38a5eed230dc2c Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 03/16] SPIRV-LLVM-Translator: rebuild for llvm16-16.0.3_1

---
 srcpkgs/SPIRV-LLVM-Translator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index bee99f9bcbb2..bb358d38c142 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -1,7 +1,7 @@
 # Template file for 'SPIRV-LLVM-Translator'
 pkgname=SPIRV-LLVM-Translator
 version=15.0.0
-revision=1
+revision=2
 build_style=cmake
 make_build_args="llvm-spirv"
 configure_args="-Wno-dev -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_SKIP_RPATH=ON

From c7b53be9d20dd5cd89646c5444e125da7f68be80 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 04/16] bcc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bcc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 1b690066612f..970178656ddd 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.27.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version} -DENABLE_LLVM_SHARED=1"
 hostmakedepends="flex python3-setuptools"

From 9ddf558e171492427415a6b52fed6eda60994b83 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 05/16] bpftrace: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bpftrace/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index ad1bd0f50e73..549e8ad670a1 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.17.1
-revision=1
+revision=2
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
 configure_args="-DUSE_SYSTEM_BPF_BCC=ON -DBUILD_TESTING=OFF" # needs root to run

From eb78e9de040d6f8d676d6cb8a9a89c6f6181d08a Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 06/16] ccls: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index ecc9f3e38a5d..ff74d135a1c4 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20220729
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang-tools-extra libxml2-devel llvm ncurses-devel rapidjson zlib-devel"

From 2825046a086b0959637118fbfb5e72f98f550417 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 07/16] clazy: rebuild for llvm16-16.0.3_1

---
 srcpkgs/clazy/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index f81de08ab836..bdec40488d6a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.11
-revision=2
+revision=3
 build_style=cmake
 build_helper=qemu
 hostmakedepends="llvm"

From 26be23918f9859bcc7427d2c118b29dbe09a6689 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 08/16] include-what-you-use: rebuild for llvm16-16.0.3_1

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 1a30bc04bb2d..b9190c260eda 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.19
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
 hostmakedepends="python3"

From fa875abf11f98629c7a199174855d8c3f5b02edf Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 09/16] ispc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index fbfa4f6db420..44489dee9a2e 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.19.0
-revision=2
+revision=3
 archs="aarch64* x86_64*"
 build_style=cmake
 configure_args="-DISPC_INCLUDE_EXAMPLES=OFF -DISPC_INCLUDE_RT=OFF"

From b60cbc26cd0e1129f03dd0c3660b19fbf4fb572a Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 10/16] ldc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ldc/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index f6d8b7ffbe98..90953ae27fcc 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,7 +1,7 @@
 # Template file for 'ldc'
 pkgname=ldc
 version=1.31.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="
  -DINCLUDE_INSTALL_DIR=/usr/include/dlang/ldc
@@ -11,7 +11,7 @@ configure_args="
  -DCOMPILE_D_MODULES_SEPARATELY=ON
  -DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm15 perl pkg-config"
+hostmakedepends="dmd llvm16 perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
  llvm-libunwind-devel"
 depends="ldc-runtime llvm-libunwind-devel"

From 618e739d6560f1f65d2c95a42cd923ebf67de104 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 11/16] mesa: rebuild for llvm16-16.0.3_1

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 132263d3599f..f95c2f2f5736 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=22.3.5
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled

From 7161323bdf980af8493dcb0dfb71e2157e26c1f6 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 12/16] qt6-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt6-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index d5ad1618e3a7..c49c69f73901 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'qt6-tools'
 pkgname=qt6-tools
 version=6.4.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON

From 41e401f4e2360bb590e8887b7907c5b12d0ad495 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 13/16] qtcreator: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index b1dffd304198..046ca9cba57c 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=9.0.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="$(vopt_bool qbs BUILD_QBS) -DWITH_DOCS=ON -DBUILD_WITH_PCH=OFF
  -DQT_HOST_PATH=/usr/ -DQT_HOST_PATH_CMAKE_DIR=/usr/lib64/cmake/Qt6"

From d1a0ddb82e1a1e81703ba66e5ce80ad41c2cae09 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 14/16] rust: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rust/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template
index 88e35a5a43ad..53de9ac72231 100644
--- a/srcpkgs/rust/template
+++ b/srcpkgs/rust/template
@@ -9,9 +9,9 @@
 #
 pkgname=rust
 version=1.69.0
-revision=1
+revision=2
 hostmakedepends="cmake curl pkg-config python3 tar cargo-bootstrap"
-makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm15"
+makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm16"
 depends="rust-std"
 short_desc="Safe, concurrent, practical systems language"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -33,7 +33,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" rust llvm15"
+	hostmakedepends+=" rust llvm16"
 	# These are required for building the buildhost's stage0/1
 	hostmakedepends+=" libffi-devel libxml2-devel ncurses-devel zlib-devel"
 else

From 1efd503dda5d0b2ea005116b4183648674aa1588 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 15/16] zig: rebuild for llvm16-16.0.3_1

---
 srcpkgs/zig/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index 9807f7ab206b..606e22c93d88 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,13 +1,13 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.10.1
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
 # we add xml2, zstd, zlib and ncurses
 # because our lld is static-only and requires those to work
-makedepends="clang llvm15 lld-devel libxml2-devel libzstd-devel ncurses-devel zlib-devel"
+makedepends="clang llvm16 lld-devel libxml2-devel libzstd-devel ncurses-devel zlib-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
 maintainer="Isaac Freund <mail@isaacfreund.com>"
 license="MIT"

From ebee75c7b83834de09f77371c43311869c616084 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:28:52 +0200
Subject: [PATCH 16/16] llvm: update to 16.

---
 srcpkgs/llvm/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index fc1c850bd26f..5a88372fb672 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=15
+version=16
 revision=1
 build_style=meta
-depends="llvm15"
+depends="llvm16"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (5 preceding siblings ...)
  2023-05-04 11:40 ` Duncaen
@ 2023-05-04 19:41 ` Duncaen
  2023-05-04 19:43 ` Duncaen
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-04 19:41 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From 8c04f9e9b505c146bda9b8d128d0d34d084fd191 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH 01/18] New package: llvm16-16.0.3

---
 common/shlibs                                 |  11 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 38 files changed, 1106 insertions(+), 22 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/common/shlibs b/common/shlibs
index 8c47e79b8c43..85617f9a4884 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -990,15 +990,16 @@ 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.15 lldb-15.0.7_1
-libclang.so.15 libclang-15.0.7_1
-libclang-cpp.so.15 libclang-cpp-15.0.7_1
+liblldb.so.16 lldb-16.0.7_1
+libclang.so.16 libclang-16.0.3_1
+libclang-cpp.so.16 libclang-cpp-16.0.3_1
 libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
-libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
+libLLVM-16.so libllvm16-16.0.3_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.3_1
 libomp.so.5 libomp-15.0.7_1
-libomptarget.so.15 libomp-15.0.7_1
+libomptarget.so.16 libomp-16.0.7_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 b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..e1f9280b690b
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS=YES
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		# vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

From bfacd6d80206befc77d31d66d3209a274a63d3e9 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 02/18] CastXML: rebuild for llvm16-16.0.3_1

---
 srcpkgs/CastXML/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/CastXML/template b/srcpkgs/CastXML/template
index de0920900ae4..323f61224ba9 100644
--- a/srcpkgs/CastXML/template
+++ b/srcpkgs/CastXML/template
@@ -1,7 +1,7 @@
 # Template file for 'CastXML'
 pkgname=CastXML
 version=0.5.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DSPHINX_MAN=YES -DCastXML_INSTALL_MAN_DIR=share/man"
 hostmakedepends="clang python3-Sphinx"

From 41a2942d587ec8bcd2e226e53af5067bf61df581 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 03/18] bcc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bcc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 1b690066612f..970178656ddd 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.27.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version} -DENABLE_LLVM_SHARED=1"
 hostmakedepends="flex python3-setuptools"

From 7bc29d3919b54e3c988169b93f02b869f9fd90b5 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 04/18] bpftrace: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bpftrace/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index ad1bd0f50e73..549e8ad670a1 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.17.1
-revision=1
+revision=2
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
 configure_args="-DUSE_SYSTEM_BPF_BCC=ON -DBUILD_TESTING=OFF" # needs root to run

From bff4539a69dfb42e82d54a1dfbf94b0f6688bf49 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 05/18] ccls: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index ecc9f3e38a5d..ff74d135a1c4 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20220729
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang-tools-extra libxml2-devel llvm ncurses-devel rapidjson zlib-devel"

From d746d011a902f6b41c210d71a4d3a7329a2e757e Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 06/18] clazy: rebuild for llvm16-16.0.3_1

---
 srcpkgs/clazy/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index f81de08ab836..bdec40488d6a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.11
-revision=2
+revision=3
 build_style=cmake
 build_helper=qemu
 hostmakedepends="llvm"

From 8cb6006d1cee48fbbfbfc9138115b648957115c7 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 07/18] include-what-you-use: rebuild for llvm16-16.0.3_1

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 1a30bc04bb2d..b9190c260eda 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.19
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
 hostmakedepends="python3"

From eaaa8758cb8292bf86ce819ed766415356ef7d37 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 08/18] ispc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index fbfa4f6db420..44489dee9a2e 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.19.0
-revision=2
+revision=3
 archs="aarch64* x86_64*"
 build_style=cmake
 configure_args="-DISPC_INCLUDE_EXAMPLES=OFF -DISPC_INCLUDE_RT=OFF"

From 5afcd9bdbe746ae97d1ebe0d5dbe697bddbcd83f Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 09/18] ldc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ldc/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index f6d8b7ffbe98..90953ae27fcc 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,7 +1,7 @@
 # Template file for 'ldc'
 pkgname=ldc
 version=1.31.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="
  -DINCLUDE_INSTALL_DIR=/usr/include/dlang/ldc
@@ -11,7 +11,7 @@ configure_args="
  -DCOMPILE_D_MODULES_SEPARATELY=ON
  -DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm15 perl pkg-config"
+hostmakedepends="dmd llvm16 perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
  llvm-libunwind-devel"
 depends="ldc-runtime llvm-libunwind-devel"

From ab3e612e02b29678e3eb4195474595730554c775 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 10/18] mesa: rebuild for llvm16-16.0.3_1

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 132263d3599f..f95c2f2f5736 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=22.3.5
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled

From e93a79a8d248983ab6a59f6aad9f748c68e99e14 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 11/18] qt6-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt6-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index d5ad1618e3a7..c49c69f73901 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'qt6-tools'
 pkgname=qt6-tools
 version=6.4.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON

From 4379a27ee0d0aad0e2046c2c01d17f8f1576e0b2 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 12/18] qtcreator: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index b1dffd304198..046ca9cba57c 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=9.0.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="$(vopt_bool qbs BUILD_QBS) -DWITH_DOCS=ON -DBUILD_WITH_PCH=OFF
  -DQT_HOST_PATH=/usr/ -DQT_HOST_PATH_CMAKE_DIR=/usr/lib64/cmake/Qt6"

From 6d379d643c13e54d95028ce8a8210385631599fa Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 13/18] rust: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rust/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template
index 88e35a5a43ad..53de9ac72231 100644
--- a/srcpkgs/rust/template
+++ b/srcpkgs/rust/template
@@ -9,9 +9,9 @@
 #
 pkgname=rust
 version=1.69.0
-revision=1
+revision=2
 hostmakedepends="cmake curl pkg-config python3 tar cargo-bootstrap"
-makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm15"
+makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm16"
 depends="rust-std"
 short_desc="Safe, concurrent, practical systems language"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -33,7 +33,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" rust llvm15"
+	hostmakedepends+=" rust llvm16"
 	# These are required for building the buildhost's stage0/1
 	hostmakedepends+=" libffi-devel libxml2-devel ncurses-devel zlib-devel"
 else

From 2f640724ed2a6cb873cfb737765e5cd31f1db2f3 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:28:52 +0200
Subject: [PATCH 14/18] llvm: update to 16.

---
 srcpkgs/llvm/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index fc1c850bd26f..5a88372fb672 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=15
+version=16
 revision=1
 build_style=meta
-depends="llvm15"
+depends="llvm16"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 22c01bdaa3abd2b7201457224f7a229b46d9d0bd Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:16 +0200
Subject: [PATCH 15/18] SPIRV-Headers: update to 1.3.243.0.

---
 srcpkgs/SPIRV-Headers/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/SPIRV-Headers/template b/srcpkgs/SPIRV-Headers/template
index 8bb7d5f8b1ae..e3bca40c95be 100644
--- a/srcpkgs/SPIRV-Headers/template
+++ b/srcpkgs/SPIRV-Headers/template
@@ -1,7 +1,7 @@
 # Template file for 'SPIRV-Headers'
 pkgname=SPIRV-Headers
 reverts="1.5.4.raytracing.fixed_1 1.5.3_2 1.5.3_1 1.5.1_1 1.4.1_1"
-version=1.3.231.1
+version=1.3.243.0
 revision=1
 build_style=cmake
 short_desc="Machine-readable files for the SPIR-V Registry"
@@ -9,7 +9,7 @@ maintainer="tibequadorian <tibequadorian@posteo.de>"
 license="MIT"
 homepage="https://github.com/KhronosGroup/SPIRV-Headers"
 distfiles="https://github.com/KhronosGroup/SPIRV-Headers/archive/sdk-${version}.tar.gz"
-checksum=fc340700b005e9a2adc98475b5afbbabd1bc931f789a2afd02d54ebc22522af3
+checksum=16927b1868e7891377d059cd549484e4158912439cf77451ae7e01e2a3bcd28b
 
 post_install() {
 	vlicense LICENSE

From 5e34207130d3e5c69374c8b0c76da0fb38b9dbdf Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:28 +0200
Subject: [PATCH 16/18] SPIRV-Tools: update to 2023.2.

---
 srcpkgs/SPIRV-Tools/template | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/SPIRV-Tools/template b/srcpkgs/SPIRV-Tools/template
index 6a280baa0c28..b9b2ddbc2328 100644
--- a/srcpkgs/SPIRV-Tools/template
+++ b/srcpkgs/SPIRV-Tools/template
@@ -1,9 +1,11 @@
 # Template file for 'SPIRV-Tools'
 pkgname=SPIRV-Tools
-version=2022.4
+version=2023.2
 revision=1
 build_style=cmake
-configure_args="-DSPIRV_SKIP_TESTS=ON -DSPIRV_WERROR=OFF
+configure_args="
+ -DSPIRV_SKIP_TESTS=ON
+ -DSPIRV_WERROR=OFF
  -DSPIRV-Headers_SOURCE_DIR=${XBPS_CROSS_BASE}/usr"
 hostmakedepends="python3"
 makedepends="SPIRV-Headers"
@@ -13,8 +15,7 @@ license="Apache-2.0"
 homepage="https://github.com/KhronosGroup/SPIRV-Tools"
 changelog="https://raw.githubusercontent.com/KhronosGroup/SPIRV-Tools/master/CHANGES"
 distfiles="https://github.com/KhronosGroup/SPIRV-Tools/archive/v${version}.tar.gz"
-checksum=a156215a2d7c6c5b267933ed691877a9a66f07d75970da33ce9ad627a71389d7
-LDFLAGS="-Wl,--no-undefined"
+checksum=7416cc8a98a10c32bacc36a39930b0c5b2a484963df5d68f388ed7ffee1faad3
 
 SPIRV-Tools-devel_package() {
 	depends="SPIRV-Tools-${version}_${revision}"

From da737e4d8bdf6204cbea631d819035dc2af2d3d9 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:33 +0200
Subject: [PATCH 17/18] SPIRV-LLVM-Translator: update to 16.0.0.

---
 ...anslator-16.0.0-llvm-link-llvm-dylib.patch | 73 +++++++++++++++++++
 srcpkgs/SPIRV-LLVM-Translator/template        | 17 +++--
 2 files changed, 83 insertions(+), 7 deletions(-)
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch

diff --git a/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
new file mode 100644
index 000000000000..5cd90086f1e2
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
@@ -0,0 +1,73 @@
+From 98fadafeae0204defedd89f015f7fb88f2888b2f Mon Sep 17 00:00:00 2001
+From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
+Date: Fri, 17 Mar 2023 14:27:10 -0300
+Subject: [PATCH] Fix standalone builds with LLVM_LINK_LLVM_DYLIB=ON
+
+Move the LLVM components to LINK_COMPONENTS because the DEPENDS list has
+the same semantics as add_dependencies(). In this
+case it doesn't include the LLVM components when calling the linker.
+---
+ lib/SPIRV/CMakeLists.txt | 47 ++++++++++++----------------------------
+ 1 file changed, 14 insertions(+), 33 deletions(-)
+
+diff --git a/lib/SPIRV/CMakeLists.txt b/lib/SPIRV/CMakeLists.txt
+index bbef00528..2810c6b2c 100644
+--- a/lib/SPIRV/CMakeLists.txt
++++ b/lib/SPIRV/CMakeLists.txt
+@@ -38,42 +38,23 @@ set(SRC_LIST
+   libSPIRV/SPIRVType.cpp
+   libSPIRV/SPIRVValue.cpp
+ )
+-if(LLVM_LINK_LLVM_DYLIB)
+-  add_llvm_library(LLVMSPIRVLib STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
+-    ${SRC_LIST}
+-    DEPENDS
+-      intrinsics_gen
+-      LLVMAnalysis
+-      LLVMBitWriter
+-      LLVMCodeGen
+-      LLVMCore
+-      LLVMDemangle
+-      LLVMIRReader
+-      LLVMLinker
+-      LLVMPasses
+-      LLVMSupport
+-      LLVMTargetParser
+-      LLVMTransformUtils
+-  )
+-else()
+-  add_llvm_library(LLVMSPIRVLib
+-    ${SRC_LIST}
+-    LINK_COMPONENTS
+-      Analysis
+-      BitWriter
+-      CodeGen
+-      Core
+-      Demangle
+-      IRReader
+-      Linker
+-      Passes
+-      Support
+-      TargetParser
+-      TransformUtils
++add_llvm_library(LLVMSPIRVLib
++  ${SRC_LIST}
++  LINK_COMPONENTS
++    Analysis
++    BitWriter
++    CodeGen
++    Core
++    Demangle
++    IRReader
++    Linker
++    Passes
++    Support
++    TargetParser
++    TransformUtils
+   DEPENDS
+     intrinsics_gen
+   )
+-endif()
+ 
+ target_include_directories(LLVMSPIRVLib
+   PRIVATE
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index bee99f9bcbb2..1bdb54aad707 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -1,20 +1,23 @@
 # Template file for 'SPIRV-LLVM-Translator'
 pkgname=SPIRV-LLVM-Translator
-version=15.0.0
+version=16.0.0
 revision=1
 build_style=cmake
-make_build_args="llvm-spirv"
-configure_args="-Wno-dev -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_SKIP_RPATH=ON
- -DLLVM_SPIRV_INCLUDE_TESTS=OFF -DBUILD_SHARED_LIBS=ON
+# make_build_args="llvm-spirv"
+configure_args="-Wno-dev
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DCMAKE_SKIP_RPATH=ON
+ -DLLVM_SPIRV_INCLUDE_TESTS=OFF
+ -DBUILD_SHARED_LIBS=ON
  -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr"
-hostmakedepends="clang llvm"
-makedepends="clang-tools-extra llvm SPIRV-Headers"
+hostmakedepends="clang llvm16"
+makedepends="clang-tools-extra llvm16 SPIRV-Headers"
 short_desc="API and commands for processing SPIR-V modules"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA"
 homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
 distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v${version}.tar.gz"
-checksum=b1bebd77f72988758c00852e78c2ddc545815a612169a0cb377d021e2f846d88
+checksum=305fac5bb8efdad9054f0d27b5b765aca8b3349a500e2ba0c927763e42badc2b
 
 post_install() {
 	vlicense LICENSE.TXT

From 93203edcaa27e3e5df6a5f521634b254d05d119b Mon Sep 17 00:00:00 2001
From: Arda Demir <ddmirarda@gmail.com>
Date: Thu, 23 Feb 2023 12:31:16 +0300
Subject: [PATCH 18/18] mesa: update to 23.0.3.

---
 ...e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch | 77 -------------------
 srcpkgs/mesa/template                         | 10 +--
 2 files changed, 5 insertions(+), 82 deletions(-)
 delete mode 100644 srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch

diff --git a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch b/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
deleted file mode 100644
index f56327367526..000000000000
--- a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47 Mon Sep 17 00:00:00 2001
-From: Erico Nunes <nunes.erico@gmail.com>
-Date: Sun, 12 Feb 2023 22:33:30 +0100
-Subject: [PATCH] lima: don't use resource_from_handle while creating scanout
-
-resource_from_handle implementations create an additional reference to
-the scanout resource, which caused lima to leak those resources after
-commit ad4d7ca8332488be8a75aff001f00306a9f6402e.
-
-Do as the other drivers do and import the bo directly while creating
-the scanount resource.
-
-Cc: 22.3 mesa-stable
-Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8198
-Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
-Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21330>
----
- src/gallium/drivers/lima/lima_resource.c | 26 ++++++++++++++++++------
- 1 file changed, 20 insertions(+), 6 deletions(-)
-
-diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c
-index 54869ec03d24..0b7691f2b46f 100644
---- a/src/gallium/drivers/lima/lima_resource.c
-+++ b/src/gallium/drivers/lima/lima_resource.c
-@@ -59,7 +59,10 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    struct lima_screen *screen = lima_screen(pscreen);
-    struct renderonly_scanout *scanout;
-    struct winsys_handle handle;
--   struct pipe_resource *pres;
-+
-+   struct lima_resource *res = CALLOC_STRUCT(lima_resource);
-+   if (!res)
-+      return NULL;
- 
-    struct pipe_resource scanout_templat = *templat;
-    scanout_templat.width0 = width;
-@@ -71,20 +74,31 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    if (!scanout)
-       return NULL;
- 
-+   res->base = *templat;
-+   res->base.screen = pscreen;
-+   pipe_reference_init(&res->base.reference, 1);
-+   res->levels[0].offset = handle.offset;
-+   res->levels[0].stride = handle.stride;
-+
-    assert(handle.type == WINSYS_HANDLE_TYPE_FD);
--   pres = pscreen->resource_from_handle(pscreen, templat, &handle,
--                                        PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
-+   res->bo = lima_bo_import(screen, &handle);
-+   if (!res->bo) {
-+      FREE(res);
-+      return NULL;
-+   }
-+
-+   res->modifier_constant = true;
- 
-    close(handle.handle);
--   if (!pres) {
-+   if (!res->bo) {
-       renderonly_scanout_destroy(scanout, screen->ro);
-+      FREE(res);
-       return NULL;
-    }
- 
--   struct lima_resource *res = lima_resource(pres);
-    res->scanout = scanout;
- 
--   return pres;
-+   return &res->base;
- }
- 
- static uint32_t
--- 
-GitLab
-
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f95c2f2f5736..8306d8a534db 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,12 +1,12 @@
 # Template file for 'mesa'
 pkgname=mesa
-version=22.3.5
-revision=3
+version=23.0.3
+revision=1
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
- -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++14"
+ -Dllvm=enabled -Db_lto=false"
 hostmakedepends="gettext flex llvm pkg-config python3-Mako glslang
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
@@ -16,13 +16,13 @@ makedepends="elfutils-devel expat-devel libXdamage-devel
  libXrandr-devel libglvnd-devel libzstd-devel libxml2-devel lua53-devel
  libarchive-devel"
 depends="libglvnd"
-short_desc="Graphics library similar to SGI's OpenGL"
+short_desc="Open source implementation of OpenGL and Vulkan specifications"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="MIT, LGPL-2.1-or-later"
 homepage="https://www.mesa3d.org/"
 changelog="https://docs.mesa3d.org/relnotes.html"
 distfiles="https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
-checksum=3eed2ecae2bc674494566faab9fcc9beb21cd804c7ba2b59a1694f3d7236e6a9
+checksum=386362a5d80df3b096636b67f340e1ce67b705b44767d5bdd11d2ed1037192d5
 
 build_options="wayland"
 build_options_default="wayland"

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (6 preceding siblings ...)
  2023-05-04 19:41 ` Duncaen
@ 2023-05-04 19:43 ` Duncaen
  2023-05-04 19:44 ` Duncaen
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-04 19:43 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From 8c04f9e9b505c146bda9b8d128d0d34d084fd191 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH 01/20] New package: llvm16-16.0.3

---
 common/shlibs                                 |  11 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 38 files changed, 1106 insertions(+), 22 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/common/shlibs b/common/shlibs
index 8c47e79b8c43..85617f9a4884 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -990,15 +990,16 @@ 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.15 lldb-15.0.7_1
-libclang.so.15 libclang-15.0.7_1
-libclang-cpp.so.15 libclang-cpp-15.0.7_1
+liblldb.so.16 lldb-16.0.7_1
+libclang.so.16 libclang-16.0.3_1
+libclang-cpp.so.16 libclang-cpp-16.0.3_1
 libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
-libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
+libLLVM-16.so libllvm16-16.0.3_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.3_1
 libomp.so.5 libomp-15.0.7_1
-libomptarget.so.15 libomp-15.0.7_1
+libomptarget.so.16 libomp-16.0.7_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 b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..e1f9280b690b
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS=YES
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		# vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

From bfacd6d80206befc77d31d66d3209a274a63d3e9 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 02/20] CastXML: rebuild for llvm16-16.0.3_1

---
 srcpkgs/CastXML/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/CastXML/template b/srcpkgs/CastXML/template
index de0920900ae4..323f61224ba9 100644
--- a/srcpkgs/CastXML/template
+++ b/srcpkgs/CastXML/template
@@ -1,7 +1,7 @@
 # Template file for 'CastXML'
 pkgname=CastXML
 version=0.5.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DSPHINX_MAN=YES -DCastXML_INSTALL_MAN_DIR=share/man"
 hostmakedepends="clang python3-Sphinx"

From 41a2942d587ec8bcd2e226e53af5067bf61df581 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 03/20] bcc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bcc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 1b690066612f..970178656ddd 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.27.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version} -DENABLE_LLVM_SHARED=1"
 hostmakedepends="flex python3-setuptools"

From 7bc29d3919b54e3c988169b93f02b869f9fd90b5 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 04/20] bpftrace: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bpftrace/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index ad1bd0f50e73..549e8ad670a1 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.17.1
-revision=1
+revision=2
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
 configure_args="-DUSE_SYSTEM_BPF_BCC=ON -DBUILD_TESTING=OFF" # needs root to run

From bff4539a69dfb42e82d54a1dfbf94b0f6688bf49 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 05/20] ccls: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index ecc9f3e38a5d..ff74d135a1c4 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20220729
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang-tools-extra libxml2-devel llvm ncurses-devel rapidjson zlib-devel"

From d746d011a902f6b41c210d71a4d3a7329a2e757e Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 06/20] clazy: rebuild for llvm16-16.0.3_1

---
 srcpkgs/clazy/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index f81de08ab836..bdec40488d6a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.11
-revision=2
+revision=3
 build_style=cmake
 build_helper=qemu
 hostmakedepends="llvm"

From 8cb6006d1cee48fbbfbfc9138115b648957115c7 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 07/20] include-what-you-use: rebuild for llvm16-16.0.3_1

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 1a30bc04bb2d..b9190c260eda 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.19
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
 hostmakedepends="python3"

From eaaa8758cb8292bf86ce819ed766415356ef7d37 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 08/20] ispc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index fbfa4f6db420..44489dee9a2e 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.19.0
-revision=2
+revision=3
 archs="aarch64* x86_64*"
 build_style=cmake
 configure_args="-DISPC_INCLUDE_EXAMPLES=OFF -DISPC_INCLUDE_RT=OFF"

From 5afcd9bdbe746ae97d1ebe0d5dbe697bddbcd83f Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 09/20] ldc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ldc/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index f6d8b7ffbe98..90953ae27fcc 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,7 +1,7 @@
 # Template file for 'ldc'
 pkgname=ldc
 version=1.31.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="
  -DINCLUDE_INSTALL_DIR=/usr/include/dlang/ldc
@@ -11,7 +11,7 @@ configure_args="
  -DCOMPILE_D_MODULES_SEPARATELY=ON
  -DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm15 perl pkg-config"
+hostmakedepends="dmd llvm16 perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
  llvm-libunwind-devel"
 depends="ldc-runtime llvm-libunwind-devel"

From ab3e612e02b29678e3eb4195474595730554c775 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 10/20] mesa: rebuild for llvm16-16.0.3_1

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 132263d3599f..f95c2f2f5736 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=22.3.5
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled

From e93a79a8d248983ab6a59f6aad9f748c68e99e14 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 11/20] qt6-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt6-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index d5ad1618e3a7..c49c69f73901 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'qt6-tools'
 pkgname=qt6-tools
 version=6.4.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON

From 4379a27ee0d0aad0e2046c2c01d17f8f1576e0b2 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 12/20] qtcreator: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index b1dffd304198..046ca9cba57c 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=9.0.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="$(vopt_bool qbs BUILD_QBS) -DWITH_DOCS=ON -DBUILD_WITH_PCH=OFF
  -DQT_HOST_PATH=/usr/ -DQT_HOST_PATH_CMAKE_DIR=/usr/lib64/cmake/Qt6"

From 6d379d643c13e54d95028ce8a8210385631599fa Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 13/20] rust: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rust/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template
index 88e35a5a43ad..53de9ac72231 100644
--- a/srcpkgs/rust/template
+++ b/srcpkgs/rust/template
@@ -9,9 +9,9 @@
 #
 pkgname=rust
 version=1.69.0
-revision=1
+revision=2
 hostmakedepends="cmake curl pkg-config python3 tar cargo-bootstrap"
-makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm15"
+makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm16"
 depends="rust-std"
 short_desc="Safe, concurrent, practical systems language"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -33,7 +33,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" rust llvm15"
+	hostmakedepends+=" rust llvm16"
 	# These are required for building the buildhost's stage0/1
 	hostmakedepends+=" libffi-devel libxml2-devel ncurses-devel zlib-devel"
 else

From 2f640724ed2a6cb873cfb737765e5cd31f1db2f3 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:28:52 +0200
Subject: [PATCH 14/20] llvm: update to 16.

---
 srcpkgs/llvm/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index fc1c850bd26f..5a88372fb672 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=15
+version=16
 revision=1
 build_style=meta
-depends="llvm15"
+depends="llvm16"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 22c01bdaa3abd2b7201457224f7a229b46d9d0bd Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:16 +0200
Subject: [PATCH 15/20] SPIRV-Headers: update to 1.3.243.0.

---
 srcpkgs/SPIRV-Headers/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/SPIRV-Headers/template b/srcpkgs/SPIRV-Headers/template
index 8bb7d5f8b1ae..e3bca40c95be 100644
--- a/srcpkgs/SPIRV-Headers/template
+++ b/srcpkgs/SPIRV-Headers/template
@@ -1,7 +1,7 @@
 # Template file for 'SPIRV-Headers'
 pkgname=SPIRV-Headers
 reverts="1.5.4.raytracing.fixed_1 1.5.3_2 1.5.3_1 1.5.1_1 1.4.1_1"
-version=1.3.231.1
+version=1.3.243.0
 revision=1
 build_style=cmake
 short_desc="Machine-readable files for the SPIR-V Registry"
@@ -9,7 +9,7 @@ maintainer="tibequadorian <tibequadorian@posteo.de>"
 license="MIT"
 homepage="https://github.com/KhronosGroup/SPIRV-Headers"
 distfiles="https://github.com/KhronosGroup/SPIRV-Headers/archive/sdk-${version}.tar.gz"
-checksum=fc340700b005e9a2adc98475b5afbbabd1bc931f789a2afd02d54ebc22522af3
+checksum=16927b1868e7891377d059cd549484e4158912439cf77451ae7e01e2a3bcd28b
 
 post_install() {
 	vlicense LICENSE

From 5e34207130d3e5c69374c8b0c76da0fb38b9dbdf Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:28 +0200
Subject: [PATCH 16/20] SPIRV-Tools: update to 2023.2.

---
 srcpkgs/SPIRV-Tools/template | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/SPIRV-Tools/template b/srcpkgs/SPIRV-Tools/template
index 6a280baa0c28..b9b2ddbc2328 100644
--- a/srcpkgs/SPIRV-Tools/template
+++ b/srcpkgs/SPIRV-Tools/template
@@ -1,9 +1,11 @@
 # Template file for 'SPIRV-Tools'
 pkgname=SPIRV-Tools
-version=2022.4
+version=2023.2
 revision=1
 build_style=cmake
-configure_args="-DSPIRV_SKIP_TESTS=ON -DSPIRV_WERROR=OFF
+configure_args="
+ -DSPIRV_SKIP_TESTS=ON
+ -DSPIRV_WERROR=OFF
  -DSPIRV-Headers_SOURCE_DIR=${XBPS_CROSS_BASE}/usr"
 hostmakedepends="python3"
 makedepends="SPIRV-Headers"
@@ -13,8 +15,7 @@ license="Apache-2.0"
 homepage="https://github.com/KhronosGroup/SPIRV-Tools"
 changelog="https://raw.githubusercontent.com/KhronosGroup/SPIRV-Tools/master/CHANGES"
 distfiles="https://github.com/KhronosGroup/SPIRV-Tools/archive/v${version}.tar.gz"
-checksum=a156215a2d7c6c5b267933ed691877a9a66f07d75970da33ce9ad627a71389d7
-LDFLAGS="-Wl,--no-undefined"
+checksum=7416cc8a98a10c32bacc36a39930b0c5b2a484963df5d68f388ed7ffee1faad3
 
 SPIRV-Tools-devel_package() {
 	depends="SPIRV-Tools-${version}_${revision}"

From da737e4d8bdf6204cbea631d819035dc2af2d3d9 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:33 +0200
Subject: [PATCH 17/20] SPIRV-LLVM-Translator: update to 16.0.0.

---
 ...anslator-16.0.0-llvm-link-llvm-dylib.patch | 73 +++++++++++++++++++
 srcpkgs/SPIRV-LLVM-Translator/template        | 17 +++--
 2 files changed, 83 insertions(+), 7 deletions(-)
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch

diff --git a/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
new file mode 100644
index 000000000000..5cd90086f1e2
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
@@ -0,0 +1,73 @@
+From 98fadafeae0204defedd89f015f7fb88f2888b2f Mon Sep 17 00:00:00 2001
+From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
+Date: Fri, 17 Mar 2023 14:27:10 -0300
+Subject: [PATCH] Fix standalone builds with LLVM_LINK_LLVM_DYLIB=ON
+
+Move the LLVM components to LINK_COMPONENTS because the DEPENDS list has
+the same semantics as add_dependencies(). In this
+case it doesn't include the LLVM components when calling the linker.
+---
+ lib/SPIRV/CMakeLists.txt | 47 ++++++++++++----------------------------
+ 1 file changed, 14 insertions(+), 33 deletions(-)
+
+diff --git a/lib/SPIRV/CMakeLists.txt b/lib/SPIRV/CMakeLists.txt
+index bbef00528..2810c6b2c 100644
+--- a/lib/SPIRV/CMakeLists.txt
++++ b/lib/SPIRV/CMakeLists.txt
+@@ -38,42 +38,23 @@ set(SRC_LIST
+   libSPIRV/SPIRVType.cpp
+   libSPIRV/SPIRVValue.cpp
+ )
+-if(LLVM_LINK_LLVM_DYLIB)
+-  add_llvm_library(LLVMSPIRVLib STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
+-    ${SRC_LIST}
+-    DEPENDS
+-      intrinsics_gen
+-      LLVMAnalysis
+-      LLVMBitWriter
+-      LLVMCodeGen
+-      LLVMCore
+-      LLVMDemangle
+-      LLVMIRReader
+-      LLVMLinker
+-      LLVMPasses
+-      LLVMSupport
+-      LLVMTargetParser
+-      LLVMTransformUtils
+-  )
+-else()
+-  add_llvm_library(LLVMSPIRVLib
+-    ${SRC_LIST}
+-    LINK_COMPONENTS
+-      Analysis
+-      BitWriter
+-      CodeGen
+-      Core
+-      Demangle
+-      IRReader
+-      Linker
+-      Passes
+-      Support
+-      TargetParser
+-      TransformUtils
++add_llvm_library(LLVMSPIRVLib
++  ${SRC_LIST}
++  LINK_COMPONENTS
++    Analysis
++    BitWriter
++    CodeGen
++    Core
++    Demangle
++    IRReader
++    Linker
++    Passes
++    Support
++    TargetParser
++    TransformUtils
+   DEPENDS
+     intrinsics_gen
+   )
+-endif()
+ 
+ target_include_directories(LLVMSPIRVLib
+   PRIVATE
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index bee99f9bcbb2..1bdb54aad707 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -1,20 +1,23 @@
 # Template file for 'SPIRV-LLVM-Translator'
 pkgname=SPIRV-LLVM-Translator
-version=15.0.0
+version=16.0.0
 revision=1
 build_style=cmake
-make_build_args="llvm-spirv"
-configure_args="-Wno-dev -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_SKIP_RPATH=ON
- -DLLVM_SPIRV_INCLUDE_TESTS=OFF -DBUILD_SHARED_LIBS=ON
+# make_build_args="llvm-spirv"
+configure_args="-Wno-dev
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DCMAKE_SKIP_RPATH=ON
+ -DLLVM_SPIRV_INCLUDE_TESTS=OFF
+ -DBUILD_SHARED_LIBS=ON
  -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr"
-hostmakedepends="clang llvm"
-makedepends="clang-tools-extra llvm SPIRV-Headers"
+hostmakedepends="clang llvm16"
+makedepends="clang-tools-extra llvm16 SPIRV-Headers"
 short_desc="API and commands for processing SPIR-V modules"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA"
 homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
 distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v${version}.tar.gz"
-checksum=b1bebd77f72988758c00852e78c2ddc545815a612169a0cb377d021e2f846d88
+checksum=305fac5bb8efdad9054f0d27b5b765aca8b3349a500e2ba0c927763e42badc2b
 
 post_install() {
 	vlicense LICENSE.TXT

From 93203edcaa27e3e5df6a5f521634b254d05d119b Mon Sep 17 00:00:00 2001
From: Arda Demir <ddmirarda@gmail.com>
Date: Thu, 23 Feb 2023 12:31:16 +0300
Subject: [PATCH 18/20] mesa: update to 23.0.3.

---
 ...e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch | 77 -------------------
 srcpkgs/mesa/template                         | 10 +--
 2 files changed, 5 insertions(+), 82 deletions(-)
 delete mode 100644 srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch

diff --git a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch b/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
deleted file mode 100644
index f56327367526..000000000000
--- a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47 Mon Sep 17 00:00:00 2001
-From: Erico Nunes <nunes.erico@gmail.com>
-Date: Sun, 12 Feb 2023 22:33:30 +0100
-Subject: [PATCH] lima: don't use resource_from_handle while creating scanout
-
-resource_from_handle implementations create an additional reference to
-the scanout resource, which caused lima to leak those resources after
-commit ad4d7ca8332488be8a75aff001f00306a9f6402e.
-
-Do as the other drivers do and import the bo directly while creating
-the scanount resource.
-
-Cc: 22.3 mesa-stable
-Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8198
-Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
-Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21330>
----
- src/gallium/drivers/lima/lima_resource.c | 26 ++++++++++++++++++------
- 1 file changed, 20 insertions(+), 6 deletions(-)
-
-diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c
-index 54869ec03d24..0b7691f2b46f 100644
---- a/src/gallium/drivers/lima/lima_resource.c
-+++ b/src/gallium/drivers/lima/lima_resource.c
-@@ -59,7 +59,10 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    struct lima_screen *screen = lima_screen(pscreen);
-    struct renderonly_scanout *scanout;
-    struct winsys_handle handle;
--   struct pipe_resource *pres;
-+
-+   struct lima_resource *res = CALLOC_STRUCT(lima_resource);
-+   if (!res)
-+      return NULL;
- 
-    struct pipe_resource scanout_templat = *templat;
-    scanout_templat.width0 = width;
-@@ -71,20 +74,31 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    if (!scanout)
-       return NULL;
- 
-+   res->base = *templat;
-+   res->base.screen = pscreen;
-+   pipe_reference_init(&res->base.reference, 1);
-+   res->levels[0].offset = handle.offset;
-+   res->levels[0].stride = handle.stride;
-+
-    assert(handle.type == WINSYS_HANDLE_TYPE_FD);
--   pres = pscreen->resource_from_handle(pscreen, templat, &handle,
--                                        PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
-+   res->bo = lima_bo_import(screen, &handle);
-+   if (!res->bo) {
-+      FREE(res);
-+      return NULL;
-+   }
-+
-+   res->modifier_constant = true;
- 
-    close(handle.handle);
--   if (!pres) {
-+   if (!res->bo) {
-       renderonly_scanout_destroy(scanout, screen->ro);
-+      FREE(res);
-       return NULL;
-    }
- 
--   struct lima_resource *res = lima_resource(pres);
-    res->scanout = scanout;
- 
--   return pres;
-+   return &res->base;
- }
- 
- static uint32_t
--- 
-GitLab
-
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f95c2f2f5736..8306d8a534db 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,12 +1,12 @@
 # Template file for 'mesa'
 pkgname=mesa
-version=22.3.5
-revision=3
+version=23.0.3
+revision=1
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
- -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++14"
+ -Dllvm=enabled -Db_lto=false"
 hostmakedepends="gettext flex llvm pkg-config python3-Mako glslang
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
@@ -16,13 +16,13 @@ makedepends="elfutils-devel expat-devel libXdamage-devel
  libXrandr-devel libglvnd-devel libzstd-devel libxml2-devel lua53-devel
  libarchive-devel"
 depends="libglvnd"
-short_desc="Graphics library similar to SGI's OpenGL"
+short_desc="Open source implementation of OpenGL and Vulkan specifications"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="MIT, LGPL-2.1-or-later"
 homepage="https://www.mesa3d.org/"
 changelog="https://docs.mesa3d.org/relnotes.html"
 distfiles="https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
-checksum=3eed2ecae2bc674494566faab9fcc9beb21cd804c7ba2b59a1694f3d7236e6a9
+checksum=386362a5d80df3b096636b67f340e1ce67b705b44767d5bdd11d2ed1037192d5
 
 build_options="wayland"
 build_options_default="wayland"

From 0e4b3d2065f924da484c3e075e0e682b3f7f932d Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:42:58 +0200
Subject: [PATCH 19/20] fixup! SPIRV-LLVM-Translator: update to 16.0.0.

---
 common/shlibs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/shlibs b/common/shlibs
index 85617f9a4884..cef93167ad88 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -997,7 +997,7 @@ libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
 libLLVM-16.so libllvm16-16.0.3_1
-libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.3_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.0_1
 libomp.so.5 libomp-15.0.7_1
 libomptarget.so.16 libomp-16.0.7_1
 libisofs.so.6 libisofs-0.6.24_1

From c65516e674dc80bb99603453d11c0c8624dec029 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:43:14 +0200
Subject: [PATCH 20/20] fixup! bpftrace: rebuild for llvm16-16.0.3_1

---
 ...22cb14e2eedc5df17e53965824d7381f8e6f.patch | 41 +++++++++++++++++++
 ...7872b0c6600b69c5766ef7bdf736dd73ce9c.patch | 23 +++++++++++
 2 files changed, 64 insertions(+)
 create mode 100644 srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
 create mode 100644 srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch

diff --git a/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch b/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
new file mode 100644
index 000000000000..2173cc81376a
--- /dev/null
+++ b/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
@@ -0,0 +1,41 @@
+From 70ee22cb14e2eedc5df17e53965824d7381f8e6f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 13 Mar 2023 21:30:27 -0700
+Subject: [PATCH] ast: Use std::optional in CodegenLLVM::CodegenLLVM call
+
+Fixes build with clang-16
+
+src/ast/passes/codegen_llvm.cpp:63:53: error: use of undeclared identifier 'Optional'; did you mean 'std::optional'?
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/ast/passes/codegen_llvm.cpp | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
+index 616ff89ddbc..fe440adf373 100644
+--- a/src/ast/passes/codegen_llvm.cpp
++++ b/src/ast/passes/codegen_llvm.cpp
+@@ -56,11 +56,17 @@ CodegenLLVM::CodegenLLVM(Node *root, BPFtrace &bpftrace)
+     throw std::runtime_error(
+         "Could not find bpf llvm target, does your llvm support it?");
+ 
+-  target_machine_.reset(target->createTargetMachine(LLVMTargetTriple,
+-                                                    "generic",
+-                                                    "",
+-                                                    TargetOptions(),
+-                                                    Optional<Reloc::Model>()));
++  target_machine_.reset(
++      target->createTargetMachine(LLVMTargetTriple,
++                                  "generic",
++                                  "",
++                                  TargetOptions(),
++#if LLVM_VERSION_MAJOR >= 16
++                                  std::optional<Reloc::Model>()
++#else
++                                  Optional<Reloc::Model>()
++#endif
++                                      ));
+   target_machine_->setOptLevel(llvm::CodeGenOpt::Aggressive);
+ 
+   module_->setTargetTriple(LLVMTargetTriple);
diff --git a/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch b/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch
new file mode 100644
index 000000000000..b95a1c8df984
--- /dev/null
+++ b/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch
@@ -0,0 +1,23 @@
+From 7eea7872b0c6600b69c5766ef7bdf736dd73ce9c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 10 Mar 2023 00:08:27 -0800
+Subject: [PATCH] cmake: Raise max llvm major version to 16
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index db5618e4efb..5cc489afe44 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -173,7 +173,7 @@ else()
+   endif()
+ 
+   set(MIN_LLVM_MAJOR 6)
+-  set(MAX_LLVM_MAJOR 15)
++  set(MAX_LLVM_MAJOR 16)
+ 
+   if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
+     message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}")

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (7 preceding siblings ...)
  2023-05-04 19:43 ` Duncaen
@ 2023-05-04 19:44 ` Duncaen
  2023-05-04 22:43 ` Duncaen
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-04 19:44 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From 8c04f9e9b505c146bda9b8d128d0d34d084fd191 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH 01/21] New package: llvm16-16.0.3

---
 common/shlibs                                 |  11 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 38 files changed, 1106 insertions(+), 22 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/common/shlibs b/common/shlibs
index 8c47e79b8c43..85617f9a4884 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -990,15 +990,16 @@ 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.15 lldb-15.0.7_1
-libclang.so.15 libclang-15.0.7_1
-libclang-cpp.so.15 libclang-cpp-15.0.7_1
+liblldb.so.16 lldb-16.0.7_1
+libclang.so.16 libclang-16.0.3_1
+libclang-cpp.so.16 libclang-cpp-16.0.3_1
 libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
-libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
+libLLVM-16.so libllvm16-16.0.3_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.3_1
 libomp.so.5 libomp-15.0.7_1
-libomptarget.so.15 libomp-15.0.7_1
+libomptarget.so.16 libomp-16.0.7_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 b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..e1f9280b690b
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS=YES
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		# vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

From bfacd6d80206befc77d31d66d3209a274a63d3e9 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 02/21] CastXML: rebuild for llvm16-16.0.3_1

---
 srcpkgs/CastXML/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/CastXML/template b/srcpkgs/CastXML/template
index de0920900ae4..323f61224ba9 100644
--- a/srcpkgs/CastXML/template
+++ b/srcpkgs/CastXML/template
@@ -1,7 +1,7 @@
 # Template file for 'CastXML'
 pkgname=CastXML
 version=0.5.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DSPHINX_MAN=YES -DCastXML_INSTALL_MAN_DIR=share/man"
 hostmakedepends="clang python3-Sphinx"

From 41a2942d587ec8bcd2e226e53af5067bf61df581 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 03/21] bcc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bcc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 1b690066612f..970178656ddd 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.27.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version} -DENABLE_LLVM_SHARED=1"
 hostmakedepends="flex python3-setuptools"

From 7bc29d3919b54e3c988169b93f02b869f9fd90b5 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 04/21] bpftrace: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bpftrace/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index ad1bd0f50e73..549e8ad670a1 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.17.1
-revision=1
+revision=2
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
 configure_args="-DUSE_SYSTEM_BPF_BCC=ON -DBUILD_TESTING=OFF" # needs root to run

From bff4539a69dfb42e82d54a1dfbf94b0f6688bf49 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 05/21] ccls: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index ecc9f3e38a5d..ff74d135a1c4 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20220729
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang-tools-extra libxml2-devel llvm ncurses-devel rapidjson zlib-devel"

From d746d011a902f6b41c210d71a4d3a7329a2e757e Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 06/21] clazy: rebuild for llvm16-16.0.3_1

---
 srcpkgs/clazy/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index f81de08ab836..bdec40488d6a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.11
-revision=2
+revision=3
 build_style=cmake
 build_helper=qemu
 hostmakedepends="llvm"

From 8cb6006d1cee48fbbfbfc9138115b648957115c7 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 07/21] include-what-you-use: rebuild for llvm16-16.0.3_1

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 1a30bc04bb2d..b9190c260eda 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.19
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
 hostmakedepends="python3"

From eaaa8758cb8292bf86ce819ed766415356ef7d37 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 08/21] ispc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index fbfa4f6db420..44489dee9a2e 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.19.0
-revision=2
+revision=3
 archs="aarch64* x86_64*"
 build_style=cmake
 configure_args="-DISPC_INCLUDE_EXAMPLES=OFF -DISPC_INCLUDE_RT=OFF"

From 5afcd9bdbe746ae97d1ebe0d5dbe697bddbcd83f Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 09/21] ldc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ldc/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index f6d8b7ffbe98..90953ae27fcc 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,7 +1,7 @@
 # Template file for 'ldc'
 pkgname=ldc
 version=1.31.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="
  -DINCLUDE_INSTALL_DIR=/usr/include/dlang/ldc
@@ -11,7 +11,7 @@ configure_args="
  -DCOMPILE_D_MODULES_SEPARATELY=ON
  -DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm15 perl pkg-config"
+hostmakedepends="dmd llvm16 perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
  llvm-libunwind-devel"
 depends="ldc-runtime llvm-libunwind-devel"

From ab3e612e02b29678e3eb4195474595730554c775 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 10/21] mesa: rebuild for llvm16-16.0.3_1

---
 srcpkgs/mesa/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 132263d3599f..f95c2f2f5736 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,7 +1,7 @@
 # Template file for 'mesa'
 pkgname=mesa
 version=22.3.5
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled

From e93a79a8d248983ab6a59f6aad9f748c68e99e14 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 11/21] qt6-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt6-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index d5ad1618e3a7..c49c69f73901 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'qt6-tools'
 pkgname=qt6-tools
 version=6.4.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON

From 4379a27ee0d0aad0e2046c2c01d17f8f1576e0b2 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 12/21] qtcreator: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index b1dffd304198..046ca9cba57c 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=9.0.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="$(vopt_bool qbs BUILD_QBS) -DWITH_DOCS=ON -DBUILD_WITH_PCH=OFF
  -DQT_HOST_PATH=/usr/ -DQT_HOST_PATH_CMAKE_DIR=/usr/lib64/cmake/Qt6"

From 6d379d643c13e54d95028ce8a8210385631599fa Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 13/21] rust: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rust/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template
index 88e35a5a43ad..53de9ac72231 100644
--- a/srcpkgs/rust/template
+++ b/srcpkgs/rust/template
@@ -9,9 +9,9 @@
 #
 pkgname=rust
 version=1.69.0
-revision=1
+revision=2
 hostmakedepends="cmake curl pkg-config python3 tar cargo-bootstrap"
-makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm15"
+makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm16"
 depends="rust-std"
 short_desc="Safe, concurrent, practical systems language"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -33,7 +33,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" rust llvm15"
+	hostmakedepends+=" rust llvm16"
 	# These are required for building the buildhost's stage0/1
 	hostmakedepends+=" libffi-devel libxml2-devel ncurses-devel zlib-devel"
 else

From 2f640724ed2a6cb873cfb737765e5cd31f1db2f3 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:28:52 +0200
Subject: [PATCH 14/21] llvm: update to 16.

---
 srcpkgs/llvm/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index fc1c850bd26f..5a88372fb672 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=15
+version=16
 revision=1
 build_style=meta
-depends="llvm15"
+depends="llvm16"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 22c01bdaa3abd2b7201457224f7a229b46d9d0bd Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:16 +0200
Subject: [PATCH 15/21] SPIRV-Headers: update to 1.3.243.0.

---
 srcpkgs/SPIRV-Headers/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/SPIRV-Headers/template b/srcpkgs/SPIRV-Headers/template
index 8bb7d5f8b1ae..e3bca40c95be 100644
--- a/srcpkgs/SPIRV-Headers/template
+++ b/srcpkgs/SPIRV-Headers/template
@@ -1,7 +1,7 @@
 # Template file for 'SPIRV-Headers'
 pkgname=SPIRV-Headers
 reverts="1.5.4.raytracing.fixed_1 1.5.3_2 1.5.3_1 1.5.1_1 1.4.1_1"
-version=1.3.231.1
+version=1.3.243.0
 revision=1
 build_style=cmake
 short_desc="Machine-readable files for the SPIR-V Registry"
@@ -9,7 +9,7 @@ maintainer="tibequadorian <tibequadorian@posteo.de>"
 license="MIT"
 homepage="https://github.com/KhronosGroup/SPIRV-Headers"
 distfiles="https://github.com/KhronosGroup/SPIRV-Headers/archive/sdk-${version}.tar.gz"
-checksum=fc340700b005e9a2adc98475b5afbbabd1bc931f789a2afd02d54ebc22522af3
+checksum=16927b1868e7891377d059cd549484e4158912439cf77451ae7e01e2a3bcd28b
 
 post_install() {
 	vlicense LICENSE

From 5e34207130d3e5c69374c8b0c76da0fb38b9dbdf Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:28 +0200
Subject: [PATCH 16/21] SPIRV-Tools: update to 2023.2.

---
 srcpkgs/SPIRV-Tools/template | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/SPIRV-Tools/template b/srcpkgs/SPIRV-Tools/template
index 6a280baa0c28..b9b2ddbc2328 100644
--- a/srcpkgs/SPIRV-Tools/template
+++ b/srcpkgs/SPIRV-Tools/template
@@ -1,9 +1,11 @@
 # Template file for 'SPIRV-Tools'
 pkgname=SPIRV-Tools
-version=2022.4
+version=2023.2
 revision=1
 build_style=cmake
-configure_args="-DSPIRV_SKIP_TESTS=ON -DSPIRV_WERROR=OFF
+configure_args="
+ -DSPIRV_SKIP_TESTS=ON
+ -DSPIRV_WERROR=OFF
  -DSPIRV-Headers_SOURCE_DIR=${XBPS_CROSS_BASE}/usr"
 hostmakedepends="python3"
 makedepends="SPIRV-Headers"
@@ -13,8 +15,7 @@ license="Apache-2.0"
 homepage="https://github.com/KhronosGroup/SPIRV-Tools"
 changelog="https://raw.githubusercontent.com/KhronosGroup/SPIRV-Tools/master/CHANGES"
 distfiles="https://github.com/KhronosGroup/SPIRV-Tools/archive/v${version}.tar.gz"
-checksum=a156215a2d7c6c5b267933ed691877a9a66f07d75970da33ce9ad627a71389d7
-LDFLAGS="-Wl,--no-undefined"
+checksum=7416cc8a98a10c32bacc36a39930b0c5b2a484963df5d68f388ed7ffee1faad3
 
 SPIRV-Tools-devel_package() {
 	depends="SPIRV-Tools-${version}_${revision}"

From da737e4d8bdf6204cbea631d819035dc2af2d3d9 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:33 +0200
Subject: [PATCH 17/21] SPIRV-LLVM-Translator: update to 16.0.0.

---
 ...anslator-16.0.0-llvm-link-llvm-dylib.patch | 73 +++++++++++++++++++
 srcpkgs/SPIRV-LLVM-Translator/template        | 17 +++--
 2 files changed, 83 insertions(+), 7 deletions(-)
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch

diff --git a/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
new file mode 100644
index 000000000000..5cd90086f1e2
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
@@ -0,0 +1,73 @@
+From 98fadafeae0204defedd89f015f7fb88f2888b2f Mon Sep 17 00:00:00 2001
+From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
+Date: Fri, 17 Mar 2023 14:27:10 -0300
+Subject: [PATCH] Fix standalone builds with LLVM_LINK_LLVM_DYLIB=ON
+
+Move the LLVM components to LINK_COMPONENTS because the DEPENDS list has
+the same semantics as add_dependencies(). In this
+case it doesn't include the LLVM components when calling the linker.
+---
+ lib/SPIRV/CMakeLists.txt | 47 ++++++++++++----------------------------
+ 1 file changed, 14 insertions(+), 33 deletions(-)
+
+diff --git a/lib/SPIRV/CMakeLists.txt b/lib/SPIRV/CMakeLists.txt
+index bbef00528..2810c6b2c 100644
+--- a/lib/SPIRV/CMakeLists.txt
++++ b/lib/SPIRV/CMakeLists.txt
+@@ -38,42 +38,23 @@ set(SRC_LIST
+   libSPIRV/SPIRVType.cpp
+   libSPIRV/SPIRVValue.cpp
+ )
+-if(LLVM_LINK_LLVM_DYLIB)
+-  add_llvm_library(LLVMSPIRVLib STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
+-    ${SRC_LIST}
+-    DEPENDS
+-      intrinsics_gen
+-      LLVMAnalysis
+-      LLVMBitWriter
+-      LLVMCodeGen
+-      LLVMCore
+-      LLVMDemangle
+-      LLVMIRReader
+-      LLVMLinker
+-      LLVMPasses
+-      LLVMSupport
+-      LLVMTargetParser
+-      LLVMTransformUtils
+-  )
+-else()
+-  add_llvm_library(LLVMSPIRVLib
+-    ${SRC_LIST}
+-    LINK_COMPONENTS
+-      Analysis
+-      BitWriter
+-      CodeGen
+-      Core
+-      Demangle
+-      IRReader
+-      Linker
+-      Passes
+-      Support
+-      TargetParser
+-      TransformUtils
++add_llvm_library(LLVMSPIRVLib
++  ${SRC_LIST}
++  LINK_COMPONENTS
++    Analysis
++    BitWriter
++    CodeGen
++    Core
++    Demangle
++    IRReader
++    Linker
++    Passes
++    Support
++    TargetParser
++    TransformUtils
+   DEPENDS
+     intrinsics_gen
+   )
+-endif()
+ 
+ target_include_directories(LLVMSPIRVLib
+   PRIVATE
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index bee99f9bcbb2..1bdb54aad707 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -1,20 +1,23 @@
 # Template file for 'SPIRV-LLVM-Translator'
 pkgname=SPIRV-LLVM-Translator
-version=15.0.0
+version=16.0.0
 revision=1
 build_style=cmake
-make_build_args="llvm-spirv"
-configure_args="-Wno-dev -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_SKIP_RPATH=ON
- -DLLVM_SPIRV_INCLUDE_TESTS=OFF -DBUILD_SHARED_LIBS=ON
+# make_build_args="llvm-spirv"
+configure_args="-Wno-dev
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DCMAKE_SKIP_RPATH=ON
+ -DLLVM_SPIRV_INCLUDE_TESTS=OFF
+ -DBUILD_SHARED_LIBS=ON
  -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr"
-hostmakedepends="clang llvm"
-makedepends="clang-tools-extra llvm SPIRV-Headers"
+hostmakedepends="clang llvm16"
+makedepends="clang-tools-extra llvm16 SPIRV-Headers"
 short_desc="API and commands for processing SPIR-V modules"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA"
 homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
 distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v${version}.tar.gz"
-checksum=b1bebd77f72988758c00852e78c2ddc545815a612169a0cb377d021e2f846d88
+checksum=305fac5bb8efdad9054f0d27b5b765aca8b3349a500e2ba0c927763e42badc2b
 
 post_install() {
 	vlicense LICENSE.TXT

From 93203edcaa27e3e5df6a5f521634b254d05d119b Mon Sep 17 00:00:00 2001
From: Arda Demir <ddmirarda@gmail.com>
Date: Thu, 23 Feb 2023 12:31:16 +0300
Subject: [PATCH 18/21] mesa: update to 23.0.3.

---
 ...e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch | 77 -------------------
 srcpkgs/mesa/template                         | 10 +--
 2 files changed, 5 insertions(+), 82 deletions(-)
 delete mode 100644 srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch

diff --git a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch b/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
deleted file mode 100644
index f56327367526..000000000000
--- a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47 Mon Sep 17 00:00:00 2001
-From: Erico Nunes <nunes.erico@gmail.com>
-Date: Sun, 12 Feb 2023 22:33:30 +0100
-Subject: [PATCH] lima: don't use resource_from_handle while creating scanout
-
-resource_from_handle implementations create an additional reference to
-the scanout resource, which caused lima to leak those resources after
-commit ad4d7ca8332488be8a75aff001f00306a9f6402e.
-
-Do as the other drivers do and import the bo directly while creating
-the scanount resource.
-
-Cc: 22.3 mesa-stable
-Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8198
-Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
-Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21330>
----
- src/gallium/drivers/lima/lima_resource.c | 26 ++++++++++++++++++------
- 1 file changed, 20 insertions(+), 6 deletions(-)
-
-diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c
-index 54869ec03d24..0b7691f2b46f 100644
---- a/src/gallium/drivers/lima/lima_resource.c
-+++ b/src/gallium/drivers/lima/lima_resource.c
-@@ -59,7 +59,10 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    struct lima_screen *screen = lima_screen(pscreen);
-    struct renderonly_scanout *scanout;
-    struct winsys_handle handle;
--   struct pipe_resource *pres;
-+
-+   struct lima_resource *res = CALLOC_STRUCT(lima_resource);
-+   if (!res)
-+      return NULL;
- 
-    struct pipe_resource scanout_templat = *templat;
-    scanout_templat.width0 = width;
-@@ -71,20 +74,31 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    if (!scanout)
-       return NULL;
- 
-+   res->base = *templat;
-+   res->base.screen = pscreen;
-+   pipe_reference_init(&res->base.reference, 1);
-+   res->levels[0].offset = handle.offset;
-+   res->levels[0].stride = handle.stride;
-+
-    assert(handle.type == WINSYS_HANDLE_TYPE_FD);
--   pres = pscreen->resource_from_handle(pscreen, templat, &handle,
--                                        PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
-+   res->bo = lima_bo_import(screen, &handle);
-+   if (!res->bo) {
-+      FREE(res);
-+      return NULL;
-+   }
-+
-+   res->modifier_constant = true;
- 
-    close(handle.handle);
--   if (!pres) {
-+   if (!res->bo) {
-       renderonly_scanout_destroy(scanout, screen->ro);
-+      FREE(res);
-       return NULL;
-    }
- 
--   struct lima_resource *res = lima_resource(pres);
-    res->scanout = scanout;
- 
--   return pres;
-+   return &res->base;
- }
- 
- static uint32_t
--- 
-GitLab
-
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index f95c2f2f5736..8306d8a534db 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,12 +1,12 @@
 # Template file for 'mesa'
 pkgname=mesa
-version=22.3.5
-revision=3
+version=23.0.3
+revision=1
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
- -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++14"
+ -Dllvm=enabled -Db_lto=false"
 hostmakedepends="gettext flex llvm pkg-config python3-Mako glslang
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
@@ -16,13 +16,13 @@ makedepends="elfutils-devel expat-devel libXdamage-devel
  libXrandr-devel libglvnd-devel libzstd-devel libxml2-devel lua53-devel
  libarchive-devel"
 depends="libglvnd"
-short_desc="Graphics library similar to SGI's OpenGL"
+short_desc="Open source implementation of OpenGL and Vulkan specifications"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="MIT, LGPL-2.1-or-later"
 homepage="https://www.mesa3d.org/"
 changelog="https://docs.mesa3d.org/relnotes.html"
 distfiles="https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
-checksum=3eed2ecae2bc674494566faab9fcc9beb21cd804c7ba2b59a1694f3d7236e6a9
+checksum=386362a5d80df3b096636b67f340e1ce67b705b44767d5bdd11d2ed1037192d5
 
 build_options="wayland"
 build_options_default="wayland"

From 0e4b3d2065f924da484c3e075e0e682b3f7f932d Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:42:58 +0200
Subject: [PATCH 19/21] fixup! SPIRV-LLVM-Translator: update to 16.0.0.

---
 common/shlibs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/shlibs b/common/shlibs
index 85617f9a4884..cef93167ad88 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -997,7 +997,7 @@ libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
 libLLVM-16.so libllvm16-16.0.3_1
-libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.3_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.0_1
 libomp.so.5 libomp-15.0.7_1
 libomptarget.so.16 libomp-16.0.7_1
 libisofs.so.6 libisofs-0.6.24_1

From c65516e674dc80bb99603453d11c0c8624dec029 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:43:14 +0200
Subject: [PATCH 20/21] fixup! bpftrace: rebuild for llvm16-16.0.3_1

---
 ...22cb14e2eedc5df17e53965824d7381f8e6f.patch | 41 +++++++++++++++++++
 ...7872b0c6600b69c5766ef7bdf736dd73ce9c.patch | 23 +++++++++++
 2 files changed, 64 insertions(+)
 create mode 100644 srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
 create mode 100644 srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch

diff --git a/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch b/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
new file mode 100644
index 000000000000..2173cc81376a
--- /dev/null
+++ b/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
@@ -0,0 +1,41 @@
+From 70ee22cb14e2eedc5df17e53965824d7381f8e6f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 13 Mar 2023 21:30:27 -0700
+Subject: [PATCH] ast: Use std::optional in CodegenLLVM::CodegenLLVM call
+
+Fixes build with clang-16
+
+src/ast/passes/codegen_llvm.cpp:63:53: error: use of undeclared identifier 'Optional'; did you mean 'std::optional'?
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/ast/passes/codegen_llvm.cpp | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
+index 616ff89ddbc..fe440adf373 100644
+--- a/src/ast/passes/codegen_llvm.cpp
++++ b/src/ast/passes/codegen_llvm.cpp
+@@ -56,11 +56,17 @@ CodegenLLVM::CodegenLLVM(Node *root, BPFtrace &bpftrace)
+     throw std::runtime_error(
+         "Could not find bpf llvm target, does your llvm support it?");
+ 
+-  target_machine_.reset(target->createTargetMachine(LLVMTargetTriple,
+-                                                    "generic",
+-                                                    "",
+-                                                    TargetOptions(),
+-                                                    Optional<Reloc::Model>()));
++  target_machine_.reset(
++      target->createTargetMachine(LLVMTargetTriple,
++                                  "generic",
++                                  "",
++                                  TargetOptions(),
++#if LLVM_VERSION_MAJOR >= 16
++                                  std::optional<Reloc::Model>()
++#else
++                                  Optional<Reloc::Model>()
++#endif
++                                      ));
+   target_machine_->setOptLevel(llvm::CodeGenOpt::Aggressive);
+ 
+   module_->setTargetTriple(LLVMTargetTriple);
diff --git a/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch b/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch
new file mode 100644
index 000000000000..b95a1c8df984
--- /dev/null
+++ b/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch
@@ -0,0 +1,23 @@
+From 7eea7872b0c6600b69c5766ef7bdf736dd73ce9c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 10 Mar 2023 00:08:27 -0800
+Subject: [PATCH] cmake: Raise max llvm major version to 16
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index db5618e4efb..5cc489afe44 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -173,7 +173,7 @@ else()
+   endif()
+ 
+   set(MIN_LLVM_MAJOR 6)
+-  set(MAX_LLVM_MAJOR 15)
++  set(MAX_LLVM_MAJOR 16)
+ 
+   if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
+     message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}")

From a741228a98962e0b75567505476ac2c2b8b9204d Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:44:32 +0200
Subject: [PATCH 21/21] fixup! New package: llvm16-16.0.3

---
 common/shlibs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/shlibs b/common/shlibs
index cef93167ad88..64deae182e63 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -990,7 +990,7 @@ 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.16 lldb-16.0.7_1
+liblldb.so.16 lldb-16.0.3_1
 libclang.so.16 libclang-16.0.3_1
 libclang-cpp.so.16 libclang-cpp-16.0.3_1
 libLLVM-11.so libllvm11-11.0.0_1
@@ -999,7 +999,7 @@ libLLVM-15.so libllvm15-15.0.7_1
 libLLVM-16.so libllvm16-16.0.3_1
 libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.0_1
 libomp.so.5 libomp-15.0.7_1
-libomptarget.so.16 libomp-16.0.7_1
+libomptarget.so.16 libomp-16.0.3_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

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (8 preceding siblings ...)
  2023-05-04 19:44 ` Duncaen
@ 2023-05-04 22:43 ` Duncaen
  2023-05-05 19:24 ` Duncaen
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-04 22:43 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From 9573d3fbb372f93c289b8e582dfeb97c9a7a5818 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH 01/31] New package: llvm16-16.0.3

---
 common/shlibs                                 |  11 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 38 files changed, 1106 insertions(+), 22 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/common/shlibs b/common/shlibs
index 8c47e79b8c43..03af5e4ddb07 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -990,15 +990,16 @@ 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.15 lldb-15.0.7_1
-libclang.so.15 libclang-15.0.7_1
-libclang-cpp.so.15 libclang-cpp-15.0.7_1
+liblldb.so.16 lldb-16.0.3_1
+libclang.so.16 libclang-16.0.3_1
+libclang-cpp.so.16 libclang-cpp-16.0.3_1
 libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
-libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
+libLLVM-16.so libllvm16-16.0.3_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.3_1
 libomp.so.5 libomp-15.0.7_1
-libomptarget.so.15 libomp-15.0.7_1
+libomptarget.so.16 libomp-16.0.3_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 b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..e1f9280b690b
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS=YES
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		# vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

From 0563b538c7de1af727a353ac9ff0649173adccf4 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 02/31] CastXML: rebuild for llvm16-16.0.3_1

---
 srcpkgs/CastXML/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/CastXML/template b/srcpkgs/CastXML/template
index de0920900ae4..323f61224ba9 100644
--- a/srcpkgs/CastXML/template
+++ b/srcpkgs/CastXML/template
@@ -1,7 +1,7 @@
 # Template file for 'CastXML'
 pkgname=CastXML
 version=0.5.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DSPHINX_MAN=YES -DCastXML_INSTALL_MAN_DIR=share/man"
 hostmakedepends="clang python3-Sphinx"

From 3fc2a090e8c8c6b9a8329e0840086e6a98af4f7a Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 03/31] bcc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bcc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 1b690066612f..970178656ddd 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.27.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version} -DENABLE_LLVM_SHARED=1"
 hostmakedepends="flex python3-setuptools"

From 1d8d21a4f97e8f42b91bc394c0a7cd2e87cd1812 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 04/31] bpftrace: rebuild for llvm16-16.0.3_1

---
 ...22cb14e2eedc5df17e53965824d7381f8e6f.patch | 41 +++++++++++++++++++
 ...7872b0c6600b69c5766ef7bdf736dd73ce9c.patch | 23 +++++++++++
 srcpkgs/bpftrace/template                     |  2 +-
 3 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
 create mode 100644 srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch

diff --git a/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch b/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
new file mode 100644
index 000000000000..2173cc81376a
--- /dev/null
+++ b/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
@@ -0,0 +1,41 @@
+From 70ee22cb14e2eedc5df17e53965824d7381f8e6f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 13 Mar 2023 21:30:27 -0700
+Subject: [PATCH] ast: Use std::optional in CodegenLLVM::CodegenLLVM call
+
+Fixes build with clang-16
+
+src/ast/passes/codegen_llvm.cpp:63:53: error: use of undeclared identifier 'Optional'; did you mean 'std::optional'?
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/ast/passes/codegen_llvm.cpp | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
+index 616ff89ddbc..fe440adf373 100644
+--- a/src/ast/passes/codegen_llvm.cpp
++++ b/src/ast/passes/codegen_llvm.cpp
+@@ -56,11 +56,17 @@ CodegenLLVM::CodegenLLVM(Node *root, BPFtrace &bpftrace)
+     throw std::runtime_error(
+         "Could not find bpf llvm target, does your llvm support it?");
+ 
+-  target_machine_.reset(target->createTargetMachine(LLVMTargetTriple,
+-                                                    "generic",
+-                                                    "",
+-                                                    TargetOptions(),
+-                                                    Optional<Reloc::Model>()));
++  target_machine_.reset(
++      target->createTargetMachine(LLVMTargetTriple,
++                                  "generic",
++                                  "",
++                                  TargetOptions(),
++#if LLVM_VERSION_MAJOR >= 16
++                                  std::optional<Reloc::Model>()
++#else
++                                  Optional<Reloc::Model>()
++#endif
++                                      ));
+   target_machine_->setOptLevel(llvm::CodeGenOpt::Aggressive);
+ 
+   module_->setTargetTriple(LLVMTargetTriple);
diff --git a/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch b/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch
new file mode 100644
index 000000000000..b95a1c8df984
--- /dev/null
+++ b/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch
@@ -0,0 +1,23 @@
+From 7eea7872b0c6600b69c5766ef7bdf736dd73ce9c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 10 Mar 2023 00:08:27 -0800
+Subject: [PATCH] cmake: Raise max llvm major version to 16
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index db5618e4efb..5cc489afe44 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -173,7 +173,7 @@ else()
+   endif()
+ 
+   set(MIN_LLVM_MAJOR 6)
+-  set(MAX_LLVM_MAJOR 15)
++  set(MAX_LLVM_MAJOR 16)
+ 
+   if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
+     message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}")
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index ad1bd0f50e73..549e8ad670a1 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.17.1
-revision=1
+revision=2
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
 configure_args="-DUSE_SYSTEM_BPF_BCC=ON -DBUILD_TESTING=OFF" # needs root to run

From 0983658a7483e5da228acbbafafe8491f74ac54e Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 05/31] ccls: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index ecc9f3e38a5d..ff74d135a1c4 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20220729
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang-tools-extra libxml2-devel llvm ncurses-devel rapidjson zlib-devel"

From 8dbb644502109e6d93bd5507790fae9236726174 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 06/31] clazy: rebuild for llvm16-16.0.3_1

---
 srcpkgs/clazy/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index f81de08ab836..bdec40488d6a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.11
-revision=2
+revision=3
 build_style=cmake
 build_helper=qemu
 hostmakedepends="llvm"

From 15b401a0630349f198aee4a79b364aa4e9e3b7d1 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 07/31] include-what-you-use: rebuild for llvm16-16.0.3_1

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 1a30bc04bb2d..b9190c260eda 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.19
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
 hostmakedepends="python3"

From 45f43b0b9a744b71adb594f5b9cb7cbcaa8066ea Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 08/31] ispc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index fbfa4f6db420..44489dee9a2e 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.19.0
-revision=2
+revision=3
 archs="aarch64* x86_64*"
 build_style=cmake
 configure_args="-DISPC_INCLUDE_EXAMPLES=OFF -DISPC_INCLUDE_RT=OFF"

From 7c11652fe380269d0827a28a70f242825d3afb72 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 09/31] ldc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ldc/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index f6d8b7ffbe98..90953ae27fcc 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,7 +1,7 @@
 # Template file for 'ldc'
 pkgname=ldc
 version=1.31.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="
  -DINCLUDE_INSTALL_DIR=/usr/include/dlang/ldc
@@ -11,7 +11,7 @@ configure_args="
  -DCOMPILE_D_MODULES_SEPARATELY=ON
  -DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm15 perl pkg-config"
+hostmakedepends="dmd llvm16 perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
  llvm-libunwind-devel"
 depends="ldc-runtime llvm-libunwind-devel"

From 57cac87e1ace2274bd14ca112b89b5bfc5c7404e Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 10/31] qt6-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt6-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index d5ad1618e3a7..c49c69f73901 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'qt6-tools'
 pkgname=qt6-tools
 version=6.4.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON

From 41e1b24c266363d014d55d54c015bb08b66da8d7 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 11/31] qtcreator: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index b1dffd304198..046ca9cba57c 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=9.0.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="$(vopt_bool qbs BUILD_QBS) -DWITH_DOCS=ON -DBUILD_WITH_PCH=OFF
  -DQT_HOST_PATH=/usr/ -DQT_HOST_PATH_CMAKE_DIR=/usr/lib64/cmake/Qt6"

From 1c154ac8cc7d184b746890eccbd2900414e85481 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 12/31] rust: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rust/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template
index 88e35a5a43ad..53de9ac72231 100644
--- a/srcpkgs/rust/template
+++ b/srcpkgs/rust/template
@@ -9,9 +9,9 @@
 #
 pkgname=rust
 version=1.69.0
-revision=1
+revision=2
 hostmakedepends="cmake curl pkg-config python3 tar cargo-bootstrap"
-makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm15"
+makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm16"
 depends="rust-std"
 short_desc="Safe, concurrent, practical systems language"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -33,7 +33,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" rust llvm15"
+	hostmakedepends+=" rust llvm16"
 	# These are required for building the buildhost's stage0/1
 	hostmakedepends+=" libffi-devel libxml2-devel ncurses-devel zlib-devel"
 else

From 5a87780eedff8addd119700550a9ba94e1b81591 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:28:52 +0200
Subject: [PATCH 13/31] llvm: update to 16.

---
 srcpkgs/llvm/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index fc1c850bd26f..5a88372fb672 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=15
+version=16
 revision=1
 build_style=meta
-depends="llvm15"
+depends="llvm16"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 53a96b3fe63e82f99547a0a98eee4585ba6d4bcb Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:16 +0200
Subject: [PATCH 14/31] SPIRV-Headers: update to 1.3.243.0.

---
 srcpkgs/SPIRV-Headers/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/SPIRV-Headers/template b/srcpkgs/SPIRV-Headers/template
index 8bb7d5f8b1ae..e3bca40c95be 100644
--- a/srcpkgs/SPIRV-Headers/template
+++ b/srcpkgs/SPIRV-Headers/template
@@ -1,7 +1,7 @@
 # Template file for 'SPIRV-Headers'
 pkgname=SPIRV-Headers
 reverts="1.5.4.raytracing.fixed_1 1.5.3_2 1.5.3_1 1.5.1_1 1.4.1_1"
-version=1.3.231.1
+version=1.3.243.0
 revision=1
 build_style=cmake
 short_desc="Machine-readable files for the SPIR-V Registry"
@@ -9,7 +9,7 @@ maintainer="tibequadorian <tibequadorian@posteo.de>"
 license="MIT"
 homepage="https://github.com/KhronosGroup/SPIRV-Headers"
 distfiles="https://github.com/KhronosGroup/SPIRV-Headers/archive/sdk-${version}.tar.gz"
-checksum=fc340700b005e9a2adc98475b5afbbabd1bc931f789a2afd02d54ebc22522af3
+checksum=16927b1868e7891377d059cd549484e4158912439cf77451ae7e01e2a3bcd28b
 
 post_install() {
 	vlicense LICENSE

From b8d79bd476a1dc74f40eb1e360140ec4cf05b745 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:28 +0200
Subject: [PATCH 15/31] SPIRV-Tools: update to 2023.2.

---
 srcpkgs/SPIRV-Tools/template | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/SPIRV-Tools/template b/srcpkgs/SPIRV-Tools/template
index 6a280baa0c28..b9b2ddbc2328 100644
--- a/srcpkgs/SPIRV-Tools/template
+++ b/srcpkgs/SPIRV-Tools/template
@@ -1,9 +1,11 @@
 # Template file for 'SPIRV-Tools'
 pkgname=SPIRV-Tools
-version=2022.4
+version=2023.2
 revision=1
 build_style=cmake
-configure_args="-DSPIRV_SKIP_TESTS=ON -DSPIRV_WERROR=OFF
+configure_args="
+ -DSPIRV_SKIP_TESTS=ON
+ -DSPIRV_WERROR=OFF
  -DSPIRV-Headers_SOURCE_DIR=${XBPS_CROSS_BASE}/usr"
 hostmakedepends="python3"
 makedepends="SPIRV-Headers"
@@ -13,8 +15,7 @@ license="Apache-2.0"
 homepage="https://github.com/KhronosGroup/SPIRV-Tools"
 changelog="https://raw.githubusercontent.com/KhronosGroup/SPIRV-Tools/master/CHANGES"
 distfiles="https://github.com/KhronosGroup/SPIRV-Tools/archive/v${version}.tar.gz"
-checksum=a156215a2d7c6c5b267933ed691877a9a66f07d75970da33ce9ad627a71389d7
-LDFLAGS="-Wl,--no-undefined"
+checksum=7416cc8a98a10c32bacc36a39930b0c5b2a484963df5d68f388ed7ffee1faad3
 
 SPIRV-Tools-devel_package() {
 	depends="SPIRV-Tools-${version}_${revision}"

From 53904cde1837a0681e75047d90a9aaa3869c0e74 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:33 +0200
Subject: [PATCH 16/31] SPIRV-LLVM-Translator: update to 16.0.0.

---
 common/shlibs                                 |  2 +-
 ...anslator-16.0.0-llvm-link-llvm-dylib.patch | 73 +++++++++++++++++++
 srcpkgs/SPIRV-LLVM-Translator/template        | 17 +++--
 3 files changed, 84 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch

diff --git a/common/shlibs b/common/shlibs
index 03af5e4ddb07..64deae182e63 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -997,7 +997,7 @@ libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
 libLLVM-16.so libllvm16-16.0.3_1
-libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.3_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.0_1
 libomp.so.5 libomp-15.0.7_1
 libomptarget.so.16 libomp-16.0.3_1
 libisofs.so.6 libisofs-0.6.24_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
new file mode 100644
index 000000000000..5cd90086f1e2
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
@@ -0,0 +1,73 @@
+From 98fadafeae0204defedd89f015f7fb88f2888b2f Mon Sep 17 00:00:00 2001
+From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
+Date: Fri, 17 Mar 2023 14:27:10 -0300
+Subject: [PATCH] Fix standalone builds with LLVM_LINK_LLVM_DYLIB=ON
+
+Move the LLVM components to LINK_COMPONENTS because the DEPENDS list has
+the same semantics as add_dependencies(). In this
+case it doesn't include the LLVM components when calling the linker.
+---
+ lib/SPIRV/CMakeLists.txt | 47 ++++++++++++----------------------------
+ 1 file changed, 14 insertions(+), 33 deletions(-)
+
+diff --git a/lib/SPIRV/CMakeLists.txt b/lib/SPIRV/CMakeLists.txt
+index bbef00528..2810c6b2c 100644
+--- a/lib/SPIRV/CMakeLists.txt
++++ b/lib/SPIRV/CMakeLists.txt
+@@ -38,42 +38,23 @@ set(SRC_LIST
+   libSPIRV/SPIRVType.cpp
+   libSPIRV/SPIRVValue.cpp
+ )
+-if(LLVM_LINK_LLVM_DYLIB)
+-  add_llvm_library(LLVMSPIRVLib STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
+-    ${SRC_LIST}
+-    DEPENDS
+-      intrinsics_gen
+-      LLVMAnalysis
+-      LLVMBitWriter
+-      LLVMCodeGen
+-      LLVMCore
+-      LLVMDemangle
+-      LLVMIRReader
+-      LLVMLinker
+-      LLVMPasses
+-      LLVMSupport
+-      LLVMTargetParser
+-      LLVMTransformUtils
+-  )
+-else()
+-  add_llvm_library(LLVMSPIRVLib
+-    ${SRC_LIST}
+-    LINK_COMPONENTS
+-      Analysis
+-      BitWriter
+-      CodeGen
+-      Core
+-      Demangle
+-      IRReader
+-      Linker
+-      Passes
+-      Support
+-      TargetParser
+-      TransformUtils
++add_llvm_library(LLVMSPIRVLib
++  ${SRC_LIST}
++  LINK_COMPONENTS
++    Analysis
++    BitWriter
++    CodeGen
++    Core
++    Demangle
++    IRReader
++    Linker
++    Passes
++    Support
++    TargetParser
++    TransformUtils
+   DEPENDS
+     intrinsics_gen
+   )
+-endif()
+ 
+ target_include_directories(LLVMSPIRVLib
+   PRIVATE
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index bee99f9bcbb2..1bdb54aad707 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -1,20 +1,23 @@
 # Template file for 'SPIRV-LLVM-Translator'
 pkgname=SPIRV-LLVM-Translator
-version=15.0.0
+version=16.0.0
 revision=1
 build_style=cmake
-make_build_args="llvm-spirv"
-configure_args="-Wno-dev -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_SKIP_RPATH=ON
- -DLLVM_SPIRV_INCLUDE_TESTS=OFF -DBUILD_SHARED_LIBS=ON
+# make_build_args="llvm-spirv"
+configure_args="-Wno-dev
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DCMAKE_SKIP_RPATH=ON
+ -DLLVM_SPIRV_INCLUDE_TESTS=OFF
+ -DBUILD_SHARED_LIBS=ON
  -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr"
-hostmakedepends="clang llvm"
-makedepends="clang-tools-extra llvm SPIRV-Headers"
+hostmakedepends="clang llvm16"
+makedepends="clang-tools-extra llvm16 SPIRV-Headers"
 short_desc="API and commands for processing SPIR-V modules"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA"
 homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
 distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v${version}.tar.gz"
-checksum=b1bebd77f72988758c00852e78c2ddc545815a612169a0cb377d021e2f846d88
+checksum=305fac5bb8efdad9054f0d27b5b765aca8b3349a500e2ba0c927763e42badc2b
 
 post_install() {
 	vlicense LICENSE.TXT

From 68a6ed1b28a3cf710bb7a3499d2931ab2ff354d9 Mon Sep 17 00:00:00 2001
From: Arda Demir <ddmirarda@gmail.com>
Date: Thu, 23 Feb 2023 12:31:16 +0300
Subject: [PATCH 17/31] mesa: update to 23.0.3.

---
 ...e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch | 77 -------------------
 srcpkgs/mesa/template                         | 10 +--
 2 files changed, 5 insertions(+), 82 deletions(-)
 delete mode 100644 srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch

diff --git a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch b/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
deleted file mode 100644
index f56327367526..000000000000
--- a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47 Mon Sep 17 00:00:00 2001
-From: Erico Nunes <nunes.erico@gmail.com>
-Date: Sun, 12 Feb 2023 22:33:30 +0100
-Subject: [PATCH] lima: don't use resource_from_handle while creating scanout
-
-resource_from_handle implementations create an additional reference to
-the scanout resource, which caused lima to leak those resources after
-commit ad4d7ca8332488be8a75aff001f00306a9f6402e.
-
-Do as the other drivers do and import the bo directly while creating
-the scanount resource.
-
-Cc: 22.3 mesa-stable
-Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8198
-Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
-Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21330>
----
- src/gallium/drivers/lima/lima_resource.c | 26 ++++++++++++++++++------
- 1 file changed, 20 insertions(+), 6 deletions(-)
-
-diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c
-index 54869ec03d24..0b7691f2b46f 100644
---- a/src/gallium/drivers/lima/lima_resource.c
-+++ b/src/gallium/drivers/lima/lima_resource.c
-@@ -59,7 +59,10 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    struct lima_screen *screen = lima_screen(pscreen);
-    struct renderonly_scanout *scanout;
-    struct winsys_handle handle;
--   struct pipe_resource *pres;
-+
-+   struct lima_resource *res = CALLOC_STRUCT(lima_resource);
-+   if (!res)
-+      return NULL;
- 
-    struct pipe_resource scanout_templat = *templat;
-    scanout_templat.width0 = width;
-@@ -71,20 +74,31 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    if (!scanout)
-       return NULL;
- 
-+   res->base = *templat;
-+   res->base.screen = pscreen;
-+   pipe_reference_init(&res->base.reference, 1);
-+   res->levels[0].offset = handle.offset;
-+   res->levels[0].stride = handle.stride;
-+
-    assert(handle.type == WINSYS_HANDLE_TYPE_FD);
--   pres = pscreen->resource_from_handle(pscreen, templat, &handle,
--                                        PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
-+   res->bo = lima_bo_import(screen, &handle);
-+   if (!res->bo) {
-+      FREE(res);
-+      return NULL;
-+   }
-+
-+   res->modifier_constant = true;
- 
-    close(handle.handle);
--   if (!pres) {
-+   if (!res->bo) {
-       renderonly_scanout_destroy(scanout, screen->ro);
-+      FREE(res);
-       return NULL;
-    }
- 
--   struct lima_resource *res = lima_resource(pres);
-    res->scanout = scanout;
- 
--   return pres;
-+   return &res->base;
- }
- 
- static uint32_t
--- 
-GitLab
-
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 132263d3599f..8306d8a534db 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,12 +1,12 @@
 # Template file for 'mesa'
 pkgname=mesa
-version=22.3.5
-revision=2
+version=23.0.3
+revision=1
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
- -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++14"
+ -Dllvm=enabled -Db_lto=false"
 hostmakedepends="gettext flex llvm pkg-config python3-Mako glslang
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
@@ -16,13 +16,13 @@ makedepends="elfutils-devel expat-devel libXdamage-devel
  libXrandr-devel libglvnd-devel libzstd-devel libxml2-devel lua53-devel
  libarchive-devel"
 depends="libglvnd"
-short_desc="Graphics library similar to SGI's OpenGL"
+short_desc="Open source implementation of OpenGL and Vulkan specifications"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="MIT, LGPL-2.1-or-later"
 homepage="https://www.mesa3d.org/"
 changelog="https://docs.mesa3d.org/relnotes.html"
 distfiles="https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
-checksum=3eed2ecae2bc674494566faab9fcc9beb21cd804c7ba2b59a1694f3d7236e6a9
+checksum=386362a5d80df3b096636b67f340e1ce67b705b44767d5bdd11d2ed1037192d5
 
 build_options="wayland"
 build_options_default="wayland"

From 7e0024cf44cc89123519ebdde3b41ff69630792f Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 18/31] codelite: rebuild for llvm16-16.0.3_1

---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index b0bf8f57736a..140fe20d0d26 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=16.0.0
-revision=3
+revision=4
 create_wrksrc=yes
 build_style=cmake
 build_helper=cmake-wxWidgets-gtk3

From a01f24b0314a050cbe6e15716e8eae94de8c89ed Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 19/31] geary: rebuild for llvm16-16.0.3_1

---
 srcpkgs/geary/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/geary/template b/srcpkgs/geary/template
index a1804b4b65e5..7479ab2bdb5c 100644
--- a/srcpkgs/geary/template
+++ b/srcpkgs/geary/template
@@ -1,7 +1,7 @@
 # Template file for 'geary'
 pkgname=geary
 version=43.0
-revision=2
+revision=3
 build_helper="gir"
 build_style=meson
 configure_args="-Dprofile=release -Dcontractor=enabled"

From e890796d9ce13da005b6591f899c83a3bc67634b Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 20/31] glog: rebuild for llvm16-16.0.3_1

---
 srcpkgs/glog/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/glog/template b/srcpkgs/glog/template
index 26110efd0a00..4cde03839d57 100644
--- a/srcpkgs/glog/template
+++ b/srcpkgs/glog/template
@@ -1,7 +1,7 @@
 # Template file for 'glog'
 pkgname=glog
 version=0.6.0
-revision=1
+revision=2
 build_style=cmake
 makedepends="gflags-devel libunwind-devel"
 checkdepends="gtest-devel"

From f543908a122629be9d078c805f277dc1e6047ddf Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 21/31] gnome-builder: rebuild for llvm16-16.0.3_1

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 4b56136453bd..d4e91ad17997 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=44.1
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dhelp=true -Dnetwork_tests=false"

From 412da3575531d6a2180afc5e7839edf7c5caaca4 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 22/31] gperftools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/gperftools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gperftools/template b/srcpkgs/gperftools/template
index de7e9423d343..e44f018aa3c1 100644
--- a/srcpkgs/gperftools/template
+++ b/srcpkgs/gperftools/template
@@ -1,7 +1,7 @@
 # Template file for 'gperftools'
 pkgname=gperftools
 version=2.8
-revision=2
+revision=3
 build_style=gnu-configure
 hostmakedepends="automake libtool"
 makedepends="libunwind-devel"

From 5fea3162a3a1a6b8cdcf189c55c3bcba9dc1fc82 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 23/31] heaptrack: rebuild for llvm16-16.0.3_1

---
 srcpkgs/heaptrack/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/heaptrack/template b/srcpkgs/heaptrack/template
index 74bc604993a5..7388dd050647 100644
--- a/srcpkgs/heaptrack/template
+++ b/srcpkgs/heaptrack/template
@@ -1,7 +1,7 @@
 # Template file for 'heaptrack'
 pkgname=heaptrack
 version=1.4.0
-revision=3
+revision=4
 build_style=cmake
 configure_args="-DHEAPTRACK_BUILD_GUI=ON"
 hostmakedepends="qt5-qmake qt5-host-tools extra-cmake-modules kcoreaddons

From 9a616b998e868a49e0b4ad7cf7e8bf813aa3ab2e Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:21 +0200
Subject: [PATCH 24/31] igt-gpu-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/igt-gpu-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/igt-gpu-tools/template b/srcpkgs/igt-gpu-tools/template
index 225e2c79118a..cf29756c2725 100644
--- a/srcpkgs/igt-gpu-tools/template
+++ b/srcpkgs/igt-gpu-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'igt-gpu-tools'
 pkgname=igt-gpu-tools
 version=1.27.1
-revision=1
+revision=2
 build_style=meson
 configure_args="-Db_ndebug=false -Ddocs=disabled"
 hostmakedepends="pkg-config flex peg python3-docutils"

From bf29390622340150cc0351e29d3db87433eaac43 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:21 +0200
Subject: [PATCH 25/31] juCi++: rebuild for llvm16-16.0.3_1

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 416bde7cc4d0..ad903e98b150 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.7.2
-revision=3
+revision=4
 _libclangmm_commit="9704b9b6de0982a588fa41741157d5640afedf30"
 _tiny_commit="839ff806dc447ff49af80f9a9eaa7949f770f8e5"
 create_wrksrc=yes

From cb91364e2097fc5ba0d4c1a717271d00df9e07af Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:21 +0200
Subject: [PATCH 26/31] kdevelop: rebuild for llvm16-16.0.3_1

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 87bb6b2d43f7..77ad2fb27345 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=22.12.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From c3bb1e62fe597b10de45516661c825a01507821b Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 27/31] qt5: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index e0463e1c9198..0ee7ca4f05b1 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -5,7 +5,7 @@ pkgname=qt5
 version=5.15.7+20221119
 # commit f8c9fb304bc3e53b3aa07f962cd74e9160decccc
 # base repo: https://invent.kde.org/qt/qt/qt5
-revision=4
+revision=5
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config
  python re2c ruby which"

From 249c85539ff18cd48fa34f5ce0e108dc55f56c22 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 28/31] rtags: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 9b161e690d76..0067603a2336 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=6
+revision=7
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From e44f5465ff40457754e3166f61ccc27a015d7551 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 29/31] shiboken2: rebuild for llvm16-16.0.3_1

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 084ecc3ba1e1..2a21998997eb 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.7
-revision=1
+revision=2
 _pkgname="pyside-setup-opensource-src-${version}"
 build_wrksrc="sources/shiboken2"
 build_style=cmake

From b8b263fa2c9c7179087661e0a6b9a24b8757ad4f Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 30/31] sysprof: rebuild for llvm16-16.0.3_1

---
 srcpkgs/sysprof/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/sysprof/template b/srcpkgs/sysprof/template
index 0a40abfb42b7..6d27e1ceeb24 100644
--- a/srcpkgs/sysprof/template
+++ b/srcpkgs/sysprof/template
@@ -1,7 +1,7 @@
 # Template file for 'sysprof'
 pkgname=sysprof
 version=3.46.0
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dgtk=true -Dsystemdunitdir=/usr/lib/systemd"
 hostmakedepends="gettext pkg-config itstool glib-devel desktop-file-utils

From 620c8ac8cc507a6bed840e4ef0710041614a2802 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:23 +0200
Subject: [PATCH 31/31] tilix: rebuild for llvm16-16.0.3_1

---
 srcpkgs/tilix/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tilix/template b/srcpkgs/tilix/template
index 74ccb4dd4592..77da7f7940ca 100644
--- a/srcpkgs/tilix/template
+++ b/srcpkgs/tilix/template
@@ -1,7 +1,7 @@
 # Template file for 'tilix'
 pkgname=tilix
 version=1.9.4
-revision=7
+revision=8
 _undead_version=1.1.8
 build_wrksrc="${pkgname}-${version}"
 build_style=meson

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (9 preceding siblings ...)
  2023-05-04 22:43 ` Duncaen
@ 2023-05-05 19:24 ` Duncaen
  2023-05-05 19:25 ` Duncaen
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-05 19:24 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From 61c64e50fe67b9770d8ec970471d2deb4ac02721 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH 01/32] New package: llvm16-16.0.3

---
 common/shlibs                                 |   9 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 38 files changed, 1105 insertions(+), 21 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/common/shlibs b/common/shlibs
index 8c47e79b8c43..63eb4e72bad6 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -990,15 +990,16 @@ 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.15 lldb-15.0.7_1
-libclang.so.15 libclang-15.0.7_1
-libclang-cpp.so.15 libclang-cpp-15.0.7_1
+liblldb.so.16 lldb-16.0.3_1
+libclang.so.16 libclang-16.0.3_1
+libclang-cpp.so.16 libclang-cpp-16.0.3_1
 libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
+libLLVM-16.so libllvm16-16.0.3_1
 libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
 libomp.so.5 libomp-15.0.7_1
-libomptarget.so.15 libomp-15.0.7_1
+libomptarget.so.16 libomp-16.0.3_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 b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..e1f9280b690b
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS=YES
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		# vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

From 5b50c87a8dbf8f4c8e59a16f6f433b983297b515 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 02/32] CastXML: rebuild for llvm16-16.0.3_1

---
 srcpkgs/CastXML/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/CastXML/template b/srcpkgs/CastXML/template
index de0920900ae4..323f61224ba9 100644
--- a/srcpkgs/CastXML/template
+++ b/srcpkgs/CastXML/template
@@ -1,7 +1,7 @@
 # Template file for 'CastXML'
 pkgname=CastXML
 version=0.5.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DSPHINX_MAN=YES -DCastXML_INSTALL_MAN_DIR=share/man"
 hostmakedepends="clang python3-Sphinx"

From f34c74f6efcad655f04b35beee77ac238e514e4d Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 03/32] bcc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bcc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 1b690066612f..970178656ddd 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.27.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version} -DENABLE_LLVM_SHARED=1"
 hostmakedepends="flex python3-setuptools"

From 5c5fe9b18666b85dbc6597c213c86ddc39d65148 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 04/32] bpftrace: rebuild for llvm16-16.0.3_1

---
 ...22cb14e2eedc5df17e53965824d7381f8e6f.patch | 41 +++++++++++++++++++
 ...7872b0c6600b69c5766ef7bdf736dd73ce9c.patch | 23 +++++++++++
 srcpkgs/bpftrace/template                     |  2 +-
 3 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
 create mode 100644 srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch

diff --git a/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch b/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
new file mode 100644
index 000000000000..2173cc81376a
--- /dev/null
+++ b/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
@@ -0,0 +1,41 @@
+From 70ee22cb14e2eedc5df17e53965824d7381f8e6f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 13 Mar 2023 21:30:27 -0700
+Subject: [PATCH] ast: Use std::optional in CodegenLLVM::CodegenLLVM call
+
+Fixes build with clang-16
+
+src/ast/passes/codegen_llvm.cpp:63:53: error: use of undeclared identifier 'Optional'; did you mean 'std::optional'?
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/ast/passes/codegen_llvm.cpp | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
+index 616ff89ddbc..fe440adf373 100644
+--- a/src/ast/passes/codegen_llvm.cpp
++++ b/src/ast/passes/codegen_llvm.cpp
+@@ -56,11 +56,17 @@ CodegenLLVM::CodegenLLVM(Node *root, BPFtrace &bpftrace)
+     throw std::runtime_error(
+         "Could not find bpf llvm target, does your llvm support it?");
+ 
+-  target_machine_.reset(target->createTargetMachine(LLVMTargetTriple,
+-                                                    "generic",
+-                                                    "",
+-                                                    TargetOptions(),
+-                                                    Optional<Reloc::Model>()));
++  target_machine_.reset(
++      target->createTargetMachine(LLVMTargetTriple,
++                                  "generic",
++                                  "",
++                                  TargetOptions(),
++#if LLVM_VERSION_MAJOR >= 16
++                                  std::optional<Reloc::Model>()
++#else
++                                  Optional<Reloc::Model>()
++#endif
++                                      ));
+   target_machine_->setOptLevel(llvm::CodeGenOpt::Aggressive);
+ 
+   module_->setTargetTriple(LLVMTargetTriple);
diff --git a/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch b/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch
new file mode 100644
index 000000000000..b95a1c8df984
--- /dev/null
+++ b/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch
@@ -0,0 +1,23 @@
+From 7eea7872b0c6600b69c5766ef7bdf736dd73ce9c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 10 Mar 2023 00:08:27 -0800
+Subject: [PATCH] cmake: Raise max llvm major version to 16
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index db5618e4efb..5cc489afe44 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -173,7 +173,7 @@ else()
+   endif()
+ 
+   set(MIN_LLVM_MAJOR 6)
+-  set(MAX_LLVM_MAJOR 15)
++  set(MAX_LLVM_MAJOR 16)
+ 
+   if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
+     message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}")
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index ad1bd0f50e73..549e8ad670a1 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.17.1
-revision=1
+revision=2
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
 configure_args="-DUSE_SYSTEM_BPF_BCC=ON -DBUILD_TESTING=OFF" # needs root to run

From 8bcf4183d7186a7815793771518e569d74588d00 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 05/32] ccls: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index ecc9f3e38a5d..ff74d135a1c4 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20220729
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang-tools-extra libxml2-devel llvm ncurses-devel rapidjson zlib-devel"

From 1c9789e649e79ef617c8b50c3ebea7880d7122dc Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 06/32] clazy: rebuild for llvm16-16.0.3_1

---
 srcpkgs/clazy/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index f81de08ab836..bdec40488d6a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.11
-revision=2
+revision=3
 build_style=cmake
 build_helper=qemu
 hostmakedepends="llvm"

From 62c03570df2ccbc8c6a065f7e1b8b9ae146c9991 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 07/32] include-what-you-use: rebuild for llvm16-16.0.3_1

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 1a30bc04bb2d..b9190c260eda 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.19
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
 hostmakedepends="python3"

From f482e8f3abadf1fd9790006606b554b7a95ebd82 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 08/32] ispc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index fbfa4f6db420..44489dee9a2e 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.19.0
-revision=2
+revision=3
 archs="aarch64* x86_64*"
 build_style=cmake
 configure_args="-DISPC_INCLUDE_EXAMPLES=OFF -DISPC_INCLUDE_RT=OFF"

From f19714456e1a84551f509eef9a25d4dc4c891f6d Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 09/32] ldc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ldc/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index f6d8b7ffbe98..90953ae27fcc 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,7 +1,7 @@
 # Template file for 'ldc'
 pkgname=ldc
 version=1.31.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="
  -DINCLUDE_INSTALL_DIR=/usr/include/dlang/ldc
@@ -11,7 +11,7 @@ configure_args="
  -DCOMPILE_D_MODULES_SEPARATELY=ON
  -DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm15 perl pkg-config"
+hostmakedepends="dmd llvm16 perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
  llvm-libunwind-devel"
 depends="ldc-runtime llvm-libunwind-devel"

From d52ad026b9e1a41b617a8e78eec046cb1f6f31c4 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 10/32] qt6-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt6-tools/patches/llvm16.patch | 52 ++++++++++++++++++++++++++
 srcpkgs/qt6-tools/template             |  2 +-
 2 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt6-tools/patches/llvm16.patch

diff --git a/srcpkgs/qt6-tools/patches/llvm16.patch b/srcpkgs/qt6-tools/patches/llvm16.patch
new file mode 100644
index 000000000000..e9b4b515c544
--- /dev/null
+++ b/srcpkgs/qt6-tools/patches/llvm16.patch
@@ -0,0 +1,52 @@
+From 87fac2de7378963e753a847da667d52d4ba95bff Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= <bjoern@hazardy.de>
+Date: Wed, 8 Feb 2023 12:31:04 +0100
+Subject: [PATCH] lupdate: Fix build with clang 16+
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The signature changed again.
+
+I've tested it with a current main, that is clang 17, but the commit
+854c10f8d185286d941307e1033eb492e085c203 with introduced the change is
+also contained in clang 16.
+
+Pick-to: 6.4 6.5
+Change-Id: I050ca5843708be4489757538849000d3675005ac
+Reviewed-by: Kai Köhne <kai.koehne@qt.io>
+---
+ src/linguist/lupdate/lupdatepreprocessoraction.cpp | 4 +++-
+ src/linguist/lupdate/lupdatepreprocessoraction.h   | 4 +++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/linguist/lupdate/lupdatepreprocessoraction.cpp b/src/linguist/lupdate/lupdatepreprocessoraction.cpp
+index d963747d8..478d5fbea 100644
+--- a/src/linguist/lupdate/lupdatepreprocessoraction.cpp
++++ b/src/linguist/lupdate/lupdatepreprocessoraction.cpp
+@@ -157,7 +157,9 @@ void LupdatePPCallbacks::SourceRangeSkipped(clang::SourceRange sourceRange,
+ void LupdatePPCallbacks::InclusionDirective(clang::SourceLocation /*hashLoc*/,
+     const clang::Token & /*includeTok*/, clang::StringRef /*fileName*/, bool /*isAngled*/,
+     clang::CharSourceRange /*filenameRange*/,
+-#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
++#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(16,0,0))
++    const clang::OptionalFileEntryRef file,
++#elif (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
+     const clang::Optional<clang::FileEntryRef> file,
+ #else
+     const clang::FileEntry *file,
+diff --git a/src/linguist/lupdate/lupdatepreprocessoraction.h b/src/linguist/lupdate/lupdatepreprocessoraction.h
+index 3e44cee83..673ecb495 100644
+--- a/src/linguist/lupdate/lupdatepreprocessoraction.h
++++ b/src/linguist/lupdate/lupdatepreprocessoraction.h
+@@ -52,7 +52,9 @@ class LupdatePPCallbacks : public clang::PPCallbacks
+     void InclusionDirective(clang::SourceLocation /*hashLoc*/, const clang::Token &/*includeTok*/,
+                             clang::StringRef /*fileName*/, bool /*isAngled*/,
+                             clang::CharSourceRange /*filenameRange*/,
+-#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
++#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(16,0,0))
++                            const clang::OptionalFileEntryRef file,
++#elif (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
+                             const clang::Optional<clang::FileEntryRef> file,
+ #else
+                             const clang::FileEntry *file,
diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index d5ad1618e3a7..c49c69f73901 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'qt6-tools'
 pkgname=qt6-tools
 version=6.4.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON

From 2cc647bcd1c35cab7fe458b4604a4a02a71fec45 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 11/32] qtcreator: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index b1dffd304198..046ca9cba57c 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=9.0.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="$(vopt_bool qbs BUILD_QBS) -DWITH_DOCS=ON -DBUILD_WITH_PCH=OFF
  -DQT_HOST_PATH=/usr/ -DQT_HOST_PATH_CMAKE_DIR=/usr/lib64/cmake/Qt6"

From 508875690ecd2e0707a2c8ba933b05a33e8986f1 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 12/32] rust: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rust/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template
index 88e35a5a43ad..53de9ac72231 100644
--- a/srcpkgs/rust/template
+++ b/srcpkgs/rust/template
@@ -9,9 +9,9 @@
 #
 pkgname=rust
 version=1.69.0
-revision=1
+revision=2
 hostmakedepends="cmake curl pkg-config python3 tar cargo-bootstrap"
-makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm15"
+makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm16"
 depends="rust-std"
 short_desc="Safe, concurrent, practical systems language"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -33,7 +33,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" rust llvm15"
+	hostmakedepends+=" rust llvm16"
 	# These are required for building the buildhost's stage0/1
 	hostmakedepends+=" libffi-devel libxml2-devel ncurses-devel zlib-devel"
 else

From 6f624739f9ee805b9518cb6acfb330a5e4edaba4 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:28:52 +0200
Subject: [PATCH 13/32] llvm: update to 16.

---
 srcpkgs/llvm/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index fc1c850bd26f..5a88372fb672 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=15
+version=16
 revision=1
 build_style=meta
-depends="llvm15"
+depends="llvm16"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From fd8d16145e4351690aa896388ac01db661d29965 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:16 +0200
Subject: [PATCH 14/32] SPIRV-Headers: update to 1.3.243.0.

---
 srcpkgs/SPIRV-Headers/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/SPIRV-Headers/template b/srcpkgs/SPIRV-Headers/template
index 8bb7d5f8b1ae..e3bca40c95be 100644
--- a/srcpkgs/SPIRV-Headers/template
+++ b/srcpkgs/SPIRV-Headers/template
@@ -1,7 +1,7 @@
 # Template file for 'SPIRV-Headers'
 pkgname=SPIRV-Headers
 reverts="1.5.4.raytracing.fixed_1 1.5.3_2 1.5.3_1 1.5.1_1 1.4.1_1"
-version=1.3.231.1
+version=1.3.243.0
 revision=1
 build_style=cmake
 short_desc="Machine-readable files for the SPIR-V Registry"
@@ -9,7 +9,7 @@ maintainer="tibequadorian <tibequadorian@posteo.de>"
 license="MIT"
 homepage="https://github.com/KhronosGroup/SPIRV-Headers"
 distfiles="https://github.com/KhronosGroup/SPIRV-Headers/archive/sdk-${version}.tar.gz"
-checksum=fc340700b005e9a2adc98475b5afbbabd1bc931f789a2afd02d54ebc22522af3
+checksum=16927b1868e7891377d059cd549484e4158912439cf77451ae7e01e2a3bcd28b
 
 post_install() {
 	vlicense LICENSE

From f33d017b356101686f3039854e1dfe7085b5173e Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:28 +0200
Subject: [PATCH 15/32] SPIRV-Tools: update to 2023.2.

---
 srcpkgs/SPIRV-Tools/template | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/SPIRV-Tools/template b/srcpkgs/SPIRV-Tools/template
index 6a280baa0c28..b9b2ddbc2328 100644
--- a/srcpkgs/SPIRV-Tools/template
+++ b/srcpkgs/SPIRV-Tools/template
@@ -1,9 +1,11 @@
 # Template file for 'SPIRV-Tools'
 pkgname=SPIRV-Tools
-version=2022.4
+version=2023.2
 revision=1
 build_style=cmake
-configure_args="-DSPIRV_SKIP_TESTS=ON -DSPIRV_WERROR=OFF
+configure_args="
+ -DSPIRV_SKIP_TESTS=ON
+ -DSPIRV_WERROR=OFF
  -DSPIRV-Headers_SOURCE_DIR=${XBPS_CROSS_BASE}/usr"
 hostmakedepends="python3"
 makedepends="SPIRV-Headers"
@@ -13,8 +15,7 @@ license="Apache-2.0"
 homepage="https://github.com/KhronosGroup/SPIRV-Tools"
 changelog="https://raw.githubusercontent.com/KhronosGroup/SPIRV-Tools/master/CHANGES"
 distfiles="https://github.com/KhronosGroup/SPIRV-Tools/archive/v${version}.tar.gz"
-checksum=a156215a2d7c6c5b267933ed691877a9a66f07d75970da33ce9ad627a71389d7
-LDFLAGS="-Wl,--no-undefined"
+checksum=7416cc8a98a10c32bacc36a39930b0c5b2a484963df5d68f388ed7ffee1faad3
 
 SPIRV-Tools-devel_package() {
 	depends="SPIRV-Tools-${version}_${revision}"

From c84d9beb2adc193e8717134ae628252a06440a4d Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:33 +0200
Subject: [PATCH 16/32] SPIRV-LLVM-Translator: update to 16.0.0.

---
 common/shlibs                                 |  2 +-
 ...anslator-16.0.0-llvm-link-llvm-dylib.patch | 73 +++++++++++++++++++
 srcpkgs/SPIRV-LLVM-Translator/template        | 17 +++--
 3 files changed, 84 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch

diff --git a/common/shlibs b/common/shlibs
index 63eb4e72bad6..64deae182e63 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -997,7 +997,7 @@ libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
 libLLVM-16.so libllvm16-16.0.3_1
-libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.0_1
 libomp.so.5 libomp-15.0.7_1
 libomptarget.so.16 libomp-16.0.3_1
 libisofs.so.6 libisofs-0.6.24_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
new file mode 100644
index 000000000000..5cd90086f1e2
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
@@ -0,0 +1,73 @@
+From 98fadafeae0204defedd89f015f7fb88f2888b2f Mon Sep 17 00:00:00 2001
+From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
+Date: Fri, 17 Mar 2023 14:27:10 -0300
+Subject: [PATCH] Fix standalone builds with LLVM_LINK_LLVM_DYLIB=ON
+
+Move the LLVM components to LINK_COMPONENTS because the DEPENDS list has
+the same semantics as add_dependencies(). In this
+case it doesn't include the LLVM components when calling the linker.
+---
+ lib/SPIRV/CMakeLists.txt | 47 ++++++++++++----------------------------
+ 1 file changed, 14 insertions(+), 33 deletions(-)
+
+diff --git a/lib/SPIRV/CMakeLists.txt b/lib/SPIRV/CMakeLists.txt
+index bbef00528..2810c6b2c 100644
+--- a/lib/SPIRV/CMakeLists.txt
++++ b/lib/SPIRV/CMakeLists.txt
+@@ -38,42 +38,23 @@ set(SRC_LIST
+   libSPIRV/SPIRVType.cpp
+   libSPIRV/SPIRVValue.cpp
+ )
+-if(LLVM_LINK_LLVM_DYLIB)
+-  add_llvm_library(LLVMSPIRVLib STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
+-    ${SRC_LIST}
+-    DEPENDS
+-      intrinsics_gen
+-      LLVMAnalysis
+-      LLVMBitWriter
+-      LLVMCodeGen
+-      LLVMCore
+-      LLVMDemangle
+-      LLVMIRReader
+-      LLVMLinker
+-      LLVMPasses
+-      LLVMSupport
+-      LLVMTargetParser
+-      LLVMTransformUtils
+-  )
+-else()
+-  add_llvm_library(LLVMSPIRVLib
+-    ${SRC_LIST}
+-    LINK_COMPONENTS
+-      Analysis
+-      BitWriter
+-      CodeGen
+-      Core
+-      Demangle
+-      IRReader
+-      Linker
+-      Passes
+-      Support
+-      TargetParser
+-      TransformUtils
++add_llvm_library(LLVMSPIRVLib
++  ${SRC_LIST}
++  LINK_COMPONENTS
++    Analysis
++    BitWriter
++    CodeGen
++    Core
++    Demangle
++    IRReader
++    Linker
++    Passes
++    Support
++    TargetParser
++    TransformUtils
+   DEPENDS
+     intrinsics_gen
+   )
+-endif()
+ 
+ target_include_directories(LLVMSPIRVLib
+   PRIVATE
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index bee99f9bcbb2..1bdb54aad707 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -1,20 +1,23 @@
 # Template file for 'SPIRV-LLVM-Translator'
 pkgname=SPIRV-LLVM-Translator
-version=15.0.0
+version=16.0.0
 revision=1
 build_style=cmake
-make_build_args="llvm-spirv"
-configure_args="-Wno-dev -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_SKIP_RPATH=ON
- -DLLVM_SPIRV_INCLUDE_TESTS=OFF -DBUILD_SHARED_LIBS=ON
+# make_build_args="llvm-spirv"
+configure_args="-Wno-dev
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DCMAKE_SKIP_RPATH=ON
+ -DLLVM_SPIRV_INCLUDE_TESTS=OFF
+ -DBUILD_SHARED_LIBS=ON
  -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr"
-hostmakedepends="clang llvm"
-makedepends="clang-tools-extra llvm SPIRV-Headers"
+hostmakedepends="clang llvm16"
+makedepends="clang-tools-extra llvm16 SPIRV-Headers"
 short_desc="API and commands for processing SPIR-V modules"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA"
 homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
 distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v${version}.tar.gz"
-checksum=b1bebd77f72988758c00852e78c2ddc545815a612169a0cb377d021e2f846d88
+checksum=305fac5bb8efdad9054f0d27b5b765aca8b3349a500e2ba0c927763e42badc2b
 
 post_install() {
 	vlicense LICENSE.TXT

From 5f196627639b058cb15600b664d5c9ebfff6f672 Mon Sep 17 00:00:00 2001
From: Arda Demir <ddmirarda@gmail.com>
Date: Thu, 23 Feb 2023 12:31:16 +0300
Subject: [PATCH 17/32] mesa: update to 23.0.3.

---
 ...e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch | 77 -------------------
 srcpkgs/mesa/template                         | 10 +--
 2 files changed, 5 insertions(+), 82 deletions(-)
 delete mode 100644 srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch

diff --git a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch b/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
deleted file mode 100644
index f56327367526..000000000000
--- a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47 Mon Sep 17 00:00:00 2001
-From: Erico Nunes <nunes.erico@gmail.com>
-Date: Sun, 12 Feb 2023 22:33:30 +0100
-Subject: [PATCH] lima: don't use resource_from_handle while creating scanout
-
-resource_from_handle implementations create an additional reference to
-the scanout resource, which caused lima to leak those resources after
-commit ad4d7ca8332488be8a75aff001f00306a9f6402e.
-
-Do as the other drivers do and import the bo directly while creating
-the scanount resource.
-
-Cc: 22.3 mesa-stable
-Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8198
-Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
-Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21330>
----
- src/gallium/drivers/lima/lima_resource.c | 26 ++++++++++++++++++------
- 1 file changed, 20 insertions(+), 6 deletions(-)
-
-diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c
-index 54869ec03d24..0b7691f2b46f 100644
---- a/src/gallium/drivers/lima/lima_resource.c
-+++ b/src/gallium/drivers/lima/lima_resource.c
-@@ -59,7 +59,10 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    struct lima_screen *screen = lima_screen(pscreen);
-    struct renderonly_scanout *scanout;
-    struct winsys_handle handle;
--   struct pipe_resource *pres;
-+
-+   struct lima_resource *res = CALLOC_STRUCT(lima_resource);
-+   if (!res)
-+      return NULL;
- 
-    struct pipe_resource scanout_templat = *templat;
-    scanout_templat.width0 = width;
-@@ -71,20 +74,31 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    if (!scanout)
-       return NULL;
- 
-+   res->base = *templat;
-+   res->base.screen = pscreen;
-+   pipe_reference_init(&res->base.reference, 1);
-+   res->levels[0].offset = handle.offset;
-+   res->levels[0].stride = handle.stride;
-+
-    assert(handle.type == WINSYS_HANDLE_TYPE_FD);
--   pres = pscreen->resource_from_handle(pscreen, templat, &handle,
--                                        PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
-+   res->bo = lima_bo_import(screen, &handle);
-+   if (!res->bo) {
-+      FREE(res);
-+      return NULL;
-+   }
-+
-+   res->modifier_constant = true;
- 
-    close(handle.handle);
--   if (!pres) {
-+   if (!res->bo) {
-       renderonly_scanout_destroy(scanout, screen->ro);
-+      FREE(res);
-       return NULL;
-    }
- 
--   struct lima_resource *res = lima_resource(pres);
-    res->scanout = scanout;
- 
--   return pres;
-+   return &res->base;
- }
- 
- static uint32_t
--- 
-GitLab
-
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 132263d3599f..8306d8a534db 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,12 +1,12 @@
 # Template file for 'mesa'
 pkgname=mesa
-version=22.3.5
-revision=2
+version=23.0.3
+revision=1
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
- -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++14"
+ -Dllvm=enabled -Db_lto=false"
 hostmakedepends="gettext flex llvm pkg-config python3-Mako glslang
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
@@ -16,13 +16,13 @@ makedepends="elfutils-devel expat-devel libXdamage-devel
  libXrandr-devel libglvnd-devel libzstd-devel libxml2-devel lua53-devel
  libarchive-devel"
 depends="libglvnd"
-short_desc="Graphics library similar to SGI's OpenGL"
+short_desc="Open source implementation of OpenGL and Vulkan specifications"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="MIT, LGPL-2.1-or-later"
 homepage="https://www.mesa3d.org/"
 changelog="https://docs.mesa3d.org/relnotes.html"
 distfiles="https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
-checksum=3eed2ecae2bc674494566faab9fcc9beb21cd804c7ba2b59a1694f3d7236e6a9
+checksum=386362a5d80df3b096636b67f340e1ce67b705b44767d5bdd11d2ed1037192d5
 
 build_options="wayland"
 build_options_default="wayland"

From af69af021f15b6b1a53acb7ea1bfffdc4869a799 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 18/32] codelite: rebuild for llvm16-16.0.3_1

---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index b0bf8f57736a..140fe20d0d26 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=16.0.0
-revision=3
+revision=4
 create_wrksrc=yes
 build_style=cmake
 build_helper=cmake-wxWidgets-gtk3

From 2b7cae62e71cbe2288dbc45037d54bcca6eeed6e Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 19/32] geary: rebuild for llvm16-16.0.3_1

---
 srcpkgs/geary/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/geary/template b/srcpkgs/geary/template
index a1804b4b65e5..7479ab2bdb5c 100644
--- a/srcpkgs/geary/template
+++ b/srcpkgs/geary/template
@@ -1,7 +1,7 @@
 # Template file for 'geary'
 pkgname=geary
 version=43.0
-revision=2
+revision=3
 build_helper="gir"
 build_style=meson
 configure_args="-Dprofile=release -Dcontractor=enabled"

From 3a6dad949d02cf83a1470cee44722f2b0fd26c69 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 20/32] glog: rebuild for llvm16-16.0.3_1

---
 srcpkgs/glog/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/glog/template b/srcpkgs/glog/template
index 26110efd0a00..4cde03839d57 100644
--- a/srcpkgs/glog/template
+++ b/srcpkgs/glog/template
@@ -1,7 +1,7 @@
 # Template file for 'glog'
 pkgname=glog
 version=0.6.0
-revision=1
+revision=2
 build_style=cmake
 makedepends="gflags-devel libunwind-devel"
 checkdepends="gtest-devel"

From 68f5010735f0e6a6902d40da59044a03cc6ec5bc Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 21/32] gnome-builder: rebuild for llvm16-16.0.3_1

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 4b56136453bd..d4e91ad17997 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=44.1
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dhelp=true -Dnetwork_tests=false"

From 90be1c0391d1be68882e8573d4e97d90fd15ba4d Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 22/32] gperftools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/gperftools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gperftools/template b/srcpkgs/gperftools/template
index de7e9423d343..e44f018aa3c1 100644
--- a/srcpkgs/gperftools/template
+++ b/srcpkgs/gperftools/template
@@ -1,7 +1,7 @@
 # Template file for 'gperftools'
 pkgname=gperftools
 version=2.8
-revision=2
+revision=3
 build_style=gnu-configure
 hostmakedepends="automake libtool"
 makedepends="libunwind-devel"

From fe9b32aed1d27db76f878d66bd875d85c76ebc07 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 23/32] heaptrack: rebuild for llvm16-16.0.3_1

---
 srcpkgs/heaptrack/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/heaptrack/template b/srcpkgs/heaptrack/template
index 74bc604993a5..7388dd050647 100644
--- a/srcpkgs/heaptrack/template
+++ b/srcpkgs/heaptrack/template
@@ -1,7 +1,7 @@
 # Template file for 'heaptrack'
 pkgname=heaptrack
 version=1.4.0
-revision=3
+revision=4
 build_style=cmake
 configure_args="-DHEAPTRACK_BUILD_GUI=ON"
 hostmakedepends="qt5-qmake qt5-host-tools extra-cmake-modules kcoreaddons

From f27f0101ddbb7262163cec4b75306e11fbeb6c21 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:21 +0200
Subject: [PATCH 24/32] igt-gpu-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/igt-gpu-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/igt-gpu-tools/template b/srcpkgs/igt-gpu-tools/template
index 225e2c79118a..cf29756c2725 100644
--- a/srcpkgs/igt-gpu-tools/template
+++ b/srcpkgs/igt-gpu-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'igt-gpu-tools'
 pkgname=igt-gpu-tools
 version=1.27.1
-revision=1
+revision=2
 build_style=meson
 configure_args="-Db_ndebug=false -Ddocs=disabled"
 hostmakedepends="pkg-config flex peg python3-docutils"

From 66251a8aef32d09fd4e0a76e9661daf66df2e491 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:21 +0200
Subject: [PATCH 25/32] juCi++: rebuild for llvm16-16.0.3_1

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 416bde7cc4d0..ad903e98b150 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.7.2
-revision=3
+revision=4
 _libclangmm_commit="9704b9b6de0982a588fa41741157d5640afedf30"
 _tiny_commit="839ff806dc447ff49af80f9a9eaa7949f770f8e5"
 create_wrksrc=yes

From 3de852b3614ddb73ad96ca7355ccb4fb88dad985 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:21 +0200
Subject: [PATCH 26/32] kdevelop: rebuild for llvm16-16.0.3_1

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 87bb6b2d43f7..77ad2fb27345 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=22.12.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From 19befb235f1a17f6d01b7833cab62d856c00ef90 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 27/32] qt5: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index e0463e1c9198..0ee7ca4f05b1 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -5,7 +5,7 @@ pkgname=qt5
 version=5.15.7+20221119
 # commit f8c9fb304bc3e53b3aa07f962cd74e9160decccc
 # base repo: https://invent.kde.org/qt/qt/qt5
-revision=4
+revision=5
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config
  python re2c ruby which"

From 5df5574f1b9db920dccf0adf67a346a64044eeeb Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 28/32] rtags: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 9b161e690d76..0067603a2336 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=6
+revision=7
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From a09aaa7e68657b5e0520b39a25904fd1bd501945 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 29/32] shiboken2: rebuild for llvm16-16.0.3_1

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 084ecc3ba1e1..2a21998997eb 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.7
-revision=1
+revision=2
 _pkgname="pyside-setup-opensource-src-${version}"
 build_wrksrc="sources/shiboken2"
 build_style=cmake

From d8c7fd92750e4da4180f08484de82505f52a960e Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 30/32] sysprof: rebuild for llvm16-16.0.3_1

---
 srcpkgs/sysprof/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/sysprof/template b/srcpkgs/sysprof/template
index 0a40abfb42b7..6d27e1ceeb24 100644
--- a/srcpkgs/sysprof/template
+++ b/srcpkgs/sysprof/template
@@ -1,7 +1,7 @@
 # Template file for 'sysprof'
 pkgname=sysprof
 version=3.46.0
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dgtk=true -Dsystemdunitdir=/usr/lib/systemd"
 hostmakedepends="gettext pkg-config itstool glib-devel desktop-file-utils

From b3befdab3dcd348de6e80fa860a1c322ce80ab5d Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:23 +0200
Subject: [PATCH 31/32] tilix: rebuild for llvm16-16.0.3_1

---
 srcpkgs/tilix/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tilix/template b/srcpkgs/tilix/template
index 74ccb4dd4592..77da7f7940ca 100644
--- a/srcpkgs/tilix/template
+++ b/srcpkgs/tilix/template
@@ -1,7 +1,7 @@
 # Template file for 'tilix'
 pkgname=tilix
 version=1.9.4
-revision=7
+revision=8
 _undead_version=1.1.8
 build_wrksrc="${pkgname}-${version}"
 build_style=meson

From 7765f980ebd42b7cd9e323ea67f59a3776e53e19 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 3 May 2023 22:27:40 +0200
Subject: [PATCH 32/32] chromium: update to 113.0.5672.63.

---
 .../musl-patches/quiche-arena-size.patch      | 15 ------
 ...g-for-std-strlen-in-web_view_impl.cc.patch | 29 +++++++++++
 .../patches/download-bubble-typename.patch    | 42 ++++++++++++++++
 ...-constraints-on-VirtualCursor-layout.patch | 48 -------------------
 .../chromium/patches/webauthn-variant.patch   | 14 ++++++
 srcpkgs/chromium/template                     |  4 +-
 6 files changed, 87 insertions(+), 65 deletions(-)
 delete mode 100644 srcpkgs/chromium/files/musl-patches/quiche-arena-size.patch
 create mode 100644 srcpkgs/chromium/patches/add-cstring-for-std-strlen-in-web_view_impl.cc.patch
 create mode 100644 srcpkgs/chromium/patches/download-bubble-typename.patch
 delete mode 100644 srcpkgs/chromium/patches/sql-relax-constraints-on-VirtualCursor-layout.patch
 create mode 100644 srcpkgs/chromium/patches/webauthn-variant.patch

diff --git a/srcpkgs/chromium/files/musl-patches/quiche-arena-size.patch b/srcpkgs/chromium/files/musl-patches/quiche-arena-size.patch
deleted file mode 100644
index 4d17c41b56d5..000000000000
--- a/srcpkgs/chromium/files/musl-patches/quiche-arena-size.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Source: https://git.alpinelinux.org/aports/plain/community/chromium/quiche-arena-size.patch
-back in the day when net_unittests were ran, the block arena size was not big
-enough for some reason. should look at this again
---
---- a/net/third_party/quiche/src/quiche/quic/core/quic_one_block_arena.h
-+++ b/net/third_party/quiche/src/quiche/quic/core/quic_one_block_arena.h
-@@ -69,7 +69,7 @@
- 
- // QuicConnections currently use around 1KB of polymorphic types which would
- // ordinarily be on the heap. Instead, store them inline in an arena.
--using QuicConnectionArena = QuicOneBlockArena<1280>;
-+using QuicConnectionArena = QuicOneBlockArena<1504>;
- 
- }  // namespace quic
- 
diff --git a/srcpkgs/chromium/patches/add-cstring-for-std-strlen-in-web_view_impl.cc.patch b/srcpkgs/chromium/patches/add-cstring-for-std-strlen-in-web_view_impl.cc.patch
new file mode 100644
index 000000000000..6648fab5719d
--- /dev/null
+++ b/srcpkgs/chromium/patches/add-cstring-for-std-strlen-in-web_view_impl.cc.patch
@@ -0,0 +1,29 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/79b774aedeaecd4d31b2adb84e3e4b901dc980aa/trunk/add-cstring-for-std-strlen-in-web_view_impl.cc.patch
+--
+From 2e14a3ac178ee87aa9154e5a15dcd986af1b6059 Mon Sep 17 00:00:00 2001
+From: Stephan Hartmann <stha09@googlemail.com>
+Date: Tue, 28 Mar 2023 14:34:55 +0000
+Subject: [PATCH] IWYU: add cstring for std::strlen in web_view_impl.cc
+
+Bug: 957519
+Change-Id: I15ad1e905eda3d96bbf164f5df8f3cf8e02bc370
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4376772
+Reviewed-by: Alex Ilin <alexilin@chromium.org>
+Commit-Queue: Alex Ilin <alexilin@chromium.org>
+Cr-Commit-Position: refs/heads/main@{#1123011}
+---
+ chrome/test/chromedriver/chrome/web_view_impl.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/chrome/test/chromedriver/chrome/web_view_impl.cc b/chrome/test/chromedriver/chrome/web_view_impl.cc
+index f726627e88d..d96d481d0bc 100644
+--- a/chrome/test/chromedriver/chrome/web_view_impl.cc
++++ b/chrome/test/chromedriver/chrome/web_view_impl.cc
+@@ -6,6 +6,7 @@
+ 
+ #include <stddef.h>
+ #include <algorithm>
++#include <cstring>
+ #include <memory>
+ #include <queue>
+ #include <utility>
diff --git a/srcpkgs/chromium/patches/download-bubble-typename.patch b/srcpkgs/chromium/patches/download-bubble-typename.patch
new file mode 100644
index 000000000000..8edb46974a5b
--- /dev/null
+++ b/srcpkgs/chromium/patches/download-bubble-typename.patch
@@ -0,0 +1,42 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/79b774aedeaecd4d31b2adb84e3e4b901dc980aa/trunk/download-bubble-typename.patch
+--
+diff --git a/chrome/browser/download/bubble/download_bubble_update_service.cc b/chrome/browser/download/bubble/download_bubble_update_service.cc
+index 13460309d0e..a18d2f8a272 100644
+--- a/chrome/browser/download/bubble/download_bubble_update_service.cc
++++ b/chrome/browser/download/bubble/download_bubble_update_service.cc
+@@ -87,7 +87,7 @@ ItemSortKey GetSortKey(const Item& item) {
+ // Helper to get an iterator to the last element in the cache. The cache
+ // must not be empty.
+ template <typename Item>
+-SortedItems<Item>::iterator GetLastIter(SortedItems<Item>& cache) {
++typename SortedItems<Item>::iterator GetLastIter(SortedItems<Item>& cache) {
+   CHECK(!cache.empty());
+   auto it = cache.end();
+   return std::prev(it);
+@@ -656,9 +656,9 @@ bool DownloadBubbleUpdateService::RemoveItemFromCacheImpl(
+ }
+ 
+ template <typename Id, typename Item>
+-SortedItems<Item>::iterator
++typename SortedItems<Item>::iterator
+ DownloadBubbleUpdateService::RemoveItemFromCacheByIter(
+-    SortedItems<Item>::iterator iter,
++    typename SortedItems<Item>::iterator iter,
+     SortedItems<Item>& cache,
+     IterMap<Id, Item>& iter_map) {
+   CHECK(iter != cache.end());
+diff --git a/chrome/browser/download/bubble/download_bubble_update_service.h b/chrome/browser/download/bubble/download_bubble_update_service.h
+index 4c3c0bc1193..38048873aa9 100644
+--- a/chrome/browser/download/bubble/download_bubble_update_service.h
++++ b/chrome/browser/download/bubble/download_bubble_update_service.h
+@@ -179,8 +179,8 @@ class DownloadBubbleUpdateService
+ 
+   // Removes item if we already have the iterator to it. Returns next iterator.
+   template <typename Id, typename Item>
+-  SortedItems<Item>::iterator RemoveItemFromCacheByIter(
+-      SortedItems<Item>::iterator iter,
++  typename SortedItems<Item>::iterator RemoveItemFromCacheByIter(
++      typename SortedItems<Item>::iterator iter,
+       SortedItems<Item>& cache,
+       IterMap<Id, Item>& iter_map);
+ 
diff --git a/srcpkgs/chromium/patches/sql-relax-constraints-on-VirtualCursor-layout.patch b/srcpkgs/chromium/patches/sql-relax-constraints-on-VirtualCursor-layout.patch
deleted file mode 100644
index d1e65ee1561c..000000000000
--- a/srcpkgs/chromium/patches/sql-relax-constraints-on-VirtualCursor-layout.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 7d1394bd639e3bcf68082ac3fc33eeed6a00d2e6 Mon Sep 17 00:00:00 2001
-From: Elly Fong-Jones <ellyjones@chromium.org>
-Date: Thu, 2 Mar 2023 00:15:11 +0000
-Subject: [PATCH] sql: relax constraints on VirtualCursor layout
-
-VirtualCursor::FromSqliteCursor required that VirtualCursor had a
-standard layout, but in fact VirtualCursor shouldn't have a standard
-layout, and the fact that it does with libc++ is a deviation from the
-C++ standard. This change:
-
-1. Relaxes the requirement that VirtualCursor has a standard layout, and
-2. Relaxes the requirement that the sqlite_cursor_ field has to be at
-   offset 0
-
-by use of offsetof() and pointer subtraction. This change both improves
-standards compliance and makes this code build with libstdc++.
-
-Bug: 1380656
-Change-Id: I9c47abd9197b187da0360ca5619ccf7dadab4f33
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4292313
-Reviewed-by: Austin Sullivan <asully@chromium.org>
-Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
-Cr-Commit-Position: refs/heads/main@{#1111925}
----
- sql/recover_module/cursor.h | 10 ++++------
- 1 file changed, 4 insertions(+), 6 deletions(-)
-
-diff --git a/sql/recover_module/cursor.h b/sql/recover_module/cursor.h
-index 1970bdca8c6..4cb06557009 100644
---- a/sql/recover_module/cursor.h
-+++ b/sql/recover_module/cursor.h
-@@ -63,12 +63,10 @@ class VirtualCursor {
-   // |sqlite_cursor| must have been returned by VirtualTable::SqliteCursor().
-   static inline VirtualCursor* FromSqliteCursor(
-       sqlite3_vtab_cursor* sqlite_cursor) {
--    static_assert(std::is_standard_layout<VirtualCursor>::value,
--                  "needed for the reinterpret_cast below");
--    static_assert(offsetof(VirtualCursor, sqlite_cursor_) == 0,
--                  "sqlite_cursor_ must be the first member of the class");
--    VirtualCursor* result = reinterpret_cast<VirtualCursor*>(sqlite_cursor);
--    DCHECK_EQ(sqlite_cursor, &result->sqlite_cursor_);
-+    VirtualCursor* result = reinterpret_cast<VirtualCursor*>(
-+        (reinterpret_cast<char*>(sqlite_cursor) -
-+         offsetof(VirtualCursor, sqlite_cursor_)));
-+    CHECK_EQ(sqlite_cursor, &result->sqlite_cursor_);
-     return result;
-   }
- 
diff --git a/srcpkgs/chromium/patches/webauthn-variant.patch b/srcpkgs/chromium/patches/webauthn-variant.patch
new file mode 100644
index 000000000000..2ee02f5e5fe1
--- /dev/null
+++ b/srcpkgs/chromium/patches/webauthn-variant.patch
@@ -0,0 +1,14 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/79b774aedeaecd4d31b2adb84e3e4b901dc980aa/trunk/webauthn-variant.patch
+--
+diff --git a/chrome/browser/webauthn/authenticator_request_dialog_model.h b/chrome/browser/webauthn/authenticator_request_dialog_model.h
+index f4992a74bd6..45cabe39974 100644
+--- a/chrome/browser/webauthn/authenticator_request_dialog_model.h
++++ b/chrome/browser/webauthn/authenticator_request_dialog_model.h
+@@ -7,6 +7,7 @@
+ 
+ #include <memory>
+ #include <string>
++#include <variant>
+ #include <vector>
+ 
+ #include "base/containers/span.h"
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e50c739d3ee7..c3a1cd59eafe 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,7 +1,7 @@
 # Template file for 'chromium'
 pkgname=chromium
 # See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=112.0.5615.49
+version=113.0.5672.63
 revision=1
 archs="i686* x86_64* aarch64* armv7l*"
 hostmakedepends="
@@ -28,7 +28,7 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
 license="BSD-3-Clause"
 homepage="https://www.chromium.org/"
 distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=ddfd37373c1fa0f433a6ac11f0baa2b1f3fdfb9c7b5867e32a4300f2eb5aff41
+checksum=76cec11dc13abe6703305b0300e1fe24c8f547c1ff313f7be09db0e23d12ee1e
 
 lib32disabled=yes
 

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (10 preceding siblings ...)
  2023-05-05 19:24 ` Duncaen
@ 2023-05-05 19:25 ` Duncaen
  2023-05-05 19:27 ` Duncaen
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-05 19:25 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From 84fc545b84383883c0c19799d4973c3ec22a0e91 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH 01/32] New package: llvm16-16.0.3

---
 common/shlibs                                 |   9 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 38 files changed, 1105 insertions(+), 21 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/common/shlibs b/common/shlibs
index 8c47e79b8c43..63eb4e72bad6 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -990,15 +990,16 @@ 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.15 lldb-15.0.7_1
-libclang.so.15 libclang-15.0.7_1
-libclang-cpp.so.15 libclang-cpp-15.0.7_1
+liblldb.so.16 lldb-16.0.3_1
+libclang.so.16 libclang-16.0.3_1
+libclang-cpp.so.16 libclang-cpp-16.0.3_1
 libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
+libLLVM-16.so libllvm16-16.0.3_1
 libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
 libomp.so.5 libomp-15.0.7_1
-libomptarget.so.15 libomp-15.0.7_1
+libomptarget.so.16 libomp-16.0.3_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 b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..e1f9280b690b
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS=YES
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		# vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

From a7c03372fb5deb6a267364384cff41e58440ef0a Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 02/32] CastXML: rebuild for llvm16-16.0.3_1

---
 srcpkgs/CastXML/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/CastXML/template b/srcpkgs/CastXML/template
index de0920900ae4..323f61224ba9 100644
--- a/srcpkgs/CastXML/template
+++ b/srcpkgs/CastXML/template
@@ -1,7 +1,7 @@
 # Template file for 'CastXML'
 pkgname=CastXML
 version=0.5.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DSPHINX_MAN=YES -DCastXML_INSTALL_MAN_DIR=share/man"
 hostmakedepends="clang python3-Sphinx"

From 6f3c5bc3c4739be1a5291d0e2e8d4f66a26a3d0e Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 03/32] bcc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bcc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 1b690066612f..970178656ddd 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.27.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version} -DENABLE_LLVM_SHARED=1"
 hostmakedepends="flex python3-setuptools"

From a3b09c89b50dd84a93d99b641c36159b2e6beb87 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 04/32] bpftrace: rebuild for llvm16-16.0.3_1

---
 ...22cb14e2eedc5df17e53965824d7381f8e6f.patch | 41 +++++++++++++++++++
 ...7872b0c6600b69c5766ef7bdf736dd73ce9c.patch | 23 +++++++++++
 srcpkgs/bpftrace/template                     |  2 +-
 3 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
 create mode 100644 srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch

diff --git a/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch b/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
new file mode 100644
index 000000000000..2173cc81376a
--- /dev/null
+++ b/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
@@ -0,0 +1,41 @@
+From 70ee22cb14e2eedc5df17e53965824d7381f8e6f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 13 Mar 2023 21:30:27 -0700
+Subject: [PATCH] ast: Use std::optional in CodegenLLVM::CodegenLLVM call
+
+Fixes build with clang-16
+
+src/ast/passes/codegen_llvm.cpp:63:53: error: use of undeclared identifier 'Optional'; did you mean 'std::optional'?
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/ast/passes/codegen_llvm.cpp | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
+index 616ff89ddbc..fe440adf373 100644
+--- a/src/ast/passes/codegen_llvm.cpp
++++ b/src/ast/passes/codegen_llvm.cpp
+@@ -56,11 +56,17 @@ CodegenLLVM::CodegenLLVM(Node *root, BPFtrace &bpftrace)
+     throw std::runtime_error(
+         "Could not find bpf llvm target, does your llvm support it?");
+ 
+-  target_machine_.reset(target->createTargetMachine(LLVMTargetTriple,
+-                                                    "generic",
+-                                                    "",
+-                                                    TargetOptions(),
+-                                                    Optional<Reloc::Model>()));
++  target_machine_.reset(
++      target->createTargetMachine(LLVMTargetTriple,
++                                  "generic",
++                                  "",
++                                  TargetOptions(),
++#if LLVM_VERSION_MAJOR >= 16
++                                  std::optional<Reloc::Model>()
++#else
++                                  Optional<Reloc::Model>()
++#endif
++                                      ));
+   target_machine_->setOptLevel(llvm::CodeGenOpt::Aggressive);
+ 
+   module_->setTargetTriple(LLVMTargetTriple);
diff --git a/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch b/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch
new file mode 100644
index 000000000000..b95a1c8df984
--- /dev/null
+++ b/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch
@@ -0,0 +1,23 @@
+From 7eea7872b0c6600b69c5766ef7bdf736dd73ce9c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 10 Mar 2023 00:08:27 -0800
+Subject: [PATCH] cmake: Raise max llvm major version to 16
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index db5618e4efb..5cc489afe44 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -173,7 +173,7 @@ else()
+   endif()
+ 
+   set(MIN_LLVM_MAJOR 6)
+-  set(MAX_LLVM_MAJOR 15)
++  set(MAX_LLVM_MAJOR 16)
+ 
+   if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
+     message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}")
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index ad1bd0f50e73..549e8ad670a1 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.17.1
-revision=1
+revision=2
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
 configure_args="-DUSE_SYSTEM_BPF_BCC=ON -DBUILD_TESTING=OFF" # needs root to run

From dbd6787331de175d0c850742fed4b0dde64fdf22 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 05/32] ccls: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index ecc9f3e38a5d..ff74d135a1c4 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20220729
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang-tools-extra libxml2-devel llvm ncurses-devel rapidjson zlib-devel"

From 5b33e04e97d93a11dbff0bb9dc60c6a8c8ab0998 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 06/32] clazy: rebuild for llvm16-16.0.3_1

---
 srcpkgs/clazy/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index f81de08ab836..bdec40488d6a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.11
-revision=2
+revision=3
 build_style=cmake
 build_helper=qemu
 hostmakedepends="llvm"

From 7f67ac60301d4af042824e15d877f4a69f9b5016 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 07/32] include-what-you-use: rebuild for llvm16-16.0.3_1

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 1a30bc04bb2d..b9190c260eda 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.19
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
 hostmakedepends="python3"

From b0b978b17482ac3cf729e20f92fa590628ccbab1 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 08/32] ispc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index fbfa4f6db420..44489dee9a2e 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.19.0
-revision=2
+revision=3
 archs="aarch64* x86_64*"
 build_style=cmake
 configure_args="-DISPC_INCLUDE_EXAMPLES=OFF -DISPC_INCLUDE_RT=OFF"

From d2135812bee3f8b1779a78d1dbea0f056f99b8cb Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 09/32] ldc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ldc/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index f6d8b7ffbe98..90953ae27fcc 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,7 +1,7 @@
 # Template file for 'ldc'
 pkgname=ldc
 version=1.31.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="
  -DINCLUDE_INSTALL_DIR=/usr/include/dlang/ldc
@@ -11,7 +11,7 @@ configure_args="
  -DCOMPILE_D_MODULES_SEPARATELY=ON
  -DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm15 perl pkg-config"
+hostmakedepends="dmd llvm16 perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
  llvm-libunwind-devel"
 depends="ldc-runtime llvm-libunwind-devel"

From 8608833e032871d5d91abed64d6878fe64b16f35 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 10/32] qt6-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt6-tools/patches/llvm16.patch | 52 ++++++++++++++++++++++++++
 srcpkgs/qt6-tools/template             |  2 +-
 2 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt6-tools/patches/llvm16.patch

diff --git a/srcpkgs/qt6-tools/patches/llvm16.patch b/srcpkgs/qt6-tools/patches/llvm16.patch
new file mode 100644
index 000000000000..e9b4b515c544
--- /dev/null
+++ b/srcpkgs/qt6-tools/patches/llvm16.patch
@@ -0,0 +1,52 @@
+From 87fac2de7378963e753a847da667d52d4ba95bff Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= <bjoern@hazardy.de>
+Date: Wed, 8 Feb 2023 12:31:04 +0100
+Subject: [PATCH] lupdate: Fix build with clang 16+
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The signature changed again.
+
+I've tested it with a current main, that is clang 17, but the commit
+854c10f8d185286d941307e1033eb492e085c203 with introduced the change is
+also contained in clang 16.
+
+Pick-to: 6.4 6.5
+Change-Id: I050ca5843708be4489757538849000d3675005ac
+Reviewed-by: Kai Köhne <kai.koehne@qt.io>
+---
+ src/linguist/lupdate/lupdatepreprocessoraction.cpp | 4 +++-
+ src/linguist/lupdate/lupdatepreprocessoraction.h   | 4 +++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/linguist/lupdate/lupdatepreprocessoraction.cpp b/src/linguist/lupdate/lupdatepreprocessoraction.cpp
+index d963747d8..478d5fbea 100644
+--- a/src/linguist/lupdate/lupdatepreprocessoraction.cpp
++++ b/src/linguist/lupdate/lupdatepreprocessoraction.cpp
+@@ -157,7 +157,9 @@ void LupdatePPCallbacks::SourceRangeSkipped(clang::SourceRange sourceRange,
+ void LupdatePPCallbacks::InclusionDirective(clang::SourceLocation /*hashLoc*/,
+     const clang::Token & /*includeTok*/, clang::StringRef /*fileName*/, bool /*isAngled*/,
+     clang::CharSourceRange /*filenameRange*/,
+-#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
++#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(16,0,0))
++    const clang::OptionalFileEntryRef file,
++#elif (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
+     const clang::Optional<clang::FileEntryRef> file,
+ #else
+     const clang::FileEntry *file,
+diff --git a/src/linguist/lupdate/lupdatepreprocessoraction.h b/src/linguist/lupdate/lupdatepreprocessoraction.h
+index 3e44cee83..673ecb495 100644
+--- a/src/linguist/lupdate/lupdatepreprocessoraction.h
++++ b/src/linguist/lupdate/lupdatepreprocessoraction.h
+@@ -52,7 +52,9 @@ class LupdatePPCallbacks : public clang::PPCallbacks
+     void InclusionDirective(clang::SourceLocation /*hashLoc*/, const clang::Token &/*includeTok*/,
+                             clang::StringRef /*fileName*/, bool /*isAngled*/,
+                             clang::CharSourceRange /*filenameRange*/,
+-#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
++#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(16,0,0))
++                            const clang::OptionalFileEntryRef file,
++#elif (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
+                             const clang::Optional<clang::FileEntryRef> file,
+ #else
+                             const clang::FileEntry *file,
diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index d5ad1618e3a7..c49c69f73901 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'qt6-tools'
 pkgname=qt6-tools
 version=6.4.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON

From 542bc8477fd7992e42606b39140153f1f05ac59a Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 11/32] qtcreator: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index b1dffd304198..046ca9cba57c 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=9.0.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="$(vopt_bool qbs BUILD_QBS) -DWITH_DOCS=ON -DBUILD_WITH_PCH=OFF
  -DQT_HOST_PATH=/usr/ -DQT_HOST_PATH_CMAKE_DIR=/usr/lib64/cmake/Qt6"

From 4d33a8c6c17c435842f919bec9b438f47e1a2f20 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 12/32] rust: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rust/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template
index 88e35a5a43ad..53de9ac72231 100644
--- a/srcpkgs/rust/template
+++ b/srcpkgs/rust/template
@@ -9,9 +9,9 @@
 #
 pkgname=rust
 version=1.69.0
-revision=1
+revision=2
 hostmakedepends="cmake curl pkg-config python3 tar cargo-bootstrap"
-makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm15"
+makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm16"
 depends="rust-std"
 short_desc="Safe, concurrent, practical systems language"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -33,7 +33,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" rust llvm15"
+	hostmakedepends+=" rust llvm16"
 	# These are required for building the buildhost's stage0/1
 	hostmakedepends+=" libffi-devel libxml2-devel ncurses-devel zlib-devel"
 else

From d1a1d19a0972ad5873559be0accfb78b3d368290 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:28:52 +0200
Subject: [PATCH 13/32] llvm: update to 16.

---
 srcpkgs/llvm/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index fc1c850bd26f..5a88372fb672 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=15
+version=16
 revision=1
 build_style=meta
-depends="llvm15"
+depends="llvm16"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From e3818936c09335782e4feef4badc40b4cd602cd5 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:16 +0200
Subject: [PATCH 14/32] SPIRV-Headers: update to 1.3.243.0.

---
 srcpkgs/SPIRV-Headers/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/SPIRV-Headers/template b/srcpkgs/SPIRV-Headers/template
index 8bb7d5f8b1ae..e3bca40c95be 100644
--- a/srcpkgs/SPIRV-Headers/template
+++ b/srcpkgs/SPIRV-Headers/template
@@ -1,7 +1,7 @@
 # Template file for 'SPIRV-Headers'
 pkgname=SPIRV-Headers
 reverts="1.5.4.raytracing.fixed_1 1.5.3_2 1.5.3_1 1.5.1_1 1.4.1_1"
-version=1.3.231.1
+version=1.3.243.0
 revision=1
 build_style=cmake
 short_desc="Machine-readable files for the SPIR-V Registry"
@@ -9,7 +9,7 @@ maintainer="tibequadorian <tibequadorian@posteo.de>"
 license="MIT"
 homepage="https://github.com/KhronosGroup/SPIRV-Headers"
 distfiles="https://github.com/KhronosGroup/SPIRV-Headers/archive/sdk-${version}.tar.gz"
-checksum=fc340700b005e9a2adc98475b5afbbabd1bc931f789a2afd02d54ebc22522af3
+checksum=16927b1868e7891377d059cd549484e4158912439cf77451ae7e01e2a3bcd28b
 
 post_install() {
 	vlicense LICENSE

From 075c3a160cc8dfad05ba2ed479c0e0e585020bd0 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:28 +0200
Subject: [PATCH 15/32] SPIRV-Tools: update to 2023.2.

---
 srcpkgs/SPIRV-Tools/template | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/SPIRV-Tools/template b/srcpkgs/SPIRV-Tools/template
index 6a280baa0c28..b9b2ddbc2328 100644
--- a/srcpkgs/SPIRV-Tools/template
+++ b/srcpkgs/SPIRV-Tools/template
@@ -1,9 +1,11 @@
 # Template file for 'SPIRV-Tools'
 pkgname=SPIRV-Tools
-version=2022.4
+version=2023.2
 revision=1
 build_style=cmake
-configure_args="-DSPIRV_SKIP_TESTS=ON -DSPIRV_WERROR=OFF
+configure_args="
+ -DSPIRV_SKIP_TESTS=ON
+ -DSPIRV_WERROR=OFF
  -DSPIRV-Headers_SOURCE_DIR=${XBPS_CROSS_BASE}/usr"
 hostmakedepends="python3"
 makedepends="SPIRV-Headers"
@@ -13,8 +15,7 @@ license="Apache-2.0"
 homepage="https://github.com/KhronosGroup/SPIRV-Tools"
 changelog="https://raw.githubusercontent.com/KhronosGroup/SPIRV-Tools/master/CHANGES"
 distfiles="https://github.com/KhronosGroup/SPIRV-Tools/archive/v${version}.tar.gz"
-checksum=a156215a2d7c6c5b267933ed691877a9a66f07d75970da33ce9ad627a71389d7
-LDFLAGS="-Wl,--no-undefined"
+checksum=7416cc8a98a10c32bacc36a39930b0c5b2a484963df5d68f388ed7ffee1faad3
 
 SPIRV-Tools-devel_package() {
 	depends="SPIRV-Tools-${version}_${revision}"

From 7df3802d0c4c21f4b9ef14dfb1f3a63e56855748 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:33 +0200
Subject: [PATCH 16/32] SPIRV-LLVM-Translator: update to 16.0.0.

---
 common/shlibs                                 |  2 +-
 ...anslator-16.0.0-llvm-link-llvm-dylib.patch | 73 +++++++++++++++++++
 srcpkgs/SPIRV-LLVM-Translator/template        | 17 +++--
 3 files changed, 84 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch

diff --git a/common/shlibs b/common/shlibs
index 63eb4e72bad6..64deae182e63 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -997,7 +997,7 @@ libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
 libLLVM-16.so libllvm16-16.0.3_1
-libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.0_1
 libomp.so.5 libomp-15.0.7_1
 libomptarget.so.16 libomp-16.0.3_1
 libisofs.so.6 libisofs-0.6.24_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
new file mode 100644
index 000000000000..5cd90086f1e2
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
@@ -0,0 +1,73 @@
+From 98fadafeae0204defedd89f015f7fb88f2888b2f Mon Sep 17 00:00:00 2001
+From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
+Date: Fri, 17 Mar 2023 14:27:10 -0300
+Subject: [PATCH] Fix standalone builds with LLVM_LINK_LLVM_DYLIB=ON
+
+Move the LLVM components to LINK_COMPONENTS because the DEPENDS list has
+the same semantics as add_dependencies(). In this
+case it doesn't include the LLVM components when calling the linker.
+---
+ lib/SPIRV/CMakeLists.txt | 47 ++++++++++++----------------------------
+ 1 file changed, 14 insertions(+), 33 deletions(-)
+
+diff --git a/lib/SPIRV/CMakeLists.txt b/lib/SPIRV/CMakeLists.txt
+index bbef00528..2810c6b2c 100644
+--- a/lib/SPIRV/CMakeLists.txt
++++ b/lib/SPIRV/CMakeLists.txt
+@@ -38,42 +38,23 @@ set(SRC_LIST
+   libSPIRV/SPIRVType.cpp
+   libSPIRV/SPIRVValue.cpp
+ )
+-if(LLVM_LINK_LLVM_DYLIB)
+-  add_llvm_library(LLVMSPIRVLib STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
+-    ${SRC_LIST}
+-    DEPENDS
+-      intrinsics_gen
+-      LLVMAnalysis
+-      LLVMBitWriter
+-      LLVMCodeGen
+-      LLVMCore
+-      LLVMDemangle
+-      LLVMIRReader
+-      LLVMLinker
+-      LLVMPasses
+-      LLVMSupport
+-      LLVMTargetParser
+-      LLVMTransformUtils
+-  )
+-else()
+-  add_llvm_library(LLVMSPIRVLib
+-    ${SRC_LIST}
+-    LINK_COMPONENTS
+-      Analysis
+-      BitWriter
+-      CodeGen
+-      Core
+-      Demangle
+-      IRReader
+-      Linker
+-      Passes
+-      Support
+-      TargetParser
+-      TransformUtils
++add_llvm_library(LLVMSPIRVLib
++  ${SRC_LIST}
++  LINK_COMPONENTS
++    Analysis
++    BitWriter
++    CodeGen
++    Core
++    Demangle
++    IRReader
++    Linker
++    Passes
++    Support
++    TargetParser
++    TransformUtils
+   DEPENDS
+     intrinsics_gen
+   )
+-endif()
+ 
+ target_include_directories(LLVMSPIRVLib
+   PRIVATE
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index bee99f9bcbb2..1bdb54aad707 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -1,20 +1,23 @@
 # Template file for 'SPIRV-LLVM-Translator'
 pkgname=SPIRV-LLVM-Translator
-version=15.0.0
+version=16.0.0
 revision=1
 build_style=cmake
-make_build_args="llvm-spirv"
-configure_args="-Wno-dev -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_SKIP_RPATH=ON
- -DLLVM_SPIRV_INCLUDE_TESTS=OFF -DBUILD_SHARED_LIBS=ON
+# make_build_args="llvm-spirv"
+configure_args="-Wno-dev
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DCMAKE_SKIP_RPATH=ON
+ -DLLVM_SPIRV_INCLUDE_TESTS=OFF
+ -DBUILD_SHARED_LIBS=ON
  -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr"
-hostmakedepends="clang llvm"
-makedepends="clang-tools-extra llvm SPIRV-Headers"
+hostmakedepends="clang llvm16"
+makedepends="clang-tools-extra llvm16 SPIRV-Headers"
 short_desc="API and commands for processing SPIR-V modules"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA"
 homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
 distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v${version}.tar.gz"
-checksum=b1bebd77f72988758c00852e78c2ddc545815a612169a0cb377d021e2f846d88
+checksum=305fac5bb8efdad9054f0d27b5b765aca8b3349a500e2ba0c927763e42badc2b
 
 post_install() {
 	vlicense LICENSE.TXT

From 1f00c89d8bc5ef68be5af64256f28ca58e0850c9 Mon Sep 17 00:00:00 2001
From: Arda Demir <ddmirarda@gmail.com>
Date: Thu, 23 Feb 2023 12:31:16 +0300
Subject: [PATCH 17/32] mesa: update to 23.0.3.

---
 ...e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch | 77 -------------------
 srcpkgs/mesa/template                         | 10 +--
 2 files changed, 5 insertions(+), 82 deletions(-)
 delete mode 100644 srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch

diff --git a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch b/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
deleted file mode 100644
index f56327367526..000000000000
--- a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47 Mon Sep 17 00:00:00 2001
-From: Erico Nunes <nunes.erico@gmail.com>
-Date: Sun, 12 Feb 2023 22:33:30 +0100
-Subject: [PATCH] lima: don't use resource_from_handle while creating scanout
-
-resource_from_handle implementations create an additional reference to
-the scanout resource, which caused lima to leak those resources after
-commit ad4d7ca8332488be8a75aff001f00306a9f6402e.
-
-Do as the other drivers do and import the bo directly while creating
-the scanount resource.
-
-Cc: 22.3 mesa-stable
-Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8198
-Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
-Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21330>
----
- src/gallium/drivers/lima/lima_resource.c | 26 ++++++++++++++++++------
- 1 file changed, 20 insertions(+), 6 deletions(-)
-
-diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c
-index 54869ec03d24..0b7691f2b46f 100644
---- a/src/gallium/drivers/lima/lima_resource.c
-+++ b/src/gallium/drivers/lima/lima_resource.c
-@@ -59,7 +59,10 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    struct lima_screen *screen = lima_screen(pscreen);
-    struct renderonly_scanout *scanout;
-    struct winsys_handle handle;
--   struct pipe_resource *pres;
-+
-+   struct lima_resource *res = CALLOC_STRUCT(lima_resource);
-+   if (!res)
-+      return NULL;
- 
-    struct pipe_resource scanout_templat = *templat;
-    scanout_templat.width0 = width;
-@@ -71,20 +74,31 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    if (!scanout)
-       return NULL;
- 
-+   res->base = *templat;
-+   res->base.screen = pscreen;
-+   pipe_reference_init(&res->base.reference, 1);
-+   res->levels[0].offset = handle.offset;
-+   res->levels[0].stride = handle.stride;
-+
-    assert(handle.type == WINSYS_HANDLE_TYPE_FD);
--   pres = pscreen->resource_from_handle(pscreen, templat, &handle,
--                                        PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
-+   res->bo = lima_bo_import(screen, &handle);
-+   if (!res->bo) {
-+      FREE(res);
-+      return NULL;
-+   }
-+
-+   res->modifier_constant = true;
- 
-    close(handle.handle);
--   if (!pres) {
-+   if (!res->bo) {
-       renderonly_scanout_destroy(scanout, screen->ro);
-+      FREE(res);
-       return NULL;
-    }
- 
--   struct lima_resource *res = lima_resource(pres);
-    res->scanout = scanout;
- 
--   return pres;
-+   return &res->base;
- }
- 
- static uint32_t
--- 
-GitLab
-
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 132263d3599f..8306d8a534db 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,12 +1,12 @@
 # Template file for 'mesa'
 pkgname=mesa
-version=22.3.5
-revision=2
+version=23.0.3
+revision=1
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
- -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++14"
+ -Dllvm=enabled -Db_lto=false"
 hostmakedepends="gettext flex llvm pkg-config python3-Mako glslang
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
@@ -16,13 +16,13 @@ makedepends="elfutils-devel expat-devel libXdamage-devel
  libXrandr-devel libglvnd-devel libzstd-devel libxml2-devel lua53-devel
  libarchive-devel"
 depends="libglvnd"
-short_desc="Graphics library similar to SGI's OpenGL"
+short_desc="Open source implementation of OpenGL and Vulkan specifications"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="MIT, LGPL-2.1-or-later"
 homepage="https://www.mesa3d.org/"
 changelog="https://docs.mesa3d.org/relnotes.html"
 distfiles="https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
-checksum=3eed2ecae2bc674494566faab9fcc9beb21cd804c7ba2b59a1694f3d7236e6a9
+checksum=386362a5d80df3b096636b67f340e1ce67b705b44767d5bdd11d2ed1037192d5
 
 build_options="wayland"
 build_options_default="wayland"

From 5d2b924c70d01d6c4cd526a60b5450291168822b Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 18/32] codelite: rebuild for llvm16-16.0.3_1

---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index b0bf8f57736a..140fe20d0d26 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=16.0.0
-revision=3
+revision=4
 create_wrksrc=yes
 build_style=cmake
 build_helper=cmake-wxWidgets-gtk3

From d4058f2588f0fcc3d6262f818caedb96d08eb809 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 19/32] geary: rebuild for llvm16-16.0.3_1

---
 srcpkgs/geary/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/geary/template b/srcpkgs/geary/template
index a1804b4b65e5..7479ab2bdb5c 100644
--- a/srcpkgs/geary/template
+++ b/srcpkgs/geary/template
@@ -1,7 +1,7 @@
 # Template file for 'geary'
 pkgname=geary
 version=43.0
-revision=2
+revision=3
 build_helper="gir"
 build_style=meson
 configure_args="-Dprofile=release -Dcontractor=enabled"

From 45c9da73ede34c82950c7114202198717b7cdb5b Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 20/32] glog: rebuild for llvm16-16.0.3_1

---
 srcpkgs/glog/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/glog/template b/srcpkgs/glog/template
index 26110efd0a00..4cde03839d57 100644
--- a/srcpkgs/glog/template
+++ b/srcpkgs/glog/template
@@ -1,7 +1,7 @@
 # Template file for 'glog'
 pkgname=glog
 version=0.6.0
-revision=1
+revision=2
 build_style=cmake
 makedepends="gflags-devel libunwind-devel"
 checkdepends="gtest-devel"

From 5fe441b88ff349c8831c54146fa205e257ad5abc Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 21/32] gnome-builder: rebuild for llvm16-16.0.3_1

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 4b56136453bd..d4e91ad17997 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=44.1
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dhelp=true -Dnetwork_tests=false"

From 30e29dc7fa4b9eae638af1b33ea0a4be76157e30 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 22/32] gperftools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/gperftools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gperftools/template b/srcpkgs/gperftools/template
index de7e9423d343..e44f018aa3c1 100644
--- a/srcpkgs/gperftools/template
+++ b/srcpkgs/gperftools/template
@@ -1,7 +1,7 @@
 # Template file for 'gperftools'
 pkgname=gperftools
 version=2.8
-revision=2
+revision=3
 build_style=gnu-configure
 hostmakedepends="automake libtool"
 makedepends="libunwind-devel"

From 69b7f01fdece0993736d59c39846fe2b128bae2f Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 23/32] heaptrack: rebuild for llvm16-16.0.3_1

---
 srcpkgs/heaptrack/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/heaptrack/template b/srcpkgs/heaptrack/template
index 74bc604993a5..7388dd050647 100644
--- a/srcpkgs/heaptrack/template
+++ b/srcpkgs/heaptrack/template
@@ -1,7 +1,7 @@
 # Template file for 'heaptrack'
 pkgname=heaptrack
 version=1.4.0
-revision=3
+revision=4
 build_style=cmake
 configure_args="-DHEAPTRACK_BUILD_GUI=ON"
 hostmakedepends="qt5-qmake qt5-host-tools extra-cmake-modules kcoreaddons

From 68445e613e8cc4a2934c8a4d3c7eff9b2c219178 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:21 +0200
Subject: [PATCH 24/32] igt-gpu-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/igt-gpu-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/igt-gpu-tools/template b/srcpkgs/igt-gpu-tools/template
index 225e2c79118a..cf29756c2725 100644
--- a/srcpkgs/igt-gpu-tools/template
+++ b/srcpkgs/igt-gpu-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'igt-gpu-tools'
 pkgname=igt-gpu-tools
 version=1.27.1
-revision=1
+revision=2
 build_style=meson
 configure_args="-Db_ndebug=false -Ddocs=disabled"
 hostmakedepends="pkg-config flex peg python3-docutils"

From 6ddec718dc4a9b6efccf71c546064f05b8b7fed0 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:21 +0200
Subject: [PATCH 25/32] juCi++: rebuild for llvm16-16.0.3_1

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 416bde7cc4d0..ad903e98b150 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.7.2
-revision=3
+revision=4
 _libclangmm_commit="9704b9b6de0982a588fa41741157d5640afedf30"
 _tiny_commit="839ff806dc447ff49af80f9a9eaa7949f770f8e5"
 create_wrksrc=yes

From 0152a5db09eebae17acaf3dfe2e642df35f411f4 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:21 +0200
Subject: [PATCH 26/32] kdevelop: rebuild for llvm16-16.0.3_1

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 87bb6b2d43f7..77ad2fb27345 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=22.12.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From 37cafba32649a1c4dca2bcd1035f897991850e66 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 27/32] qt5: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index e0463e1c9198..0ee7ca4f05b1 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -5,7 +5,7 @@ pkgname=qt5
 version=5.15.7+20221119
 # commit f8c9fb304bc3e53b3aa07f962cd74e9160decccc
 # base repo: https://invent.kde.org/qt/qt/qt5
-revision=4
+revision=5
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config
  python re2c ruby which"

From c2cb8b8e8e77e78892560848a4a11837945765ba Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 28/32] rtags: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 9b161e690d76..0067603a2336 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=6
+revision=7
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From 72d043dbb94fc2dc0a2051342a889efd088ff6c7 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 29/32] shiboken2: rebuild for llvm16-16.0.3_1

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 084ecc3ba1e1..2a21998997eb 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.7
-revision=1
+revision=2
 _pkgname="pyside-setup-opensource-src-${version}"
 build_wrksrc="sources/shiboken2"
 build_style=cmake

From c909554619cda239129821c4f4f29026e4681bc7 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 30/32] sysprof: rebuild for llvm16-16.0.3_1

---
 srcpkgs/sysprof/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/sysprof/template b/srcpkgs/sysprof/template
index 0a40abfb42b7..6d27e1ceeb24 100644
--- a/srcpkgs/sysprof/template
+++ b/srcpkgs/sysprof/template
@@ -1,7 +1,7 @@
 # Template file for 'sysprof'
 pkgname=sysprof
 version=3.46.0
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dgtk=true -Dsystemdunitdir=/usr/lib/systemd"
 hostmakedepends="gettext pkg-config itstool glib-devel desktop-file-utils

From c793e806f8c97389e386f9c78723fa4c16a75dfe Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:23 +0200
Subject: [PATCH 31/32] tilix: rebuild for llvm16-16.0.3_1

---
 srcpkgs/tilix/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tilix/template b/srcpkgs/tilix/template
index 74ccb4dd4592..77da7f7940ca 100644
--- a/srcpkgs/tilix/template
+++ b/srcpkgs/tilix/template
@@ -1,7 +1,7 @@
 # Template file for 'tilix'
 pkgname=tilix
 version=1.9.4
-revision=7
+revision=8
 _undead_version=1.1.8
 build_wrksrc="${pkgname}-${version}"
 build_style=meson

From 3b520c44d78a4d8d7581d3aeadd8b5b0a05cc965 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 3 May 2023 22:27:40 +0200
Subject: [PATCH 32/32] chromium: update to 113.0.5672.63.

---
 .../musl-patches/quiche-arena-size.patch      | 15 ------
 ...g-for-std-strlen-in-web_view_impl.cc.patch | 29 +++++++++++
 .../patches/download-bubble-typename.patch    | 42 ++++++++++++++++
 ...-constraints-on-VirtualCursor-layout.patch | 48 -------------------
 .../chromium/patches/webauthn-variant.patch   | 14 ++++++
 srcpkgs/chromium/template                     |  4 +-
 6 files changed, 87 insertions(+), 65 deletions(-)
 delete mode 100644 srcpkgs/chromium/files/musl-patches/quiche-arena-size.patch
 create mode 100644 srcpkgs/chromium/patches/add-cstring-for-std-strlen-in-web_view_impl.cc.patch
 create mode 100644 srcpkgs/chromium/patches/download-bubble-typename.patch
 delete mode 100644 srcpkgs/chromium/patches/sql-relax-constraints-on-VirtualCursor-layout.patch
 create mode 100644 srcpkgs/chromium/patches/webauthn-variant.patch

diff --git a/srcpkgs/chromium/files/musl-patches/quiche-arena-size.patch b/srcpkgs/chromium/files/musl-patches/quiche-arena-size.patch
deleted file mode 100644
index 4d17c41b56d5..000000000000
--- a/srcpkgs/chromium/files/musl-patches/quiche-arena-size.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Source: https://git.alpinelinux.org/aports/plain/community/chromium/quiche-arena-size.patch
-back in the day when net_unittests were ran, the block arena size was not big
-enough for some reason. should look at this again
---
---- a/net/third_party/quiche/src/quiche/quic/core/quic_one_block_arena.h
-+++ b/net/third_party/quiche/src/quiche/quic/core/quic_one_block_arena.h
-@@ -69,7 +69,7 @@
- 
- // QuicConnections currently use around 1KB of polymorphic types which would
- // ordinarily be on the heap. Instead, store them inline in an arena.
--using QuicConnectionArena = QuicOneBlockArena<1280>;
-+using QuicConnectionArena = QuicOneBlockArena<1504>;
- 
- }  // namespace quic
- 
diff --git a/srcpkgs/chromium/patches/add-cstring-for-std-strlen-in-web_view_impl.cc.patch b/srcpkgs/chromium/patches/add-cstring-for-std-strlen-in-web_view_impl.cc.patch
new file mode 100644
index 000000000000..6648fab5719d
--- /dev/null
+++ b/srcpkgs/chromium/patches/add-cstring-for-std-strlen-in-web_view_impl.cc.patch
@@ -0,0 +1,29 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/79b774aedeaecd4d31b2adb84e3e4b901dc980aa/trunk/add-cstring-for-std-strlen-in-web_view_impl.cc.patch
+--
+From 2e14a3ac178ee87aa9154e5a15dcd986af1b6059 Mon Sep 17 00:00:00 2001
+From: Stephan Hartmann <stha09@googlemail.com>
+Date: Tue, 28 Mar 2023 14:34:55 +0000
+Subject: [PATCH] IWYU: add cstring for std::strlen in web_view_impl.cc
+
+Bug: 957519
+Change-Id: I15ad1e905eda3d96bbf164f5df8f3cf8e02bc370
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4376772
+Reviewed-by: Alex Ilin <alexilin@chromium.org>
+Commit-Queue: Alex Ilin <alexilin@chromium.org>
+Cr-Commit-Position: refs/heads/main@{#1123011}
+---
+ chrome/test/chromedriver/chrome/web_view_impl.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/chrome/test/chromedriver/chrome/web_view_impl.cc b/chrome/test/chromedriver/chrome/web_view_impl.cc
+index f726627e88d..d96d481d0bc 100644
+--- a/chrome/test/chromedriver/chrome/web_view_impl.cc
++++ b/chrome/test/chromedriver/chrome/web_view_impl.cc
+@@ -6,6 +6,7 @@
+ 
+ #include <stddef.h>
+ #include <algorithm>
++#include <cstring>
+ #include <memory>
+ #include <queue>
+ #include <utility>
diff --git a/srcpkgs/chromium/patches/download-bubble-typename.patch b/srcpkgs/chromium/patches/download-bubble-typename.patch
new file mode 100644
index 000000000000..8edb46974a5b
--- /dev/null
+++ b/srcpkgs/chromium/patches/download-bubble-typename.patch
@@ -0,0 +1,42 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/79b774aedeaecd4d31b2adb84e3e4b901dc980aa/trunk/download-bubble-typename.patch
+--
+diff --git a/chrome/browser/download/bubble/download_bubble_update_service.cc b/chrome/browser/download/bubble/download_bubble_update_service.cc
+index 13460309d0e..a18d2f8a272 100644
+--- a/chrome/browser/download/bubble/download_bubble_update_service.cc
++++ b/chrome/browser/download/bubble/download_bubble_update_service.cc
+@@ -87,7 +87,7 @@ ItemSortKey GetSortKey(const Item& item) {
+ // Helper to get an iterator to the last element in the cache. The cache
+ // must not be empty.
+ template <typename Item>
+-SortedItems<Item>::iterator GetLastIter(SortedItems<Item>& cache) {
++typename SortedItems<Item>::iterator GetLastIter(SortedItems<Item>& cache) {
+   CHECK(!cache.empty());
+   auto it = cache.end();
+   return std::prev(it);
+@@ -656,9 +656,9 @@ bool DownloadBubbleUpdateService::RemoveItemFromCacheImpl(
+ }
+ 
+ template <typename Id, typename Item>
+-SortedItems<Item>::iterator
++typename SortedItems<Item>::iterator
+ DownloadBubbleUpdateService::RemoveItemFromCacheByIter(
+-    SortedItems<Item>::iterator iter,
++    typename SortedItems<Item>::iterator iter,
+     SortedItems<Item>& cache,
+     IterMap<Id, Item>& iter_map) {
+   CHECK(iter != cache.end());
+diff --git a/chrome/browser/download/bubble/download_bubble_update_service.h b/chrome/browser/download/bubble/download_bubble_update_service.h
+index 4c3c0bc1193..38048873aa9 100644
+--- a/chrome/browser/download/bubble/download_bubble_update_service.h
++++ b/chrome/browser/download/bubble/download_bubble_update_service.h
+@@ -179,8 +179,8 @@ class DownloadBubbleUpdateService
+ 
+   // Removes item if we already have the iterator to it. Returns next iterator.
+   template <typename Id, typename Item>
+-  SortedItems<Item>::iterator RemoveItemFromCacheByIter(
+-      SortedItems<Item>::iterator iter,
++  typename SortedItems<Item>::iterator RemoveItemFromCacheByIter(
++      typename SortedItems<Item>::iterator iter,
+       SortedItems<Item>& cache,
+       IterMap<Id, Item>& iter_map);
+ 
diff --git a/srcpkgs/chromium/patches/sql-relax-constraints-on-VirtualCursor-layout.patch b/srcpkgs/chromium/patches/sql-relax-constraints-on-VirtualCursor-layout.patch
deleted file mode 100644
index d1e65ee1561c..000000000000
--- a/srcpkgs/chromium/patches/sql-relax-constraints-on-VirtualCursor-layout.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 7d1394bd639e3bcf68082ac3fc33eeed6a00d2e6 Mon Sep 17 00:00:00 2001
-From: Elly Fong-Jones <ellyjones@chromium.org>
-Date: Thu, 2 Mar 2023 00:15:11 +0000
-Subject: [PATCH] sql: relax constraints on VirtualCursor layout
-
-VirtualCursor::FromSqliteCursor required that VirtualCursor had a
-standard layout, but in fact VirtualCursor shouldn't have a standard
-layout, and the fact that it does with libc++ is a deviation from the
-C++ standard. This change:
-
-1. Relaxes the requirement that VirtualCursor has a standard layout, and
-2. Relaxes the requirement that the sqlite_cursor_ field has to be at
-   offset 0
-
-by use of offsetof() and pointer subtraction. This change both improves
-standards compliance and makes this code build with libstdc++.
-
-Bug: 1380656
-Change-Id: I9c47abd9197b187da0360ca5619ccf7dadab4f33
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4292313
-Reviewed-by: Austin Sullivan <asully@chromium.org>
-Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
-Cr-Commit-Position: refs/heads/main@{#1111925}
----
- sql/recover_module/cursor.h | 10 ++++------
- 1 file changed, 4 insertions(+), 6 deletions(-)
-
-diff --git a/sql/recover_module/cursor.h b/sql/recover_module/cursor.h
-index 1970bdca8c6..4cb06557009 100644
---- a/sql/recover_module/cursor.h
-+++ b/sql/recover_module/cursor.h
-@@ -63,12 +63,10 @@ class VirtualCursor {
-   // |sqlite_cursor| must have been returned by VirtualTable::SqliteCursor().
-   static inline VirtualCursor* FromSqliteCursor(
-       sqlite3_vtab_cursor* sqlite_cursor) {
--    static_assert(std::is_standard_layout<VirtualCursor>::value,
--                  "needed for the reinterpret_cast below");
--    static_assert(offsetof(VirtualCursor, sqlite_cursor_) == 0,
--                  "sqlite_cursor_ must be the first member of the class");
--    VirtualCursor* result = reinterpret_cast<VirtualCursor*>(sqlite_cursor);
--    DCHECK_EQ(sqlite_cursor, &result->sqlite_cursor_);
-+    VirtualCursor* result = reinterpret_cast<VirtualCursor*>(
-+        (reinterpret_cast<char*>(sqlite_cursor) -
-+         offsetof(VirtualCursor, sqlite_cursor_)));
-+    CHECK_EQ(sqlite_cursor, &result->sqlite_cursor_);
-     return result;
-   }
- 
diff --git a/srcpkgs/chromium/patches/webauthn-variant.patch b/srcpkgs/chromium/patches/webauthn-variant.patch
new file mode 100644
index 000000000000..2ee02f5e5fe1
--- /dev/null
+++ b/srcpkgs/chromium/patches/webauthn-variant.patch
@@ -0,0 +1,14 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/79b774aedeaecd4d31b2adb84e3e4b901dc980aa/trunk/webauthn-variant.patch
+--
+diff --git a/chrome/browser/webauthn/authenticator_request_dialog_model.h b/chrome/browser/webauthn/authenticator_request_dialog_model.h
+index f4992a74bd6..45cabe39974 100644
+--- a/chrome/browser/webauthn/authenticator_request_dialog_model.h
++++ b/chrome/browser/webauthn/authenticator_request_dialog_model.h
+@@ -7,6 +7,7 @@
+ 
+ #include <memory>
+ #include <string>
++#include <variant>
+ #include <vector>
+ 
+ #include "base/containers/span.h"
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e50c739d3ee7..c3a1cd59eafe 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,7 +1,7 @@
 # Template file for 'chromium'
 pkgname=chromium
 # See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=112.0.5615.49
+version=113.0.5672.63
 revision=1
 archs="i686* x86_64* aarch64* armv7l*"
 hostmakedepends="
@@ -28,7 +28,7 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
 license="BSD-3-Clause"
 homepage="https://www.chromium.org/"
 distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=ddfd37373c1fa0f433a6ac11f0baa2b1f3fdfb9c7b5867e32a4300f2eb5aff41
+checksum=76cec11dc13abe6703305b0300e1fe24c8f547c1ff313f7be09db0e23d12ee1e
 
 lib32disabled=yes
 

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

* Re: [PR PATCH] [Updated] New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (11 preceding siblings ...)
  2023-05-05 19:25 ` Duncaen
@ 2023-05-05 19:27 ` Duncaen
  2023-07-05  4:14 ` wozniak
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2023-05-05 19:27 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Duncaen/void-packages llvm16
https://github.com/void-linux/void-packages/pull/43739

New package: llvm16-16.0.3
[ci skip]

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

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

From 84fc545b84383883c0c19799d4973c3ec22a0e91 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 01:50:17 +0200
Subject: [PATCH 01/32] New package: llvm16-16.0.3

---
 common/shlibs                                 |   9 +-
 srcpkgs/clang                                 |   2 +-
 srcpkgs/clang-analyzer                        |   2 +-
 srcpkgs/clang-tools-extra                     |   2 +-
 srcpkgs/libclang                              |   2 +-
 srcpkgs/libclang-cpp                          |   2 +-
 srcpkgs/libcxx                                |   2 +-
 srcpkgs/libcxx-devel                          |   2 +-
 srcpkgs/libcxxabi                             |   2 +-
 srcpkgs/libcxxabi-devel                       |   2 +-
 srcpkgs/libllvm16                             |   1 +
 srcpkgs/libomp                                |   2 +-
 srcpkgs/libomp-devel                          |   2 +-
 srcpkgs/lld                                   |   2 +-
 srcpkgs/lld-devel                             |   2 +-
 srcpkgs/lldb                                  |   2 +-
 srcpkgs/lldb-devel                            |   2 +-
 srcpkgs/llvm-libunwind                        |   2 +-
 srcpkgs/llvm-libunwind-devel                  |   2 +-
 .../llvm16/files/llvm-Config-llvm-config.h    |   9 +
 ...s-set-a-larger-stack-size-explicitly.patch |  33 ++
 ..._EXEC-related-test-failures-on-aarch.patch |  26 +
 .../0016-libc-musl-locale-workarounds.patch   |  40 ++
 ...clang-001-fix-unwind-chain-inclusion.patch |  44 ++
 .../patches/clang-002-add-musl-triples.patch  | 115 +++++
 .../patches/cmake-runtimes-cmake-flags.patch  |  45 ++
 ...compiler-rt-sanitizer-supported-arch.patch |  22 +
 srcpkgs/llvm16/patches/libcxx-armv67.patch    |  22 +
 .../llvm16/patches/libcxx-ssp-nonshared.patch |  11 +
 srcpkgs/llvm16/patches/libcxxabi-dl.patch     |  25 +
 srcpkgs/llvm16/patches/libcxxabi-musl.patch   |  37 ++
 srcpkgs/llvm16/patches/libomp-soname.patch    |  12 +
 srcpkgs/llvm16/patches/llvm-001-musl.patch    |  44 ++
 .../patches/llvm-004-override-opt.patch       |  18 +
 .../llvm16/patches/llvm-005-ppc-bigpic.patch  |  36 ++
 .../llvm16/patches/revert-optimisation.patch  |  85 ++++
 srcpkgs/llvm16/template                       | 455 ++++++++++++++++++
 srcpkgs/llvm16/update                         |   3 +
 38 files changed, 1105 insertions(+), 21 deletions(-)
 create mode 120000 srcpkgs/libllvm16
 create mode 100644 srcpkgs/llvm16/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
 create mode 100644 srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
 create mode 100644 srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
 create mode 100644 srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-armv67.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-dl.patch
 create mode 100644 srcpkgs/llvm16/patches/libcxxabi-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/libomp-soname.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
 create mode 100644 srcpkgs/llvm16/patches/revert-optimisation.patch
 create mode 100644 srcpkgs/llvm16/template
 create mode 100644 srcpkgs/llvm16/update

diff --git a/common/shlibs b/common/shlibs
index 8c47e79b8c43..63eb4e72bad6 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -990,15 +990,16 @@ 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.15 lldb-15.0.7_1
-libclang.so.15 libclang-15.0.7_1
-libclang-cpp.so.15 libclang-cpp-15.0.7_1
+liblldb.so.16 lldb-16.0.3_1
+libclang.so.16 libclang-16.0.3_1
+libclang-cpp.so.16 libclang-cpp-16.0.3_1
 libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
+libLLVM-16.so libllvm16-16.0.3_1
 libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
 libomp.so.5 libomp-15.0.7_1
-libomptarget.so.15 libomp-15.0.7_1
+libomptarget.so.16 libomp-16.0.3_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 b/srcpkgs/clang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang
+++ b/srcpkgs/clang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-analyzer
+++ b/srcpkgs/clang-analyzer
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/clang-tools-extra
+++ b/srcpkgs/clang-tools-extra
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang b/srcpkgs/libclang
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang
+++ b/srcpkgs/libclang
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libclang-cpp b/srcpkgs/libclang-cpp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libclang-cpp
+++ b/srcpkgs/libclang-cpp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx b/srcpkgs/libcxx
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx
+++ b/srcpkgs/libcxx
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxx-devel b/srcpkgs/libcxx-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxx-devel
+++ b/srcpkgs/libcxx-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi b/srcpkgs/libcxxabi
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi
+++ b/srcpkgs/libcxxabi
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libcxxabi-devel b/srcpkgs/libcxxabi-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libcxxabi-devel
+++ b/srcpkgs/libcxxabi-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libllvm16 b/srcpkgs/libllvm16
new file mode 120000
index 000000000000..9910d5b12f6f
--- /dev/null
+++ b/srcpkgs/libllvm16
@@ -0,0 +1 @@
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp b/srcpkgs/libomp
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp
+++ b/srcpkgs/libomp
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/libomp-devel b/srcpkgs/libomp-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/libomp-devel
+++ b/srcpkgs/libomp-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld
+++ b/srcpkgs/lld
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lld-devel
+++ b/srcpkgs/lld-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb
+++ b/srcpkgs/lldb
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/lldb-devel
+++ b/srcpkgs/lldb-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind b/srcpkgs/llvm-libunwind
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind
+++ b/srcpkgs/llvm-libunwind
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm-libunwind-devel b/srcpkgs/llvm-libunwind-devel
index ad57a969b9f9..9910d5b12f6f 120000
--- a/srcpkgs/llvm-libunwind-devel
+++ b/srcpkgs/llvm-libunwind-devel
@@ -1 +1 @@
-llvm15
\ No newline at end of file
+llvm16
\ No newline at end of file
diff --git a/srcpkgs/llvm16/files/llvm-Config-llvm-config.h b/srcpkgs/llvm16/files/llvm-Config-llvm-config.h
new file mode 100644
index 000000000000..2fa08c9be696
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
new file mode 100644
index 000000000000..e2cb672a2903
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0001-llvm-always-set-a-larger-stack-size-explicitly.patch
@@ -0,0 +1,33 @@
+From 2f64910d7f5c0ee3bbdf7977099690fc58719fc1 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 15:57:16 +0200
+Subject: [PATCH 01/27] llvm: always set a larger stack size explicitly
+
+---
+ llvm/lib/Support/Threading.cpp | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
+index 923935bbc..b91b8f4bb 100644
+--- a/llvm/lib/Support/Threading.cpp
++++ b/llvm/lib/Support/Threading.cpp
+@@ -77,16 +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;
+-#else
+-const std::optional<unsigned> llvm::thread::DefaultStackSize;
+-#endif
+-
+ 
+ #endif
+ 
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
new file mode 100644
index 000000000000..66757a319534
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0004-llvm-fix-some-MF_EXEC-related-test-failures-on-aarch.patch
@@ -0,0 +1,26 @@
+From fc7ba47ece14209c58ad9e5ddb145203039d9da5 Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:04:20 +0200
+Subject: [PATCH 04/27] llvm: fix some MF_EXEC related test failures on aarch64
+
+https://bugs.llvm.org/show_bug.cgi?id=14278#c10
+---
+ llvm/lib/Support/Unix/Memory.inc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
+index 4c8f6b2ea..6cddae13b 100644
+--- a/llvm/lib/Support/Unix/Memory.inc
++++ b/llvm/lib/Support/Unix/Memory.inc
+@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
+       llvm::sys::Memory::MF_EXEC:
+     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
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
new file mode 100644
index 000000000000..8ff08c613ea0
--- /dev/null
+++ b/srcpkgs/llvm16/patches/0016-libc-musl-locale-workarounds.patch
@@ -0,0 +1,40 @@
+From 8105e17c547c80fc9940a46a0f2ae385d48b9ebb Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Tue, 2 May 2023 16:17:41 +0200
+Subject: [PATCH 16/27] libc++: musl locale workarounds
+
+---
+ libcxx/include/locale | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libcxx/include/locale b/libcxx/include/locale
+index 874866f69..befed29bf 100644
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -758,7 +758,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;
+@@ -798,7 +802,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;
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm16/patches/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 000000000000..e4eaa7783e7a
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/clang-002-add-musl-triples.patch b/srcpkgs/llvm16/patches/clang-002-add-musl-triples.patch
new file mode 100644
index 000000000000..0ef4c7e75d6b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/cmake-runtimes-cmake-flags.patch b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
new file mode 100644
index 000000000000..dae632808fda
--- /dev/null
+++ b/srcpkgs/llvm16/patches/cmake-runtimes-cmake-flags.patch
@@ -0,0 +1,45 @@
+--- a/llvm/runtimes/CMakeLists.txt
++++ b/llvm/runtimes/CMakeLists.txt
+@@ -75,7 +75,8 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       ${COMMON_CMAKE_ARGS}
+@@ -109,7 +110,9 @@
+                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
+                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
+@@ -231,7 +234,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DLLVM_BUILD_TOOLS=${LLVM_BUILD_TOOLS}
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+@@ -356,7 +361,9 @@
+                                       -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
+                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
+                                       -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
+-                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
++                                      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
++                                      -DLLVM_ENABLE_SPHINX=ON
++                                      -DLLVM_INCLUDE_DOCS=ON
+                                       -DCMAKE_C_COMPILER_WORKS=ON
+                                       -DCMAKE_CXX_COMPILER_WORKS=ON
+                                       -DCMAKE_ASM_COMPILER_WORKS=ON
diff --git a/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch b/srcpkgs/llvm16/patches/compiler-rt-sanitizer-supported-arch.patch
new file mode 100644
index 000000000000..c9b9286ac37b
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxx-armv67.patch b/srcpkgs/llvm16/patches/libcxx-armv67.patch
new file mode 100644
index 000000000000..1dab312c83e3
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxx-armv67.patch
@@ -0,0 +1,22 @@
+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]':
+
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -155,6 +155,12 @@ if (LIBCXX_GENERATE_COVERAGE AND NOT LIB
+ endif()
+ add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
+ 
++set(VOID_GCC_BUG_109180_WORKAROUND OFF CACHE BOOL "")
++
++if (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/llvm16/patches/libcxx-ssp-nonshared.patch b/srcpkgs/llvm16/patches/libcxx-ssp-nonshared.patch
new file mode 100644
index 000000000000..70292beb2fcd
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/libcxxabi-dl.patch b/srcpkgs/llvm16/patches/libcxxabi-dl.patch
new file mode 100644
index 000000000000..3a15f9db8c98
--- /dev/null
+++ b/srcpkgs/llvm16/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 @@
+     target_link_libraries(${target} PRIVATE m)
+   endif()
+ 
++  if (LIBCXX_HAS_C_LIB)
++    target_link_libraries(${target} PRIVATE dl)
++  endif()
++
+   if (LIBCXX_HAS_RT_LIB)
+     target_link_libraries(${target} PRIVATE rt)
+   endif()
diff --git a/srcpkgs/llvm16/patches/libcxxabi-musl.patch b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
new file mode 100644
index 000000000000..5072fe85c4d4
--- /dev/null
+++ b/srcpkgs/llvm16/patches/libcxxabi-musl.patch
@@ -0,0 +1,37 @@
+gcc does not support using abi_tag in an extern "C" declaration:
+https://github.com/gcc-mirror/gcc/blob/cf59c8983ef6590f0d69014f8dc8778b5b7691c6/gcc/cp/tree.cc#L5354-L5359
+
+diff --git a/libcxx/include/__support/musl/xlocale.h b/libcxx/include/__support/musl/xlocale.h
+index e674a41fa..f546119b9 100644
+--- a/libcxx/include/__support/musl/xlocale.h
++++ b/libcxx/include/__support/musl/xlocale.h
+@@ -24,24 +24,24 @@
+ extern "C" {
+ #endif
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
++static inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
+ strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
+   return ::strtoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoll(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
+   return ::wcstoull(__nptr, __endptr, __base);
+ }
+ 
+-inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
++static inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
+   return ::wcstold(__nptr, __endptr);
+ }
+ 
diff --git a/srcpkgs/llvm16/patches/libomp-soname.patch b/srcpkgs/llvm16/patches/libomp-soname.patch
new file mode 100644
index 000000000000..9a622cd9254c
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-001-musl.patch b/srcpkgs/llvm16/patches/llvm-001-musl.patch
new file mode 100644
index 000000000000..b6efd02a5698
--- /dev/null
+++ b/srcpkgs/llvm16/patches/llvm-001-musl.patch
@@ -0,0 +1,44 @@
+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/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/third-party/unittest/googletest/src/gtest.cc
++++ b/third-party/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+ 
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h>  // NOLINT
++# include <sys/socket.h>  // NOLINT
+ # include <netdb.h>  // NOLINT
+ # include <sys/socket.h>  // NOLINT
+ # include <sys/types.h>  // NOLINT
diff --git a/srcpkgs/llvm16/patches/llvm-004-override-opt.patch b/srcpkgs/llvm16/patches/llvm-004-override-opt.patch
new file mode 100644
index 000000000000..51d0e4b31b32
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm16/patches/llvm-005-ppc-bigpic.patch
new file mode 100644
index 000000000000..d332687b9d92
--- /dev/null
+++ b/srcpkgs/llvm16/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/llvm16/patches/revert-optimisation.patch b/srcpkgs/llvm16/patches/revert-optimisation.patch
new file mode 100644
index 000000000000..7db7eed22291
--- /dev/null
+++ b/srcpkgs/llvm16/patches/revert-optimisation.patch
@@ -0,0 +1,85 @@
+Patch-Source: https://gist.github.com/q66/1d48bbbec3a9319af587628a67b5e477
+--
+From 0731e96271e4c899f4f9c06d67cb605ee50d4e9b Mon Sep 17 00:00:00 2001
+From: Daniel Kolesa <daniel@octaforge.org>
+Date: Wed, 3 May 2023 01:36:56 +0200
+Subject: [PATCH] llvm: HACK: pessimize alias analysis to fix firefox
+
+This is probably not good, but it's what allows us to get
+firefox fixed for the time being, so...
+
+Ref: https://github.com/llvm/llvm-project/issues/58776
+---
+ llvm/lib/Analysis/BasicAliasAnalysis.cpp      |  2 ++
+ .../lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp | 36 +++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+index dc728c1cb..e0f5789c6 100644
+--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
++++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+@@ -698,6 +698,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+     if (IgnoreLocals && isa<AllocaInst>(V))
+       continue;
+ 
++#if 0
+     // If the location points to memory that is known to be invariant for
+     // the life of the underlying SSA value, then we can exclude Mod from
+     // the set of valid memory effects.
+@@ -710,6 +711,7 @@ ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+         continue;
+       }
+     }
++#endif
+ 
+     // A global constant can't be mutated.
+     if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
+diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+index 8155c895e..6e3558e16 100644
+--- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
++++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
+@@ -138,5 +138,41 @@ ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+       AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
+     return ModRefInfo::NoModRef;
+ 
++  if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
++    if (GV->isConstant())
++      return ModRefInfo::NoModRef;
++  } else if (const Argument *Arg = dyn_cast<Argument>(Base)) {
++    const Function *F = Arg->getParent();
++
++    // Only assume constant memory for arguments on kernels.
++    switch (F->getCallingConv()) {
++    default:
++      return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
++    case CallingConv::AMDGPU_LS:
++    case CallingConv::AMDGPU_HS:
++    case CallingConv::AMDGPU_ES:
++    case CallingConv::AMDGPU_GS:
++    case CallingConv::AMDGPU_VS:
++    case CallingConv::AMDGPU_PS:
++    case CallingConv::AMDGPU_CS:
++    case CallingConv::AMDGPU_KERNEL:
++    case CallingConv::SPIR_KERNEL:
++      break;
++    }
++
++    unsigned ArgNo = Arg->getArgNo();
++    /* On an argument, ReadOnly attribute indicates that the function does
++       not write through this pointer argument, even though it may write
++       to the memory that the pointer points to.
++       On an argument, ReadNone attribute indicates that the function does
++       not dereference that pointer argument, even though it may read or write
++       the memory that the pointer points to if accessed through other pointers.
++     */
++    if (F->hasParamAttribute(ArgNo, Attribute::NoAlias) &&
++        (F->hasParamAttribute(ArgNo, Attribute::ReadNone) ||
++         F->hasParamAttribute(ArgNo, Attribute::ReadOnly))) {
++      return ModRefInfo::NoModRef;
++    }
++  }
+   return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals);
+ }
+-- 
+2.39.0
+
diff --git a/srcpkgs/llvm16/template b/srcpkgs/llvm16/template
new file mode 100644
index 000000000000..e1f9280b690b
--- /dev/null
+++ b/srcpkgs/llvm16/template
@@ -0,0 +1,455 @@
+# Template file for 'llvm16'
+pkgname=llvm16
+version=16.0.3
+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
+ -DLIBCXX_INCLUDE_DOCS=YES
+ -DLIBCXXABI_USE_LLVM_UNWINDER=YES
+ -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
+ -DLIBOMP_ENABLE_SHARED=YES
+ -DLIBOMP_INSTALL_ALIASES=NO
+ -DLIBUNWIND_INCLUDE_DOCS=YES
+ -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
+ -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"
+makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm16>=${version}_${revision}"
+short_desc="Low Level Virtual Machine"
+maintainer="Orphaned <orphan@voidlinux.org>"
+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=3b12e35332e10cf650578ae18247b91b04926d5427e1a6ae9a51d170a47cfbb2
+lib32disabled=yes
+python_version=3
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
+	 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
+fi
+
+# "operand out of range" assembler failures
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
+esac
+
+_enabled_projects="clang;clang-tools-extra;lld"
+_enabled_runtimes="compiler-rt;libcxx;libcxxabi;libunwind"
+
+_lldb_enable=yes
+_libomp_enable=no
+
+case "$XBPS_TARGET_MACHINE" in
+	ppc64le*) ;;
+	ppc*|i686*|riscv64*) _lldb_enable=no ;;
+esac
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
+esac
+
+subpackages="clang-tools-extra"
+
+# must go before clang
+if [ "$_libomp_enable" = "yes" ]; then
+	_enabled_projects+=";openmp"
+	subpackages+=" libomp libomp-devel"
+	# because of cmake nonsense referencing libomptarget.so.*
+	depends+=" libomp>=${version}_${revision}"
+	if [ "$CROSS_BUILD" ]; then
+		# Seems to require a full host llvm/clang build
+		configure_args+=" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF"
+		configure_args+=" -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=OFF"
+	fi
+fi
+
+subpackages+=" clang clang-analyzer libclang libclang-cpp
+ llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
+ libcxxabi libcxxabi-devel libllvm16"
+
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	_enabled_projects+=";lldb"
+	subpackages+=" lldb lldb-devel"
+fi
+
+subpackages+=" lld lld-devel"
+
+configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}
+ -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
+
+post_patch() {
+	if [ "$_lldb_enable" = "yes" ]; 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+=" -DVOID_GCC_BUG_109180_WORKAROUND=ON" ;;
+	esac
+
+	if [ "$CROSS_BUILD" ]; then
+		msg_normal "Building host tblgen\n"
+		mkdir -p build/HOST
+		cd build/HOST
+		CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
+			CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
+			cmake ../.. -DCMAKE_BUILD_TYPE=Release \
+			-DLLVM_ENABLE_PROJECTS=${_enabled_projects} \
+			-DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}
+		make ${makejobs} -C utils/TableGen
+		make ${makejobs} -C tools/clang/utils/TableGen
+		make ${makejobs} -C tools/clang/tools/extra/clang-tidy/misc/ConfusableTable
+		make ${makejobs} -C tools/clang/tools/extra/pseudo/gen
+		[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
+		configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/llvm-tblgen"
+		configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/clang-tblgen"
+		configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=${wrksrc}/llvm/build/HOST/bin/clang-tidy-confusable-chars-gen"
+		configure_args+=" -DCLANG_PSEUDO_GEN=${wrksrc}/llvm/build/HOST/bin/clang-pseudo-gen"
+		[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/llvm/build/HOST/bin/lldb-tblgen"
+		cd ../..
+	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}"
+}
+
+do_install() {
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
+
+	# 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
+
+	# 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
+}
+
+clang-analyzer_package() {
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python3 perl"
+	short_desc+=" - A source code analysis framework"
+	homepage="https://clang-analyzer.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/scan-*"
+		vmove "usr/libexec/*analyzer"
+		vmove "usr/share/scan-*"
+		vmove usr/share/man/man1/scan-build.1
+	}
+}
+
+clang-tools-extra_package() {
+	lib32disabled=yes
+	depends="clang-${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-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/hmaptool
+		vmove usr/bin/modularize
+		vmove usr/bin/pp-trace
+		vmove usr/include/clang-tidy
+		vmove "usr/lib/libclangApplyReplacements*"
+		vmove "usr/lib/libclangChangeNamespace*"
+		vmove "usr/lib/libclangDaemon*"
+		vmove "usr/lib/libclangDoc*"
+		vmove "usr/lib/libclangIncludeCleaner*"
+		vmove "usr/lib/libclangIncludeFixer*"
+		vmove "usr/lib/libclangMove*"
+		vmove "usr/lib/libclangPseudo*"
+		vmove "usr/lib/libclangReorderFields*"
+		vmove "usr/lib/libclangQuery*"
+		vmove "usr/lib/libclangTidy*"
+		vmove "usr/lib/libclangd*"
+		vmove "usr/lib/libfindAllSymbols*"
+		vmove "usr/share/clang/*find-all-symbols*"
+		vmove "usr/share/clang/*include-fixer*"
+		vmove "usr/share/clang/*tidy*"
+		vmove usr/share/doc/LLVM/clang-tools
+		vmove usr/share/man/man1/extraclangtools.1
+	}
+}
+
+clang_package() {
+	lib32disabled=yes
+	depends="libstdc++-devel libgcc-devel  binutils ${XBPS_TARGET_LIBC}-devel
+	 libclang-${version}_${revision}"
+	short_desc+=" - C language family frontend"
+	homepage="https://clang.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*clang*"
+		vmove usr/bin/c-index-test
+		vmove usr/bin/diagtool
+		vmove usr/include/clang
+		vmove usr/include/clang-c
+		vmove usr/lib/clang
+		vmove usr/lib/cmake/clang
+		vmove "usr/lib/libclang*.a"
+		vmove "usr/lib/libclang*.so"
+		vmove usr/share/clang
+		vmove usr/share/doc/LLVM/clang
+		vmove usr/share/man/man1/clang.1
+		vmove usr/share/man/man1/diagtool.1
+	}
+}
+
+libclang_package() {
+	short_desc+=" - C frontend runtime library"
+	pkg_install() {
+		vmove "usr/lib/libclang.so.*"
+	}
+}
+
+libclang-cpp_package() {
+	short_desc+=" - C frontend runtime library (C++ interface)"
+	pkg_install() {
+		vmove "usr/lib/libclang-cpp.so.*"
+	}
+}
+
+lld_package() {
+	lib32disabled=yes
+	short_desc+=" - linker"
+	homepage="https://lld.llvm.org"
+	pkg_install() {
+		vmove "usr/bin/ld.lld*"
+		vmove "usr/bin/ld64.lld*"
+		vmove "usr/bin/lld*"
+		vmove usr/bin/wasm-ld
+		vmove usr/share/doc/LLVM/lld
+	}
+}
+
+lld-devel_package() {
+	lib32disabled=yes
+	short_desc+=" - linker - development files"
+	homepage="https://lld.llvm.org"
+	depends="lld>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/include/lld
+		vmove usr/lib/cmake/lld
+		vmove "usr/lib/liblld*a"
+	}
+}
+
+lldb_package() {
+	lib32disabled=yes
+	depends+=" python3-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove "usr/bin/*lldb*"
+		vmove "usr/lib/liblldb*so.*"
+		vmove usr/lib/python*
+	}
+}
+
+lldb-devel_package() {
+	lib32disabled=yes
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libunwind
+	}
+}
+
+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"
+		# vmove usr/share/doc/LLVM/libcxx
+	}
+}
+
+libomp_package() {
+	short_desc+=" - Clang OpenMP support library"
+	pkg_install() {
+		vmove usr/lib/libarcher.so
+		vmove usr/lib/libompd.so
+		vmove "usr/lib/libomptarget.rtl.*.so"
+		vmove "usr/lib/libomp*.so.*"
+	}
+}
+
+libomp-devel_package() {
+	short_desc+=" - Clang OpenMP support library - development files"
+	depends="libomp>=${version}_${revision}"
+	pkg_install() {
+		vmove "usr/lib/clang/${version%%.*}/include/omp*.h"
+		vmove "usr/lib/libarcher*"
+		vmove "usr/lib/libomp*.so"
+		vmove usr/lib/cmake/openmp
+		# vmove usr/share/doc/LLVM/openmp
+		vmove usr/share/man/man1/llvmopenmp.1
+	}
+}
+
+libllvm16_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm16/update b/srcpkgs/llvm16/update
new file mode 100644
index 000000000000..e95cf26b3586
--- /dev/null
+++ b/srcpkgs/llvm16/update
@@ -0,0 +1,3 @@
+site="https://github.com/llvm/llvm-project/releases"
+pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
+ignore="*-rc*"

From a7c03372fb5deb6a267364384cff41e58440ef0a Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 02/32] CastXML: rebuild for llvm16-16.0.3_1

---
 srcpkgs/CastXML/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/CastXML/template b/srcpkgs/CastXML/template
index de0920900ae4..323f61224ba9 100644
--- a/srcpkgs/CastXML/template
+++ b/srcpkgs/CastXML/template
@@ -1,7 +1,7 @@
 # Template file for 'CastXML'
 pkgname=CastXML
 version=0.5.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DSPHINX_MAN=YES -DCastXML_INSTALL_MAN_DIR=share/man"
 hostmakedepends="clang python3-Sphinx"

From 6f3c5bc3c4739be1a5291d0e2e8d4f66a26a3d0e Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:51 +0200
Subject: [PATCH 03/32] bcc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/bcc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 1b690066612f..970178656ddd 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.27.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version} -DENABLE_LLVM_SHARED=1"
 hostmakedepends="flex python3-setuptools"

From a3b09c89b50dd84a93d99b641c36159b2e6beb87 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 04/32] bpftrace: rebuild for llvm16-16.0.3_1

---
 ...22cb14e2eedc5df17e53965824d7381f8e6f.patch | 41 +++++++++++++++++++
 ...7872b0c6600b69c5766ef7bdf736dd73ce9c.patch | 23 +++++++++++
 srcpkgs/bpftrace/template                     |  2 +-
 3 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
 create mode 100644 srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch

diff --git a/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch b/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
new file mode 100644
index 000000000000..2173cc81376a
--- /dev/null
+++ b/srcpkgs/bpftrace/patches/70ee22cb14e2eedc5df17e53965824d7381f8e6f.patch
@@ -0,0 +1,41 @@
+From 70ee22cb14e2eedc5df17e53965824d7381f8e6f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 13 Mar 2023 21:30:27 -0700
+Subject: [PATCH] ast: Use std::optional in CodegenLLVM::CodegenLLVM call
+
+Fixes build with clang-16
+
+src/ast/passes/codegen_llvm.cpp:63:53: error: use of undeclared identifier 'Optional'; did you mean 'std::optional'?
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/ast/passes/codegen_llvm.cpp | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
+index 616ff89ddbc..fe440adf373 100644
+--- a/src/ast/passes/codegen_llvm.cpp
++++ b/src/ast/passes/codegen_llvm.cpp
+@@ -56,11 +56,17 @@ CodegenLLVM::CodegenLLVM(Node *root, BPFtrace &bpftrace)
+     throw std::runtime_error(
+         "Could not find bpf llvm target, does your llvm support it?");
+ 
+-  target_machine_.reset(target->createTargetMachine(LLVMTargetTriple,
+-                                                    "generic",
+-                                                    "",
+-                                                    TargetOptions(),
+-                                                    Optional<Reloc::Model>()));
++  target_machine_.reset(
++      target->createTargetMachine(LLVMTargetTriple,
++                                  "generic",
++                                  "",
++                                  TargetOptions(),
++#if LLVM_VERSION_MAJOR >= 16
++                                  std::optional<Reloc::Model>()
++#else
++                                  Optional<Reloc::Model>()
++#endif
++                                      ));
+   target_machine_->setOptLevel(llvm::CodeGenOpt::Aggressive);
+ 
+   module_->setTargetTriple(LLVMTargetTriple);
diff --git a/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch b/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch
new file mode 100644
index 000000000000..b95a1c8df984
--- /dev/null
+++ b/srcpkgs/bpftrace/patches/7eea7872b0c6600b69c5766ef7bdf736dd73ce9c.patch
@@ -0,0 +1,23 @@
+From 7eea7872b0c6600b69c5766ef7bdf736dd73ce9c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 10 Mar 2023 00:08:27 -0800
+Subject: [PATCH] cmake: Raise max llvm major version to 16
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index db5618e4efb..5cc489afe44 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -173,7 +173,7 @@ else()
+   endif()
+ 
+   set(MIN_LLVM_MAJOR 6)
+-  set(MAX_LLVM_MAJOR 15)
++  set(MAX_LLVM_MAJOR 16)
+ 
+   if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
+     message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}")
diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index ad1bd0f50e73..549e8ad670a1 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.17.1
-revision=1
+revision=2
 archs="x86_64* aarch64* ppc64*"
 build_style=cmake
 configure_args="-DUSE_SYSTEM_BPF_BCC=ON -DBUILD_TESTING=OFF" # needs root to run

From dbd6787331de175d0c850742fed4b0dde64fdf22 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 05/32] ccls: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ccls/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ccls/template b/srcpkgs/ccls/template
index ecc9f3e38a5d..ff74d135a1c4 100644
--- a/srcpkgs/ccls/template
+++ b/srcpkgs/ccls/template
@@ -1,7 +1,7 @@
 # Template file for 'ccls'
 pkgname=ccls
 version=0.20220729
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="clang-tools-extra"
 makedepends="clang-tools-extra libxml2-devel llvm ncurses-devel rapidjson zlib-devel"

From 5b33e04e97d93a11dbff0bb9dc60c6a8c8ab0998 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 06/32] clazy: rebuild for llvm16-16.0.3_1

---
 srcpkgs/clazy/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index f81de08ab836..bdec40488d6a 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.11
-revision=2
+revision=3
 build_style=cmake
 build_helper=qemu
 hostmakedepends="llvm"

From 7f67ac60301d4af042824e15d877f4a69f9b5016 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 07/32] include-what-you-use: rebuild for llvm16-16.0.3_1

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 1a30bc04bb2d..b9190c260eda 100644
--- a/srcpkgs/include-what-you-use/template
+++ b/srcpkgs/include-what-you-use/template
@@ -1,7 +1,7 @@
 # Template file for 'include-what-you-use'
 pkgname=include-what-you-use
 version=0.19
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "
 hostmakedepends="python3"

From b0b978b17482ac3cf729e20f92fa590628ccbab1 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 08/32] ispc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ispc/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/ispc/template b/srcpkgs/ispc/template
index fbfa4f6db420..44489dee9a2e 100644
--- a/srcpkgs/ispc/template
+++ b/srcpkgs/ispc/template
@@ -1,7 +1,7 @@
 # Template file for 'ispc'
 pkgname=ispc
 version=1.19.0
-revision=2
+revision=3
 archs="aarch64* x86_64*"
 build_style=cmake
 configure_args="-DISPC_INCLUDE_EXAMPLES=OFF -DISPC_INCLUDE_RT=OFF"

From d2135812bee3f8b1779a78d1dbea0f056f99b8cb Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:52 +0200
Subject: [PATCH 09/32] ldc: rebuild for llvm16-16.0.3_1

---
 srcpkgs/ldc/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index f6d8b7ffbe98..90953ae27fcc 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,7 +1,7 @@
 # Template file for 'ldc'
 pkgname=ldc
 version=1.31.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="
  -DINCLUDE_INSTALL_DIR=/usr/include/dlang/ldc
@@ -11,7 +11,7 @@ configure_args="
  -DCOMPILE_D_MODULES_SEPARATELY=ON
  -DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm15 perl pkg-config"
+hostmakedepends="dmd llvm16 perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
  llvm-libunwind-devel"
 depends="ldc-runtime llvm-libunwind-devel"

From 8608833e032871d5d91abed64d6878fe64b16f35 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 10/32] qt6-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt6-tools/patches/llvm16.patch | 52 ++++++++++++++++++++++++++
 srcpkgs/qt6-tools/template             |  2 +-
 2 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt6-tools/patches/llvm16.patch

diff --git a/srcpkgs/qt6-tools/patches/llvm16.patch b/srcpkgs/qt6-tools/patches/llvm16.patch
new file mode 100644
index 000000000000..e9b4b515c544
--- /dev/null
+++ b/srcpkgs/qt6-tools/patches/llvm16.patch
@@ -0,0 +1,52 @@
+From 87fac2de7378963e753a847da667d52d4ba95bff Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= <bjoern@hazardy.de>
+Date: Wed, 8 Feb 2023 12:31:04 +0100
+Subject: [PATCH] lupdate: Fix build with clang 16+
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The signature changed again.
+
+I've tested it with a current main, that is clang 17, but the commit
+854c10f8d185286d941307e1033eb492e085c203 with introduced the change is
+also contained in clang 16.
+
+Pick-to: 6.4 6.5
+Change-Id: I050ca5843708be4489757538849000d3675005ac
+Reviewed-by: Kai Köhne <kai.koehne@qt.io>
+---
+ src/linguist/lupdate/lupdatepreprocessoraction.cpp | 4 +++-
+ src/linguist/lupdate/lupdatepreprocessoraction.h   | 4 +++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/linguist/lupdate/lupdatepreprocessoraction.cpp b/src/linguist/lupdate/lupdatepreprocessoraction.cpp
+index d963747d8..478d5fbea 100644
+--- a/src/linguist/lupdate/lupdatepreprocessoraction.cpp
++++ b/src/linguist/lupdate/lupdatepreprocessoraction.cpp
+@@ -157,7 +157,9 @@ void LupdatePPCallbacks::SourceRangeSkipped(clang::SourceRange sourceRange,
+ void LupdatePPCallbacks::InclusionDirective(clang::SourceLocation /*hashLoc*/,
+     const clang::Token & /*includeTok*/, clang::StringRef /*fileName*/, bool /*isAngled*/,
+     clang::CharSourceRange /*filenameRange*/,
+-#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
++#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(16,0,0))
++    const clang::OptionalFileEntryRef file,
++#elif (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
+     const clang::Optional<clang::FileEntryRef> file,
+ #else
+     const clang::FileEntry *file,
+diff --git a/src/linguist/lupdate/lupdatepreprocessoraction.h b/src/linguist/lupdate/lupdatepreprocessoraction.h
+index 3e44cee83..673ecb495 100644
+--- a/src/linguist/lupdate/lupdatepreprocessoraction.h
++++ b/src/linguist/lupdate/lupdatepreprocessoraction.h
+@@ -52,7 +52,9 @@ class LupdatePPCallbacks : public clang::PPCallbacks
+     void InclusionDirective(clang::SourceLocation /*hashLoc*/, const clang::Token &/*includeTok*/,
+                             clang::StringRef /*fileName*/, bool /*isAngled*/,
+                             clang::CharSourceRange /*filenameRange*/,
+-#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
++#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(16,0,0))
++                            const clang::OptionalFileEntryRef file,
++#elif (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
+                             const clang::Optional<clang::FileEntryRef> file,
+ #else
+                             const clang::FileEntry *file,
diff --git a/srcpkgs/qt6-tools/template b/srcpkgs/qt6-tools/template
index d5ad1618e3a7..c49c69f73901 100644
--- a/srcpkgs/qt6-tools/template
+++ b/srcpkgs/qt6-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'qt6-tools'
 pkgname=qt6-tools
 version=6.4.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DEXTERNAL_GUMBO=ON -DLITEHTML_UTF8=ON -DUSE_ICU=ON
  -DQT_BUILD_SHARED_LIBS=ON -DQT_FEATURE_assistant=ON

From 542bc8477fd7992e42606b39140153f1f05ac59a Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 11/32] qtcreator: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qtcreator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index b1dffd304198..046ca9cba57c 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=9.0.1
-revision=2
+revision=3
 build_style=cmake
 configure_args="$(vopt_bool qbs BUILD_QBS) -DWITH_DOCS=ON -DBUILD_WITH_PCH=OFF
  -DQT_HOST_PATH=/usr/ -DQT_HOST_PATH_CMAKE_DIR=/usr/lib64/cmake/Qt6"

From 4d33a8c6c17c435842f919bec9b438f47e1a2f20 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:23:53 +0200
Subject: [PATCH 12/32] rust: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rust/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template
index 88e35a5a43ad..53de9ac72231 100644
--- a/srcpkgs/rust/template
+++ b/srcpkgs/rust/template
@@ -9,9 +9,9 @@
 #
 pkgname=rust
 version=1.69.0
-revision=1
+revision=2
 hostmakedepends="cmake curl pkg-config python3 tar cargo-bootstrap"
-makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm15"
+makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm16"
 depends="rust-std"
 short_desc="Safe, concurrent, practical systems language"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -33,7 +33,7 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 fi
 
 if [ "$CROSS_BUILD" ]; then
-	hostmakedepends+=" rust llvm15"
+	hostmakedepends+=" rust llvm16"
 	# These are required for building the buildhost's stage0/1
 	hostmakedepends+=" libffi-devel libxml2-devel ncurses-devel zlib-devel"
 else

From d1a1d19a0972ad5873559be0accfb78b3d368290 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 13:28:52 +0200
Subject: [PATCH 13/32] llvm: update to 16.

---
 srcpkgs/llvm/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index fc1c850bd26f..5a88372fb672 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=15
+version=16
 revision=1
 build_style=meta
-depends="llvm15"
+depends="llvm16"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From e3818936c09335782e4feef4badc40b4cd602cd5 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:16 +0200
Subject: [PATCH 14/32] SPIRV-Headers: update to 1.3.243.0.

---
 srcpkgs/SPIRV-Headers/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/SPIRV-Headers/template b/srcpkgs/SPIRV-Headers/template
index 8bb7d5f8b1ae..e3bca40c95be 100644
--- a/srcpkgs/SPIRV-Headers/template
+++ b/srcpkgs/SPIRV-Headers/template
@@ -1,7 +1,7 @@
 # Template file for 'SPIRV-Headers'
 pkgname=SPIRV-Headers
 reverts="1.5.4.raytracing.fixed_1 1.5.3_2 1.5.3_1 1.5.1_1 1.4.1_1"
-version=1.3.231.1
+version=1.3.243.0
 revision=1
 build_style=cmake
 short_desc="Machine-readable files for the SPIR-V Registry"
@@ -9,7 +9,7 @@ maintainer="tibequadorian <tibequadorian@posteo.de>"
 license="MIT"
 homepage="https://github.com/KhronosGroup/SPIRV-Headers"
 distfiles="https://github.com/KhronosGroup/SPIRV-Headers/archive/sdk-${version}.tar.gz"
-checksum=fc340700b005e9a2adc98475b5afbbabd1bc931f789a2afd02d54ebc22522af3
+checksum=16927b1868e7891377d059cd549484e4158912439cf77451ae7e01e2a3bcd28b
 
 post_install() {
 	vlicense LICENSE

From 075c3a160cc8dfad05ba2ed479c0e0e585020bd0 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:28 +0200
Subject: [PATCH 15/32] SPIRV-Tools: update to 2023.2.

---
 srcpkgs/SPIRV-Tools/template | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/SPIRV-Tools/template b/srcpkgs/SPIRV-Tools/template
index 6a280baa0c28..b9b2ddbc2328 100644
--- a/srcpkgs/SPIRV-Tools/template
+++ b/srcpkgs/SPIRV-Tools/template
@@ -1,9 +1,11 @@
 # Template file for 'SPIRV-Tools'
 pkgname=SPIRV-Tools
-version=2022.4
+version=2023.2
 revision=1
 build_style=cmake
-configure_args="-DSPIRV_SKIP_TESTS=ON -DSPIRV_WERROR=OFF
+configure_args="
+ -DSPIRV_SKIP_TESTS=ON
+ -DSPIRV_WERROR=OFF
  -DSPIRV-Headers_SOURCE_DIR=${XBPS_CROSS_BASE}/usr"
 hostmakedepends="python3"
 makedepends="SPIRV-Headers"
@@ -13,8 +15,7 @@ license="Apache-2.0"
 homepage="https://github.com/KhronosGroup/SPIRV-Tools"
 changelog="https://raw.githubusercontent.com/KhronosGroup/SPIRV-Tools/master/CHANGES"
 distfiles="https://github.com/KhronosGroup/SPIRV-Tools/archive/v${version}.tar.gz"
-checksum=a156215a2d7c6c5b267933ed691877a9a66f07d75970da33ce9ad627a71389d7
-LDFLAGS="-Wl,--no-undefined"
+checksum=7416cc8a98a10c32bacc36a39930b0c5b2a484963df5d68f388ed7ffee1faad3
 
 SPIRV-Tools-devel_package() {
 	depends="SPIRV-Tools-${version}_${revision}"

From 7df3802d0c4c21f4b9ef14dfb1f3a63e56855748 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 21:14:33 +0200
Subject: [PATCH 16/32] SPIRV-LLVM-Translator: update to 16.0.0.

---
 common/shlibs                                 |  2 +-
 ...anslator-16.0.0-llvm-link-llvm-dylib.patch | 73 +++++++++++++++++++
 srcpkgs/SPIRV-LLVM-Translator/template        | 17 +++--
 3 files changed, 84 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch

diff --git a/common/shlibs b/common/shlibs
index 63eb4e72bad6..64deae182e63 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -997,7 +997,7 @@ libLLVM-11.so libllvm11-11.0.0_1
 libLLVM-12.so libllvm12-12.0.0_1
 libLLVM-15.so libllvm15-15.0.7_1
 libLLVM-16.so libllvm16-16.0.3_1
-libLLVMSPIRVLib.so.15 SPIRV-LLVM-Translator-15.0.0_1
+libLLVMSPIRVLib.so.16 SPIRV-LLVM-Translator-16.0.0_1
 libomp.so.5 libomp-15.0.7_1
 libomptarget.so.16 libomp-16.0.3_1
 libisofs.so.6 libisofs-0.6.24_1
diff --git a/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
new file mode 100644
index 000000000000..5cd90086f1e2
--- /dev/null
+++ b/srcpkgs/SPIRV-LLVM-Translator/patches/spirv-llvm-translator-16.0.0-llvm-link-llvm-dylib.patch
@@ -0,0 +1,73 @@
+From 98fadafeae0204defedd89f015f7fb88f2888b2f Mon Sep 17 00:00:00 2001
+From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
+Date: Fri, 17 Mar 2023 14:27:10 -0300
+Subject: [PATCH] Fix standalone builds with LLVM_LINK_LLVM_DYLIB=ON
+
+Move the LLVM components to LINK_COMPONENTS because the DEPENDS list has
+the same semantics as add_dependencies(). In this
+case it doesn't include the LLVM components when calling the linker.
+---
+ lib/SPIRV/CMakeLists.txt | 47 ++++++++++++----------------------------
+ 1 file changed, 14 insertions(+), 33 deletions(-)
+
+diff --git a/lib/SPIRV/CMakeLists.txt b/lib/SPIRV/CMakeLists.txt
+index bbef00528..2810c6b2c 100644
+--- a/lib/SPIRV/CMakeLists.txt
++++ b/lib/SPIRV/CMakeLists.txt
+@@ -38,42 +38,23 @@ set(SRC_LIST
+   libSPIRV/SPIRVType.cpp
+   libSPIRV/SPIRVValue.cpp
+ )
+-if(LLVM_LINK_LLVM_DYLIB)
+-  add_llvm_library(LLVMSPIRVLib STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
+-    ${SRC_LIST}
+-    DEPENDS
+-      intrinsics_gen
+-      LLVMAnalysis
+-      LLVMBitWriter
+-      LLVMCodeGen
+-      LLVMCore
+-      LLVMDemangle
+-      LLVMIRReader
+-      LLVMLinker
+-      LLVMPasses
+-      LLVMSupport
+-      LLVMTargetParser
+-      LLVMTransformUtils
+-  )
+-else()
+-  add_llvm_library(LLVMSPIRVLib
+-    ${SRC_LIST}
+-    LINK_COMPONENTS
+-      Analysis
+-      BitWriter
+-      CodeGen
+-      Core
+-      Demangle
+-      IRReader
+-      Linker
+-      Passes
+-      Support
+-      TargetParser
+-      TransformUtils
++add_llvm_library(LLVMSPIRVLib
++  ${SRC_LIST}
++  LINK_COMPONENTS
++    Analysis
++    BitWriter
++    CodeGen
++    Core
++    Demangle
++    IRReader
++    Linker
++    Passes
++    Support
++    TargetParser
++    TransformUtils
+   DEPENDS
+     intrinsics_gen
+   )
+-endif()
+ 
+ target_include_directories(LLVMSPIRVLib
+   PRIVATE
diff --git a/srcpkgs/SPIRV-LLVM-Translator/template b/srcpkgs/SPIRV-LLVM-Translator/template
index bee99f9bcbb2..1bdb54aad707 100644
--- a/srcpkgs/SPIRV-LLVM-Translator/template
+++ b/srcpkgs/SPIRV-LLVM-Translator/template
@@ -1,20 +1,23 @@
 # Template file for 'SPIRV-LLVM-Translator'
 pkgname=SPIRV-LLVM-Translator
-version=15.0.0
+version=16.0.0
 revision=1
 build_style=cmake
-make_build_args="llvm-spirv"
-configure_args="-Wno-dev -DLLVM_LINK_LLVM_DYLIB=ON -DCMAKE_SKIP_RPATH=ON
- -DLLVM_SPIRV_INCLUDE_TESTS=OFF -DBUILD_SHARED_LIBS=ON
+# make_build_args="llvm-spirv"
+configure_args="-Wno-dev
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DCMAKE_SKIP_RPATH=ON
+ -DLLVM_SPIRV_INCLUDE_TESTS=OFF
+ -DBUILD_SHARED_LIBS=ON
  -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr"
-hostmakedepends="clang llvm"
-makedepends="clang-tools-extra llvm SPIRV-Headers"
+hostmakedepends="clang llvm16"
+makedepends="clang-tools-extra llvm16 SPIRV-Headers"
 short_desc="API and commands for processing SPIR-V modules"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA"
 homepage="https://github.com/KhronosGroup/SPIRV-LLVM-Translator"
 distfiles="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v${version}.tar.gz"
-checksum=b1bebd77f72988758c00852e78c2ddc545815a612169a0cb377d021e2f846d88
+checksum=305fac5bb8efdad9054f0d27b5b765aca8b3349a500e2ba0c927763e42badc2b
 
 post_install() {
 	vlicense LICENSE.TXT

From 1f00c89d8bc5ef68be5af64256f28ca58e0850c9 Mon Sep 17 00:00:00 2001
From: Arda Demir <ddmirarda@gmail.com>
Date: Thu, 23 Feb 2023 12:31:16 +0300
Subject: [PATCH 17/32] mesa: update to 23.0.3.

---
 ...e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch | 77 -------------------
 srcpkgs/mesa/template                         | 10 +--
 2 files changed, 5 insertions(+), 82 deletions(-)
 delete mode 100644 srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch

diff --git a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch b/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
deleted file mode 100644
index f56327367526..000000000000
--- a/srcpkgs/mesa/patches/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47 Mon Sep 17 00:00:00 2001
-From: Erico Nunes <nunes.erico@gmail.com>
-Date: Sun, 12 Feb 2023 22:33:30 +0100
-Subject: [PATCH] lima: don't use resource_from_handle while creating scanout
-
-resource_from_handle implementations create an additional reference to
-the scanout resource, which caused lima to leak those resources after
-commit ad4d7ca8332488be8a75aff001f00306a9f6402e.
-
-Do as the other drivers do and import the bo directly while creating
-the scanount resource.
-
-Cc: 22.3 mesa-stable
-Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8198
-Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
-Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21330>
----
- src/gallium/drivers/lima/lima_resource.c | 26 ++++++++++++++++++------
- 1 file changed, 20 insertions(+), 6 deletions(-)
-
-diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c
-index 54869ec03d24..0b7691f2b46f 100644
---- a/src/gallium/drivers/lima/lima_resource.c
-+++ b/src/gallium/drivers/lima/lima_resource.c
-@@ -59,7 +59,10 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    struct lima_screen *screen = lima_screen(pscreen);
-    struct renderonly_scanout *scanout;
-    struct winsys_handle handle;
--   struct pipe_resource *pres;
-+
-+   struct lima_resource *res = CALLOC_STRUCT(lima_resource);
-+   if (!res)
-+      return NULL;
- 
-    struct pipe_resource scanout_templat = *templat;
-    scanout_templat.width0 = width;
-@@ -71,20 +74,31 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
-    if (!scanout)
-       return NULL;
- 
-+   res->base = *templat;
-+   res->base.screen = pscreen;
-+   pipe_reference_init(&res->base.reference, 1);
-+   res->levels[0].offset = handle.offset;
-+   res->levels[0].stride = handle.stride;
-+
-    assert(handle.type == WINSYS_HANDLE_TYPE_FD);
--   pres = pscreen->resource_from_handle(pscreen, templat, &handle,
--                                        PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
-+   res->bo = lima_bo_import(screen, &handle);
-+   if (!res->bo) {
-+      FREE(res);
-+      return NULL;
-+   }
-+
-+   res->modifier_constant = true;
- 
-    close(handle.handle);
--   if (!pres) {
-+   if (!res->bo) {
-       renderonly_scanout_destroy(scanout, screen->ro);
-+      FREE(res);
-       return NULL;
-    }
- 
--   struct lima_resource *res = lima_resource(pres);
-    res->scanout = scanout;
- 
--   return pres;
-+   return &res->base;
- }
- 
- static uint32_t
--- 
-GitLab
-
diff --git a/srcpkgs/mesa/template b/srcpkgs/mesa/template
index 132263d3599f..8306d8a534db 100644
--- a/srcpkgs/mesa/template
+++ b/srcpkgs/mesa/template
@@ -1,12 +1,12 @@
 # Template file for 'mesa'
 pkgname=mesa
-version=22.3.5
-revision=2
+version=23.0.3
+revision=1
 build_style=meson
 configure_args="-Dglvnd=true -Dshared-glapi=enabled -Dgbm=enabled -Degl=enabled
  -Dosmesa=true -Dgles1=enabled -Dgles2=enabled -Dglx=dri -Ddri3=enabled
  -Dlmsensors=enabled -Dplatforms=x11$(vopt_if wayland ,wayland)
- -Dllvm=enabled -Db_lto=false -Dcpp_std=gnu++14"
+ -Dllvm=enabled -Db_lto=false"
 hostmakedepends="gettext flex llvm pkg-config python3-Mako glslang
  $(vopt_if wayland 'wayland-protocols wayland-devel')"
 makedepends="elfutils-devel expat-devel libXdamage-devel
@@ -16,13 +16,13 @@ makedepends="elfutils-devel expat-devel libXdamage-devel
  libXrandr-devel libglvnd-devel libzstd-devel libxml2-devel lua53-devel
  libarchive-devel"
 depends="libglvnd"
-short_desc="Graphics library similar to SGI's OpenGL"
+short_desc="Open source implementation of OpenGL and Vulkan specifications"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="MIT, LGPL-2.1-or-later"
 homepage="https://www.mesa3d.org/"
 changelog="https://docs.mesa3d.org/relnotes.html"
 distfiles="https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
-checksum=3eed2ecae2bc674494566faab9fcc9beb21cd804c7ba2b59a1694f3d7236e6a9
+checksum=386362a5d80df3b096636b67f340e1ce67b705b44767d5bdd11d2ed1037192d5
 
 build_options="wayland"
 build_options_default="wayland"

From 5d2b924c70d01d6c4cd526a60b5450291168822b Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 18/32] codelite: rebuild for llvm16-16.0.3_1

---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index b0bf8f57736a..140fe20d0d26 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=16.0.0
-revision=3
+revision=4
 create_wrksrc=yes
 build_style=cmake
 build_helper=cmake-wxWidgets-gtk3

From d4058f2588f0fcc3d6262f818caedb96d08eb809 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 19/32] geary: rebuild for llvm16-16.0.3_1

---
 srcpkgs/geary/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/geary/template b/srcpkgs/geary/template
index a1804b4b65e5..7479ab2bdb5c 100644
--- a/srcpkgs/geary/template
+++ b/srcpkgs/geary/template
@@ -1,7 +1,7 @@
 # Template file for 'geary'
 pkgname=geary
 version=43.0
-revision=2
+revision=3
 build_helper="gir"
 build_style=meson
 configure_args="-Dprofile=release -Dcontractor=enabled"

From 45c9da73ede34c82950c7114202198717b7cdb5b Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 20/32] glog: rebuild for llvm16-16.0.3_1

---
 srcpkgs/glog/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/glog/template b/srcpkgs/glog/template
index 26110efd0a00..4cde03839d57 100644
--- a/srcpkgs/glog/template
+++ b/srcpkgs/glog/template
@@ -1,7 +1,7 @@
 # Template file for 'glog'
 pkgname=glog
 version=0.6.0
-revision=1
+revision=2
 build_style=cmake
 makedepends="gflags-devel libunwind-devel"
 checkdepends="gtest-devel"

From 5fe441b88ff349c8831c54146fa205e257ad5abc Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 21/32] gnome-builder: rebuild for llvm16-16.0.3_1

---
 srcpkgs/gnome-builder/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnome-builder/template b/srcpkgs/gnome-builder/template
index 4b56136453bd..d4e91ad17997 100644
--- a/srcpkgs/gnome-builder/template
+++ b/srcpkgs/gnome-builder/template
@@ -1,7 +1,7 @@
 # Template file for 'gnome-builder'
 pkgname=gnome-builder
 version=44.1
-revision=2
+revision=3
 build_style=meson
 build_helper=qemu
 configure_args="-Dhelp=true -Dnetwork_tests=false"

From 30e29dc7fa4b9eae638af1b33ea0a4be76157e30 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 22/32] gperftools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/gperftools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gperftools/template b/srcpkgs/gperftools/template
index de7e9423d343..e44f018aa3c1 100644
--- a/srcpkgs/gperftools/template
+++ b/srcpkgs/gperftools/template
@@ -1,7 +1,7 @@
 # Template file for 'gperftools'
 pkgname=gperftools
 version=2.8
-revision=2
+revision=3
 build_style=gnu-configure
 hostmakedepends="automake libtool"
 makedepends="libunwind-devel"

From 69b7f01fdece0993736d59c39846fe2b128bae2f Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:20 +0200
Subject: [PATCH 23/32] heaptrack: rebuild for llvm16-16.0.3_1

---
 srcpkgs/heaptrack/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/heaptrack/template b/srcpkgs/heaptrack/template
index 74bc604993a5..7388dd050647 100644
--- a/srcpkgs/heaptrack/template
+++ b/srcpkgs/heaptrack/template
@@ -1,7 +1,7 @@
 # Template file for 'heaptrack'
 pkgname=heaptrack
 version=1.4.0
-revision=3
+revision=4
 build_style=cmake
 configure_args="-DHEAPTRACK_BUILD_GUI=ON"
 hostmakedepends="qt5-qmake qt5-host-tools extra-cmake-modules kcoreaddons

From 68445e613e8cc4a2934c8a4d3c7eff9b2c219178 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:21 +0200
Subject: [PATCH 24/32] igt-gpu-tools: rebuild for llvm16-16.0.3_1

---
 srcpkgs/igt-gpu-tools/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/igt-gpu-tools/template b/srcpkgs/igt-gpu-tools/template
index 225e2c79118a..cf29756c2725 100644
--- a/srcpkgs/igt-gpu-tools/template
+++ b/srcpkgs/igt-gpu-tools/template
@@ -1,7 +1,7 @@
 # Template file for 'igt-gpu-tools'
 pkgname=igt-gpu-tools
 version=1.27.1
-revision=1
+revision=2
 build_style=meson
 configure_args="-Db_ndebug=false -Ddocs=disabled"
 hostmakedepends="pkg-config flex peg python3-docutils"

From 6ddec718dc4a9b6efccf71c546064f05b8b7fed0 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:21 +0200
Subject: [PATCH 25/32] juCi++: rebuild for llvm16-16.0.3_1

---
 srcpkgs/juCi++/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 416bde7cc4d0..ad903e98b150 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.7.2
-revision=3
+revision=4
 _libclangmm_commit="9704b9b6de0982a588fa41741157d5640afedf30"
 _tiny_commit="839ff806dc447ff49af80f9a9eaa7949f770f8e5"
 create_wrksrc=yes

From 0152a5db09eebae17acaf3dfe2e642df35f411f4 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:21 +0200
Subject: [PATCH 26/32] kdevelop: rebuild for llvm16-16.0.3_1

---
 srcpkgs/kdevelop/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index 87bb6b2d43f7..77ad2fb27345 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=22.12.2
-revision=2
+revision=3
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools qt5-tools

From 37cafba32649a1c4dca2bcd1035f897991850e66 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 27/32] qt5: rebuild for llvm16-16.0.3_1

---
 srcpkgs/qt5/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index e0463e1c9198..0ee7ca4f05b1 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -5,7 +5,7 @@ pkgname=qt5
 version=5.15.7+20221119
 # commit f8c9fb304bc3e53b3aa07f962cd74e9160decccc
 # base repo: https://invent.kde.org/qt/qt/qt5
-revision=4
+revision=5
 build_style=meta
 hostmakedepends="cmake clang flex perl glib-devel pkg-config
  python re2c ruby which"

From c2cb8b8e8e77e78892560848a4a11837945765ba Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 28/32] rtags: rebuild for llvm16-16.0.3_1

---
 srcpkgs/rtags/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/rtags/template b/srcpkgs/rtags/template
index 9b161e690d76..0067603a2336 100644
--- a/srcpkgs/rtags/template
+++ b/srcpkgs/rtags/template
@@ -1,7 +1,7 @@
 # Template file for 'rtags'
 pkgname=rtags
 version=2.38
-revision=6
+revision=7
 build_style=cmake
 # Don't run tests in do_install, please.
 configure_args="-DSKIP_CTEST=TRUE"

From 72d043dbb94fc2dc0a2051342a889efd088ff6c7 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 29/32] shiboken2: rebuild for llvm16-16.0.3_1

---
 srcpkgs/shiboken2/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 084ecc3ba1e1..2a21998997eb 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.15.7
-revision=1
+revision=2
 _pkgname="pyside-setup-opensource-src-${version}"
 build_wrksrc="sources/shiboken2"
 build_style=cmake

From c909554619cda239129821c4f4f29026e4681bc7 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:22 +0200
Subject: [PATCH 30/32] sysprof: rebuild for llvm16-16.0.3_1

---
 srcpkgs/sysprof/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/sysprof/template b/srcpkgs/sysprof/template
index 0a40abfb42b7..6d27e1ceeb24 100644
--- a/srcpkgs/sysprof/template
+++ b/srcpkgs/sysprof/template
@@ -1,7 +1,7 @@
 # Template file for 'sysprof'
 pkgname=sysprof
 version=3.46.0
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dgtk=true -Dsystemdunitdir=/usr/lib/systemd"
 hostmakedepends="gettext pkg-config itstool glib-devel desktop-file-utils

From c793e806f8c97389e386f9c78723fa4c16a75dfe Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 4 May 2023 22:47:23 +0200
Subject: [PATCH 31/32] tilix: rebuild for llvm16-16.0.3_1

---
 srcpkgs/tilix/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tilix/template b/srcpkgs/tilix/template
index 74ccb4dd4592..77da7f7940ca 100644
--- a/srcpkgs/tilix/template
+++ b/srcpkgs/tilix/template
@@ -1,7 +1,7 @@
 # Template file for 'tilix'
 pkgname=tilix
 version=1.9.4
-revision=7
+revision=8
 _undead_version=1.1.8
 build_wrksrc="${pkgname}-${version}"
 build_style=meson

From 6f51eb61a8b4640754cf7983d802be93c28b79c2 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 3 May 2023 22:27:40 +0200
Subject: [PATCH 32/32] chromium: update to 113.0.5672.63.

---
 .../musl-patches/quiche-arena-size.patch      | 15 ------
 ...g-for-std-strlen-in-web_view_impl.cc.patch | 29 +++++++++++
 .../patches/download-bubble-typename.patch    | 42 ++++++++++++++++
 ...-constraints-on-VirtualCursor-layout.patch | 48 -------------------
 .../chromium/patches/webauthn-variant.patch   | 14 ++++++
 srcpkgs/chromium/template                     |  6 +--
 6 files changed, 88 insertions(+), 66 deletions(-)
 delete mode 100644 srcpkgs/chromium/files/musl-patches/quiche-arena-size.patch
 create mode 100644 srcpkgs/chromium/patches/add-cstring-for-std-strlen-in-web_view_impl.cc.patch
 create mode 100644 srcpkgs/chromium/patches/download-bubble-typename.patch
 delete mode 100644 srcpkgs/chromium/patches/sql-relax-constraints-on-VirtualCursor-layout.patch
 create mode 100644 srcpkgs/chromium/patches/webauthn-variant.patch

diff --git a/srcpkgs/chromium/files/musl-patches/quiche-arena-size.patch b/srcpkgs/chromium/files/musl-patches/quiche-arena-size.patch
deleted file mode 100644
index 4d17c41b56d5..000000000000
--- a/srcpkgs/chromium/files/musl-patches/quiche-arena-size.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Source: https://git.alpinelinux.org/aports/plain/community/chromium/quiche-arena-size.patch
-back in the day when net_unittests were ran, the block arena size was not big
-enough for some reason. should look at this again
---
---- a/net/third_party/quiche/src/quiche/quic/core/quic_one_block_arena.h
-+++ b/net/third_party/quiche/src/quiche/quic/core/quic_one_block_arena.h
-@@ -69,7 +69,7 @@
- 
- // QuicConnections currently use around 1KB of polymorphic types which would
- // ordinarily be on the heap. Instead, store them inline in an arena.
--using QuicConnectionArena = QuicOneBlockArena<1280>;
-+using QuicConnectionArena = QuicOneBlockArena<1504>;
- 
- }  // namespace quic
- 
diff --git a/srcpkgs/chromium/patches/add-cstring-for-std-strlen-in-web_view_impl.cc.patch b/srcpkgs/chromium/patches/add-cstring-for-std-strlen-in-web_view_impl.cc.patch
new file mode 100644
index 000000000000..6648fab5719d
--- /dev/null
+++ b/srcpkgs/chromium/patches/add-cstring-for-std-strlen-in-web_view_impl.cc.patch
@@ -0,0 +1,29 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/79b774aedeaecd4d31b2adb84e3e4b901dc980aa/trunk/add-cstring-for-std-strlen-in-web_view_impl.cc.patch
+--
+From 2e14a3ac178ee87aa9154e5a15dcd986af1b6059 Mon Sep 17 00:00:00 2001
+From: Stephan Hartmann <stha09@googlemail.com>
+Date: Tue, 28 Mar 2023 14:34:55 +0000
+Subject: [PATCH] IWYU: add cstring for std::strlen in web_view_impl.cc
+
+Bug: 957519
+Change-Id: I15ad1e905eda3d96bbf164f5df8f3cf8e02bc370
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4376772
+Reviewed-by: Alex Ilin <alexilin@chromium.org>
+Commit-Queue: Alex Ilin <alexilin@chromium.org>
+Cr-Commit-Position: refs/heads/main@{#1123011}
+---
+ chrome/test/chromedriver/chrome/web_view_impl.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/chrome/test/chromedriver/chrome/web_view_impl.cc b/chrome/test/chromedriver/chrome/web_view_impl.cc
+index f726627e88d..d96d481d0bc 100644
+--- a/chrome/test/chromedriver/chrome/web_view_impl.cc
++++ b/chrome/test/chromedriver/chrome/web_view_impl.cc
+@@ -6,6 +6,7 @@
+ 
+ #include <stddef.h>
+ #include <algorithm>
++#include <cstring>
+ #include <memory>
+ #include <queue>
+ #include <utility>
diff --git a/srcpkgs/chromium/patches/download-bubble-typename.patch b/srcpkgs/chromium/patches/download-bubble-typename.patch
new file mode 100644
index 000000000000..8edb46974a5b
--- /dev/null
+++ b/srcpkgs/chromium/patches/download-bubble-typename.patch
@@ -0,0 +1,42 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/79b774aedeaecd4d31b2adb84e3e4b901dc980aa/trunk/download-bubble-typename.patch
+--
+diff --git a/chrome/browser/download/bubble/download_bubble_update_service.cc b/chrome/browser/download/bubble/download_bubble_update_service.cc
+index 13460309d0e..a18d2f8a272 100644
+--- a/chrome/browser/download/bubble/download_bubble_update_service.cc
++++ b/chrome/browser/download/bubble/download_bubble_update_service.cc
+@@ -87,7 +87,7 @@ ItemSortKey GetSortKey(const Item& item) {
+ // Helper to get an iterator to the last element in the cache. The cache
+ // must not be empty.
+ template <typename Item>
+-SortedItems<Item>::iterator GetLastIter(SortedItems<Item>& cache) {
++typename SortedItems<Item>::iterator GetLastIter(SortedItems<Item>& cache) {
+   CHECK(!cache.empty());
+   auto it = cache.end();
+   return std::prev(it);
+@@ -656,9 +656,9 @@ bool DownloadBubbleUpdateService::RemoveItemFromCacheImpl(
+ }
+ 
+ template <typename Id, typename Item>
+-SortedItems<Item>::iterator
++typename SortedItems<Item>::iterator
+ DownloadBubbleUpdateService::RemoveItemFromCacheByIter(
+-    SortedItems<Item>::iterator iter,
++    typename SortedItems<Item>::iterator iter,
+     SortedItems<Item>& cache,
+     IterMap<Id, Item>& iter_map) {
+   CHECK(iter != cache.end());
+diff --git a/chrome/browser/download/bubble/download_bubble_update_service.h b/chrome/browser/download/bubble/download_bubble_update_service.h
+index 4c3c0bc1193..38048873aa9 100644
+--- a/chrome/browser/download/bubble/download_bubble_update_service.h
++++ b/chrome/browser/download/bubble/download_bubble_update_service.h
+@@ -179,8 +179,8 @@ class DownloadBubbleUpdateService
+ 
+   // Removes item if we already have the iterator to it. Returns next iterator.
+   template <typename Id, typename Item>
+-  SortedItems<Item>::iterator RemoveItemFromCacheByIter(
+-      SortedItems<Item>::iterator iter,
++  typename SortedItems<Item>::iterator RemoveItemFromCacheByIter(
++      typename SortedItems<Item>::iterator iter,
+       SortedItems<Item>& cache,
+       IterMap<Id, Item>& iter_map);
+ 
diff --git a/srcpkgs/chromium/patches/sql-relax-constraints-on-VirtualCursor-layout.patch b/srcpkgs/chromium/patches/sql-relax-constraints-on-VirtualCursor-layout.patch
deleted file mode 100644
index d1e65ee1561c..000000000000
--- a/srcpkgs/chromium/patches/sql-relax-constraints-on-VirtualCursor-layout.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 7d1394bd639e3bcf68082ac3fc33eeed6a00d2e6 Mon Sep 17 00:00:00 2001
-From: Elly Fong-Jones <ellyjones@chromium.org>
-Date: Thu, 2 Mar 2023 00:15:11 +0000
-Subject: [PATCH] sql: relax constraints on VirtualCursor layout
-
-VirtualCursor::FromSqliteCursor required that VirtualCursor had a
-standard layout, but in fact VirtualCursor shouldn't have a standard
-layout, and the fact that it does with libc++ is a deviation from the
-C++ standard. This change:
-
-1. Relaxes the requirement that VirtualCursor has a standard layout, and
-2. Relaxes the requirement that the sqlite_cursor_ field has to be at
-   offset 0
-
-by use of offsetof() and pointer subtraction. This change both improves
-standards compliance and makes this code build with libstdc++.
-
-Bug: 1380656
-Change-Id: I9c47abd9197b187da0360ca5619ccf7dadab4f33
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4292313
-Reviewed-by: Austin Sullivan <asully@chromium.org>
-Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
-Cr-Commit-Position: refs/heads/main@{#1111925}
----
- sql/recover_module/cursor.h | 10 ++++------
- 1 file changed, 4 insertions(+), 6 deletions(-)
-
-diff --git a/sql/recover_module/cursor.h b/sql/recover_module/cursor.h
-index 1970bdca8c6..4cb06557009 100644
---- a/sql/recover_module/cursor.h
-+++ b/sql/recover_module/cursor.h
-@@ -63,12 +63,10 @@ class VirtualCursor {
-   // |sqlite_cursor| must have been returned by VirtualTable::SqliteCursor().
-   static inline VirtualCursor* FromSqliteCursor(
-       sqlite3_vtab_cursor* sqlite_cursor) {
--    static_assert(std::is_standard_layout<VirtualCursor>::value,
--                  "needed for the reinterpret_cast below");
--    static_assert(offsetof(VirtualCursor, sqlite_cursor_) == 0,
--                  "sqlite_cursor_ must be the first member of the class");
--    VirtualCursor* result = reinterpret_cast<VirtualCursor*>(sqlite_cursor);
--    DCHECK_EQ(sqlite_cursor, &result->sqlite_cursor_);
-+    VirtualCursor* result = reinterpret_cast<VirtualCursor*>(
-+        (reinterpret_cast<char*>(sqlite_cursor) -
-+         offsetof(VirtualCursor, sqlite_cursor_)));
-+    CHECK_EQ(sqlite_cursor, &result->sqlite_cursor_);
-     return result;
-   }
- 
diff --git a/srcpkgs/chromium/patches/webauthn-variant.patch b/srcpkgs/chromium/patches/webauthn-variant.patch
new file mode 100644
index 000000000000..2ee02f5e5fe1
--- /dev/null
+++ b/srcpkgs/chromium/patches/webauthn-variant.patch
@@ -0,0 +1,14 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/79b774aedeaecd4d31b2adb84e3e4b901dc980aa/trunk/webauthn-variant.patch
+--
+diff --git a/chrome/browser/webauthn/authenticator_request_dialog_model.h b/chrome/browser/webauthn/authenticator_request_dialog_model.h
+index f4992a74bd6..45cabe39974 100644
+--- a/chrome/browser/webauthn/authenticator_request_dialog_model.h
++++ b/chrome/browser/webauthn/authenticator_request_dialog_model.h
+@@ -7,6 +7,7 @@
+ 
+ #include <memory>
+ #include <string>
++#include <variant>
+ #include <vector>
+ 
+ #include "base/containers/span.h"
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index e50c739d3ee7..45f9f2476e3c 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,11 +1,11 @@
 # Template file for 'chromium'
 pkgname=chromium
 # See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=112.0.5615.49
+version=113.0.5672.63
 revision=1
 archs="i686* x86_64* aarch64* armv7l*"
 hostmakedepends="
- $(vopt_if clang "clang lld llvm15")
+ $(vopt_if clang "clang lld llvm")
  $(vopt_if js_optimize openjdk)
  bison git gperf hwids ninja nodejs perl pkg-config python3
  libatomic-devel libepoxy-devel libevent-devel libglib-devel"
@@ -28,7 +28,7 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
 license="BSD-3-Clause"
 homepage="https://www.chromium.org/"
 distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=ddfd37373c1fa0f433a6ac11f0baa2b1f3fdfb9c7b5867e32a4300f2eb5aff41
+checksum=76cec11dc13abe6703305b0300e1fe24c8f547c1ff313f7be09db0e23d12ee1e
 
 lib32disabled=yes
 

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

* Re: New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (12 preceding siblings ...)
  2023-05-05 19:27 ` Duncaen
@ 2023-07-05  4:14 ` wozniak
  2023-10-04  1:45 ` github-actions
  2023-10-19  1:45 ` [PR PATCH] [Closed]: " github-actions
  15 siblings, 0 replies; 17+ messages in thread
From: wozniak @ 2023-07-05  4:14 UTC (permalink / raw)
  To: ml

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

New comment by wozniak on void-packages repository

https://github.com/void-linux/void-packages/pull/43739#issuecomment-1620994109

Comment:
any idea when this will be finished?

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

* Re: New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (13 preceding siblings ...)
  2023-07-05  4:14 ` wozniak
@ 2023-10-04  1:45 ` github-actions
  2023-10-19  1:45 ` [PR PATCH] [Closed]: " github-actions
  15 siblings, 0 replies; 17+ messages in thread
From: github-actions @ 2023-10-04  1:45 UTC (permalink / raw)
  To: ml

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

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/43739#issuecomment-1746000978

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

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

* Re: [PR PATCH] [Closed]: New package: llvm16-16.0.3
  2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
                   ` (14 preceding siblings ...)
  2023-10-04  1:45 ` github-actions
@ 2023-10-19  1:45 ` github-actions
  15 siblings, 0 replies; 17+ messages in thread
From: github-actions @ 2023-10-19  1:45 UTC (permalink / raw)
  To: ml

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

There's a closed pull request on the void-packages repository

New package: llvm16-16.0.3
https://github.com/void-linux/void-packages/pull/43739

Description:
[ci skip]

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

end of thread, other threads:[~2023-10-19  1:45 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-03 23:51 [PR PATCH] New package: llvm16-16.0.3 Duncaen
2023-05-04  1:10 ` [PR PATCH] [Updated] " Duncaen
2023-05-04  1:12 ` Duncaen
2023-05-04  1:21 ` Duncaen
2023-05-04  1:34 ` Duncaen
2023-05-04 11:33 ` Duncaen
2023-05-04 11:40 ` Duncaen
2023-05-04 19:41 ` Duncaen
2023-05-04 19:43 ` Duncaen
2023-05-04 19:44 ` Duncaen
2023-05-04 22:43 ` Duncaen
2023-05-05 19:24 ` Duncaen
2023-05-05 19:25 ` Duncaen
2023-05-05 19:27 ` Duncaen
2023-07-05  4:14 ` wozniak
2023-10-04  1:45 ` github-actions
2023-10-19  1:45 ` [PR PATCH] [Closed]: " github-actions

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).