summaryrefslogtreecommitdiff
path: root/user/clang
diff options
context:
space:
mode:
Diffstat (limited to 'user/clang')
-rw-r--r--user/clang/0001-Add-support-for-Ad-lie-Linux.patch48
-rw-r--r--user/clang/0008-Fix-ClangConfig-cmake-LLVM-path.patch25
-rw-r--r--user/clang/APKBUILD85
-rw-r--r--user/clang/big-endian-32.patch183
-rw-r--r--user/clang/cfe-005-ppc64-dynamic-linker-path.patch2
-rw-r--r--user/clang/pmmx-musl.patch12
-rw-r--r--user/clang/ppc-dirwatcher.patch10
-rw-r--r--user/clang/ppc64-elfv2.patch38
-rw-r--r--user/clang/secure-plt.patch11
-rw-r--r--user/clang/use-llvm-lit.patch2
10 files changed, 273 insertions, 143 deletions
diff --git a/user/clang/0001-Add-support-for-Ad-lie-Linux.patch b/user/clang/0001-Add-support-for-Ad-lie-Linux.patch
index 4c2ef219f..9f2612440 100644
--- a/user/clang/0001-Add-support-for-Ad-lie-Linux.patch
+++ b/user/clang/0001-Add-support-for-Ad-lie-Linux.patch
@@ -16,7 +16,7 @@ diff --git a/include/clang/Driver/Distro.h b/include/clang/Driver/Distro.h
index 7b34a09256..7a3774a4f1 100644
--- a/include/clang/Driver/Distro.h
+++ b/include/clang/Driver/Distro.h
-@@ -26,6 +26,7 @@ public:
+@@ -28,6 +28,7 @@ public:
// NB: Releases of a particular Linux distro should be kept together
// in this enum, because some tests are done by integer comparison against
// the first and last known member in the family, e.g. IsRedHat().
@@ -24,39 +24,29 @@ index 7b34a09256..7a3774a4f1 100644
AlpineLinux,
ArchLinux,
DebianLenny,
-@@ -120,6 +121,10 @@ public:
- return DistroVal >= UbuntuHardy && DistroVal <= UbuntuDisco;
+@@ -134,3 +135,5 @@ public:
}
-+ bool IsAdelieLinux() const {
-+ return DistroVal == AdelieLinux;
-+ }
++ bool IsAdelieLinux() const { return DistroVal == AdelieLinux; }
+
- bool IsAlpineLinux() const {
- return DistroVal == AlpineLinux;
- }
+ bool IsAlpineLinux() const { return DistroVal == AlpineLinux; }
diff --git a/lib/Driver/Distro.cpp b/lib/Driver/Distro.cpp
index 2c4d44faf8..7ef35ab379 100644
--- a/lib/Driver/Distro.cpp
+++ b/lib/Driver/Distro.cpp
-@@ -132,6 +132,9 @@ static Distro::DistroType DetectDistro(vfs::FileSystem &VFS) {
- if (VFS.exists("/etc/exherbo-release"))
- return Distro::Exherbo;
-
-+ if (VFS.exists("/etc/adelie-release"))
-+ return Distro::AdelieLinux;
-+
- if (VFS.exists("/etc/alpine-release"))
- return Distro::AlpineLinux;
-
---
-2.18.0
-
+@@ -36,6 +36,7 @@
+ for (StringRef Line : Lines)
+ if (Version == Distro::UnknownDistro && Line.starts_with("ID="))
+ Version = llvm::StringSwitch<Distro::DistroType>(Line.substr(3))
++ .Case("adelie", Distro::AdelieLinux)
+ .Case("alpine", Distro::AlpineLinux)
+ .Case("fedora", Distro::Fedora)
+ .Case("gentoo", Distro::Gentoo)
--- cfe-8.0.0.src/lib/Driver/ToolChains/Linux.cpp.old 2018-11-29 18:52:22.000000000 +0000
+++ cfe-8.0.0.src/lib/Driver/ToolChains/Linux.cpp 2019-04-23 23:49:37.786181838 +0000
-@@ -241,13 +241,13 @@
+@@ -226,13 +226,13 @@
- Distro Distro(D.getVFS());
+ Distro Distro(D.getVFS(), Triple);
- if (Distro.IsAlpineLinux() || Triple.isAndroid()) {
+ if (Distro.IsAdelieLinux() || Distro.IsAlpineLinux() || Triple.isAndroid()) {
@@ -70,13 +60,3 @@ index 2c4d44faf8..7ef35ab379 100644
ExtraOpts.push_back("-z");
ExtraOpts.push_back("relro");
}
-@@ -290,7 +290,8 @@
- if (!IsMips && !IsHexagon) {
- if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
- (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) ||
-- (IsAndroid && !Triple.isAndroidVersionLT(23)))
-+ (IsAndroid && !Triple.isAndroidVersionLT(23)) ||
-+ Distro.IsAdelieLinux())
- ExtraOpts.push_back("--hash-style=gnu");
-
- if (Distro.IsDebian() || Distro.IsOpenSUSE() ||
diff --git a/user/clang/0008-Fix-ClangConfig-cmake-LLVM-path.patch b/user/clang/0008-Fix-ClangConfig-cmake-LLVM-path.patch
deleted file mode 100644
index f1c1c2449..000000000
--- a/user/clang/0008-Fix-ClangConfig-cmake-LLVM-path.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From: Adeel <adeelbm@outlook.com>
-Date: Sun, 6 May 2018 10:22:00 +0200
-Subject: [PATCH] Fix ClangConfig.cmake to look for LLVM-Config.cmake in correct location
-
-This results in the following change in the generated ClangConfig.cmake:
-
- find_package(LLVM REQUIRED CONFIG
- - HINTS "${CLANG_INSTALL_PREFIX}/lib/cmake/llvm")
- + HINTS "/usr/lib/llvm5/lib/cmake/llvm")
-
-This is needed e.g. for building lldb.
-
-See https://github.com/alpinelinux/aports/pull/2342 for more information.
-
---- a/cmake/modules/CMakeLists.txt
-+++ b/cmake/modules/CMakeLists.txt
-@@ -39,7 +39,7 @@ foreach(p ${_count})
- get_filename_component(CLANG_INSTALL_PREFIX \"\${CLANG_INSTALL_PREFIX}\" PATH)")
- endforeach(p)
- set(CLANG_CONFIG_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}/${CLANG_INSTALL_PACKAGE_DIR}")
--set(CLANG_CONFIG_LLVM_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
-+set(CLANG_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}")
- set(CLANG_CONFIG_EXPORTS_FILE "\${CLANG_CMAKE_DIR}/ClangTargets.cmake")
- set(CLANG_CONFIG_INCLUDE_DIRS
- "\${CLANG_INSTALL_PREFIX}/include"
diff --git a/user/clang/APKBUILD b/user/clang/APKBUILD
index 1430b26e8..5084a4020 100644
--- a/user/clang/APKBUILD
+++ b/user/clang/APKBUILD
@@ -2,8 +2,8 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=clang
# Note: Update together with llvm.
-pkgver=8.0.1
-pkgrel=0
+pkgver=18.1.8
+pkgrel=1
_llvmver=${pkgver%%.*}
pkgdesc="A C language family front-end for LLVM"
arch="all"
@@ -12,25 +12,71 @@ url="https://llvm.org/"
license="NCSA"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="cmake isl-dev libedit-dev libexecinfo-dev libxml2-dev libxml2-utils
- llvm-dev>=$_llvmver llvm-static>=$_llvmver llvm-test-utils>=$_llvmver
+ llvm${_llvmver}-dev llvm${_llvmver}-static llvm${_llvmver}-test-utils
z3 z3-dev"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs
$pkgname-analyzer::noarch"
-source="https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/cfe-$pkgver.src.tar.xz
+source="https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/llvm-project-$pkgver.src.tar.xz
0001-Add-support-for-Ad-lie-Linux.patch
- 0008-Fix-ClangConfig-cmake-LLVM-path.patch
+ big-endian-32.patch
cfe-005-ppc64-dynamic-linker-path.patch
- pmmx-musl.patch
- ppc64-elfv2.patch
- secure-plt.patch
+ ppc-dirwatcher.patch
use-llvm-lit.patch
"
-builddir="$srcdir/cfe-$pkgver.src"
+builddir="$srcdir/llvm-project-$pkgver.src/$pkgname"
+
+prepare() {
+ default_prepare
+
+ #1054
+ rm -fr \
+ test/Coverage/html-diagnostics.c \
+ test/Coverage/html-multifile-diagnostics.c \
+ test/Modules/crash-vfs-path-emptydir-entries.m \
+ test/Modules/crash-vfs-path-symlink-component.m \
+ test/Modules/crash-vfs-path-symlink-topheader.m \
+ test/Modules/crash-vfs-path-traversal.m \
+ test/Modules/crash-vfs-relative-overlay.m \
+ test/Modules/crash-vfs-umbrella-frameworks.m \
+ test/Modules/load-module-with-errors.m \
+ test/Modules/modules-with-same-name.m \
+ test/Modules/prebuilt-implicit-modules.m \
+ test/Modules/prune.m \
+ test/Modules/signal.m \
+ test/VFS/module-header-mismatches.m \
+ test/VFS/module_missing_vfs.m \
+ test/utils/update_cc_test_checks/basic-cplusplus.test \
+ test/utils/update_cc_test_checks/check-globals.test \
+ test/utils/update_cc_test_checks/check_attrs.test \
+ test/utils/update_cc_test_checks/def-and-decl.test \
+ test/utils/update_cc_test_checks/exec-all-runlines.test \
+ test/utils/update_cc_test_checks/explicit-template-instantiation.test \
+ test/utils/update_cc_test_checks/generated-funcs-regex.test \
+ test/utils/update_cc_test_checks/generated-funcs.test \
+ test/utils/update_cc_test_checks/global-hex-value-regex.test \
+ test/utils/update_cc_test_checks/global-value-regex.test \
+ test/utils/update_cc_test_checks/mangled_names.test \
+ test/utils/update_cc_test_checks/on_the_fly_arg_change.test \
+ test/utils/update_cc_test_checks/prefix-never-matches.test \
+ test/utils/update_cc_test_checks/replace-value-regex-across-runs.test \
+ test/utils/update_cc_test_checks/resolve-tmp-conflict.test \
+ ;
+
+ rm -f test/Driver/ppc-float-abi-warning.cpp
+ # known broken on 32-bit platforms
+ rm -f test/CodeGenCUDA/static-device-var-rdc.cu
+}
build() {
+ _build_type=MinSizeRel
+ case $CARCH in
+ ppc64)
+ # https://github.com/llvm/llvm-project/issues/102192
+ _build_type=Release;;
+ esac
CMAKE_PREFIX_PATH=/usr/lib/llvm$_llvmver/lib/cmake \
cmake -Wno-dev \
- -DCMAKE_BUILD_TYPE=MinSizeRel \
+ -DCMAKE_BUILD_TYPE=$_build_type \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_VERBOSE_MAKEFILE=OFF \
-DCLANG_VENDOR=${DISTRO_SHORT_NAME:-Adélie} \
@@ -41,6 +87,8 @@ build() {
-DLIBCLANG_BUILD_STATIC=ON \
-DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_RTTI=ON \
+ -DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src" \
+ -DLLVM_EXTERNAL_LIT="/usr/lib/llvm$_llvmver/bin/lit" \
-Bbuild \
.
@@ -54,13 +102,10 @@ build() {
}
check() {
- [ -f build/bin/llvm-lit ] || ln -s /usr/bin/lit build/bin/llvm-lit
make -C build check-clang
}
package() {
- local _dir _file
-
make DESTDIR="$pkgdir" -C build install
install -m 644 build/lib/libclang.a "$pkgdir"/usr/lib
@@ -105,11 +150,9 @@ analyzer() {
mv usr/share/scan-* "$subpkgdir"/usr/share/
}
-sha512sums="1227b2d32052c70b4b494659849000188fce46fc31a71f3352ba8457ac0b0b17e4bc7c8589874c8586d55aa808ee6c1fceb7df501aafa33599f8df7bfd2b791d cfe-8.0.1.src.tar.xz
-15f8c4e3453c0620ccd47e5dae37de29f722bc5f16aa64a3ff1ac2a2d522dd3e13dada539f1944c51f334d0f91ac60d0189578c252c49ba39d17cdf42021086b 0001-Add-support-for-Ad-lie-Linux.patch
-9485fe4fd6182df543735ed8f4ce618693d0faeafa86d3f9574a6c7abf50978e2d56e0a94be3ed94d515cc937c388d66ceff1bbc9bb120d371b6d3e95340da00 0008-Fix-ClangConfig-cmake-LLVM-path.patch
-ee5606b130354983202a1d7c96183ea81dec1048a92dc059bbc07fd4e8e21c1279064422d8f432d2b6e5d88d883f1e2c8f8dada716d82ae4068c9fea3e1b0a54 cfe-005-ppc64-dynamic-linker-path.patch
-13b6b03798c724f1444d8639cfab0c971560618ff7a61f461bde5ab004bdbadbf9960ab30bbb19fcc9e305712b66a22bf88998f2cdd6f5e3ba7065539abc40a0 pmmx-musl.patch
-de0b806ad632c76789f7cf750e6b23cc72b3708a9566ef25d5ac3f51840972163a57304802259a0408fb33f44334ec12cef49600f766e8329af489c9a991af74 ppc64-elfv2.patch
-08a231b73561c78195a717aed022c60264b3d77ad01df07835fec397994b09cf703fe16ad7a8f62acdc37269e0a6ef8bd07c3289db58490440c766f58c3af239 secure-plt.patch
-1b0e7fe72de58a5a22d4c4afe7c3bcab23244e6e5e01df43752a38b4cafcfb47ba1877641db285cd31869d5521657b6c6280506d872c25191b10a8661b43b0fe use-llvm-lit.patch"
+sha512sums="25eeee9984c8b4d0fbc240df90f33cbb000d3b0414baff5c8982beafcc5e59e7ef18f6f85d95b3a5f60cb3d4cd4f877c80487b5768bc21bc833f107698ad93db llvm-project-18.1.8.src.tar.xz
+d37d2339a76c21666aa4405b2a620100e6967eb933535b5cea05f5de25a4d75510479443500715529cea38014028741d71553c7b247d5f349a05660133d66bc6 0001-Add-support-for-Ad-lie-Linux.patch
+241a087888b7b5373b54653c4675c77c70d82b61a1b79359cba7d5fe0187851e790cb4e7e278a0a59c660b9a980cf087b393dc43a19a975fc9b97717bca12bc4 big-endian-32.patch
+8272ec0eeb93287c9cc961099139f7cb0f94561befc31a4521387fa5f7216dc4b3d99750c4560a0b71ec4acde5bd776abef733cfafe81058ef054b62f72fc209 cfe-005-ppc64-dynamic-linker-path.patch
+0032fdd3864870d345caff9c4ff44f58bebc802bddf06c4b3bf30276c89e237167e6dea03456d322d3f6e2ee5e3a2ecf9f649ed033f0ab078b80bda44371b3ce ppc-dirwatcher.patch
+6c6b4fc49539ecf02e4eec9c2bbd89cc37fe01383e7884aa52c90ab0a4aa23cd9a86716bc645af6949f787d2fe3b9a3ad177baef1edbec928437872d14db536d use-llvm-lit.patch"
diff --git a/user/clang/big-endian-32.patch b/user/clang/big-endian-32.patch
new file mode 100644
index 000000000..9235d2f5e
--- /dev/null
+++ b/user/clang/big-endian-32.patch
@@ -0,0 +1,183 @@
+From 4f37ed5ff6c18c8cf0de244bb064d5f4f60065a4 Mon Sep 17 00:00:00 2001
+From: Jessica Clarke <jrtc27@jrtc27.com>
+Date: Fri, 18 Oct 2024 16:50:22 +0100
+Subject: [PATCH 1/2] [clang] Make LazyOffsetPtr more portable
+
+LazyOffsetPtr currently relies on uint64_t being able to store a pointer
+and, unless sizeof(uint64_t) == sizeof(void *), little endianness, since
+getAddressOfPointer reinterprets the memory as a pointer. This also
+doesn't properly respect the C++ object model.
+
+As removing getAddressOfPointer would have wide-reaching implications,
+improve the implementation to account for these problems by using
+placement new and a suitably sized-and-aligned buffer, "right"-aligning
+the objects on big-endian platforms so the LSBs are in the same place
+for use as the discriminator.
+
+Fixes: bc73ef0031b50f7443615fef614fb4ecaaa4bd11
+Fixes: https://github.com/llvm/llvm-project/issues/111993
+---
+ clang/include/clang/AST/ExternalASTSource.h | 48 +++++++++++++++------
+ 1 file changed, 35 insertions(+), 13 deletions(-)
+
+diff --git clang/include/clang/AST/ExternalASTSource.h clang/include/clang/AST/ExternalASTSource.h
+index 385c32edbae0fd..caf37144d5eb73 100644
+--- clang/include/clang/AST/ExternalASTSource.h
++++ clang/include/clang/AST/ExternalASTSource.h
+@@ -25,10 +25,12 @@
+ #include "llvm/ADT/SmallVector.h"
+ #include "llvm/ADT/iterator.h"
+ #include "llvm/Support/PointerLikeTypeTraits.h"
++#include <algorithm>
+ #include <cassert>
+ #include <cstddef>
+ #include <cstdint>
+ #include <iterator>
++#include <new>
+ #include <optional>
+ #include <utility>
+
+@@ -326,29 +328,49 @@ struct LazyOffsetPtr {
+ ///
+ /// If the low bit is clear, a pointer to the AST node. If the low
+ /// bit is set, the upper 63 bits are the offset.
+- mutable uint64_t Ptr = 0;
++ static constexpr size_t DataSize = std::max(sizeof(uint64_t), sizeof(T *));
++ alignas(uint64_t) alignas(T *) mutable unsigned char Data[DataSize] = {};
++
++ unsigned char GetLSB() const {
++ return Data[llvm::sys::IsBigEndianHost ? DataSize - 1 : 0];
++ }
++
++ template <typename U> U &As(bool New) const {
++ unsigned char *Obj =
++ Data + (llvm::sys::IsBigEndianHost ? DataSize - sizeof(U) : 0);
++ if (New)
++ return *new (Obj) U;
++ return *std::launder(reinterpret_cast<U *>(Obj));
++ }
++
++ T *&GetPtr() const { return As<T *>(false); }
++ uint64_t &GetU64() const { return As<uint64_t>(false); }
++ void SetPtr(T *Ptr) const { As<T *>(true) = Ptr; }
++ void SetU64(uint64_t U64) const { As<uint64_t>(true) = U64; }
+
+ public:
+ LazyOffsetPtr() = default;
+- explicit LazyOffsetPtr(T *Ptr) : Ptr(reinterpret_cast<uint64_t>(Ptr)) {}
++ explicit LazyOffsetPtr(T *Ptr) : Data() { SetPtr(Ptr); }
+
+- explicit LazyOffsetPtr(uint64_t Offset) : Ptr((Offset << 1) | 0x01) {
++ explicit LazyOffsetPtr(uint64_t Offset) : Data() {
+ assert((Offset << 1 >> 1) == Offset && "Offsets must require < 63 bits");
+ if (Offset == 0)
+- Ptr = 0;
++ SetPtr(NULL);
++ else
++ SetU64((Offset << 1) | 0x01);
+ }
+
+ LazyOffsetPtr &operator=(T *Ptr) {
+- this->Ptr = reinterpret_cast<uint64_t>(Ptr);
++ SetPtr(Ptr);
+ return *this;
+ }
+
+ LazyOffsetPtr &operator=(uint64_t Offset) {
+ assert((Offset << 1 >> 1) == Offset && "Offsets must require < 63 bits");
+ if (Offset == 0)
+- Ptr = 0;
++ SetPtr(NULL);
+ else
+- Ptr = (Offset << 1) | 0x01;
++ SetU64((Offset << 1) | 0x01);
+
+ return *this;
+ }
+@@ -356,15 +378,15 @@ struct LazyOffsetPtr {
+ /// Whether this pointer is non-NULL.
+ ///
+ /// This operation does not require the AST node to be deserialized.
+- explicit operator bool() const { return Ptr != 0; }
++ explicit operator bool() const { return isOffset() || GetPtr() != NULL; }
+
+ /// Whether this pointer is non-NULL.
+ ///
+ /// This operation does not require the AST node to be deserialized.
+- bool isValid() const { return Ptr != 0; }
++ bool isValid() const { return isOffset() || GetPtr() != NULL; }
+
+ /// Whether this pointer is currently stored as an offset.
+- bool isOffset() const { return Ptr & 0x01; }
++ bool isOffset() const { return GetLSB() & 0x01; }
+
+ /// Retrieve the pointer to the AST node that this lazy pointer points to.
+ ///
+@@ -375,9 +397,9 @@ struct LazyOffsetPtr {
+ if (isOffset()) {
+ assert(Source &&
+ "Cannot deserialize a lazy pointer without an AST source");
+- Ptr = reinterpret_cast<uint64_t>((Source->*Get)(Ptr >> 1));
++ SetPtr((Source->*Get)(GetU64() >> 1));
+ }
+- return reinterpret_cast<T*>(Ptr);
++ return GetPtr();
+ }
+
+ /// Retrieve the address of the AST node pointer. Deserializes the pointee if
+@@ -385,7 +407,7 @@ struct LazyOffsetPtr {
+ T **getAddressOfPointer(ExternalASTSource *Source) const {
+ // Ensure the integer is in pointer form.
+ (void)get(Source);
+- return reinterpret_cast<T**>(&Ptr);
++ return &GetPtr();
+ }
+ };
+
+
+From 35eed5f3f5e09c4275cabac09e277a167a98f742 Mon Sep 17 00:00:00 2001
+From: Jessica Clarke <jrtc27@jrtc27.com>
+Date: Fri, 18 Oct 2024 17:45:28 +0100
+Subject: [PATCH 2/2] NULL -> nullptr
+
+---
+ clang/include/clang/AST/ExternalASTSource.h | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git clang/include/clang/AST/ExternalASTSource.h clang/include/clang/AST/ExternalASTSource.h
+index caf37144d5eb73..582ed7c65f58ca 100644
+--- clang/include/clang/AST/ExternalASTSource.h
++++ clang/include/clang/AST/ExternalASTSource.h
+@@ -355,7 +355,7 @@ struct LazyOffsetPtr {
+ explicit LazyOffsetPtr(uint64_t Offset) : Data() {
+ assert((Offset << 1 >> 1) == Offset && "Offsets must require < 63 bits");
+ if (Offset == 0)
+- SetPtr(NULL);
++ SetPtr(nullptr);
+ else
+ SetU64((Offset << 1) | 0x01);
+ }
+@@ -368,7 +368,7 @@ struct LazyOffsetPtr {
+ LazyOffsetPtr &operator=(uint64_t Offset) {
+ assert((Offset << 1 >> 1) == Offset && "Offsets must require < 63 bits");
+ if (Offset == 0)
+- SetPtr(NULL);
++ SetPtr(nullptr);
+ else
+ SetU64((Offset << 1) | 0x01);
+
+@@ -378,12 +378,12 @@ struct LazyOffsetPtr {
+ /// Whether this pointer is non-NULL.
+ ///
+ /// This operation does not require the AST node to be deserialized.
+- explicit operator bool() const { return isOffset() || GetPtr() != NULL; }
++ explicit operator bool() const { return isOffset() || GetPtr() != nullptr; }
+
+ /// Whether this pointer is non-NULL.
+ ///
+ /// This operation does not require the AST node to be deserialized.
+- bool isValid() const { return isOffset() || GetPtr() != NULL; }
++ bool isValid() const { return isOffset() || GetPtr() != nullptr; }
+
+ /// Whether this pointer is currently stored as an offset.
+ bool isOffset() const { return GetLSB() & 0x01; }
diff --git a/user/clang/cfe-005-ppc64-dynamic-linker-path.patch b/user/clang/cfe-005-ppc64-dynamic-linker-path.patch
index b4c41b1c3..0238ca5c6 100644
--- a/user/clang/cfe-005-ppc64-dynamic-linker-path.patch
+++ b/user/clang/cfe-005-ppc64-dynamic-linker-path.patch
@@ -1,6 +1,6 @@
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -596,12 +596,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+@@ -551,12 +551,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
Loader = "ld.so.1";
break;
case llvm::Triple::ppc64:
diff --git a/user/clang/pmmx-musl.patch b/user/clang/pmmx-musl.patch
deleted file mode 100644
index 2a3803349..000000000
--- a/user/clang/pmmx-musl.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- cfe-8.0.0.src/lib/Driver/ToolChains/Linux.cpp.old 2018-11-29 18:52:22.000000000 +0000
-+++ cfe-8.0.0.src/lib/Driver/ToolChains/Linux.cpp 2019-06-01 23:22:27.015221397 +0000
-@@ -534,6 +534,9 @@
- ArchName = "armeb";
- IsArm = true;
- break;
-+ case llvm::Triple::x86:
-+ ArchName = "i386";
-+ break;
- default:
- ArchName = Triple.getArchName().str();
- }
diff --git a/user/clang/ppc-dirwatcher.patch b/user/clang/ppc-dirwatcher.patch
new file mode 100644
index 000000000..35587152f
--- /dev/null
+++ b/user/clang/ppc-dirwatcher.patch
@@ -0,0 +1,10 @@
+Doesn't work on PowerPC.
+
+--- clang-14.0.6.src/unittests/DirectoryWatcher/CMakeLists.txt.old 2022-06-22 16:46:24.000000000 +0000
++++ clang-14.0.6.src/unittests/DirectoryWatcher/CMakeLists.txt 2022-12-05 01:14:23.863133395 +0000
+@@ -1,4 +1,4 @@
+-if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME STREQUAL Windows)
++if(APPLE OR (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT (CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc")) OR CMAKE_SYSTEM_NAME STREQUAL Windows)
+
+ set(LLVM_LINK_COMPONENTS
+ Support
diff --git a/user/clang/ppc64-elfv2.patch b/user/clang/ppc64-elfv2.patch
deleted file mode 100644
index 236bd9ae8..000000000
--- a/user/clang/ppc64-elfv2.patch
+++ /dev/null
@@ -1,38 +0,0 @@
---- cfe-8.0.0.src/lib/Basic/Targets/PPC.h.old 2019-02-12 11:19:21.000000000 +0000
-+++ cfe-8.0.0.src/lib/Basic/Targets/PPC.h 2019-06-01 23:18:07.613180102 +0000
-@@ -367,7 +367,7 @@
- ABI = "elfv2";
- } else {
- resetDataLayout("E-m:e-i64:64-n32:64");
-- ABI = "elfv1";
-+ ABI = (Triple.getEnvironment() == llvm::Triple::Musl) ? "elfv2" : "elfv1";
- }
-
- switch (getTriple().getOS()) {
-@@ -375,6 +375,15 @@
- LongDoubleWidth = LongDoubleAlign = 64;
- LongDoubleFormat = &llvm::APFloat::IEEEdouble();
- break;
-+ default:
-+ break;
-+ }
-+
-+ switch (getTriple().getEnvironment()) {
-+ case llvm::Triple::Musl:
-+ LongDoubleWidth = LongDoubleAlign = 64;
-+ LongDoubleFormat = &llvm::APFloat::IEEEdouble();
-+ break;
- default:
- break;
- }
---- cfe-8.0.0.src/lib/Driver/ToolChains/Clang.cpp.old 2019-01-25 00:15:41.000000000 +0000
-+++ cfe-8.0.0.src/lib/Driver/ToolChains/Clang.cpp 2019-06-01 23:19:33.973868618 +0000
-@@ -1751,7 +1751,7 @@
- break;
- }
-
-- ABIName = "elfv1";
-+ ABIName = (getToolChain().getTriple().isMusl()) ? "elfv2" : "elfv1";
- break;
- }
- case llvm::Triple::ppc64le:
diff --git a/user/clang/secure-plt.patch b/user/clang/secure-plt.patch
deleted file mode 100644
index 670e845c2..000000000
--- a/user/clang/secure-plt.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- cfe-7.0.1.src/lib/Driver/ToolChains/Arch/PPC.cpp.old 2018-11-29 00:31:15.000000000 +0000
-+++ cfe-7.0.1.src/lib/Driver/ToolChains/Arch/PPC.cpp 2019-03-10 04:37:49.350000000 +0000
-@@ -116,7 +116,7 @@
- const ArgList &Args) {
- if (Args.getLastArg(options::OPT_msecure_plt))
- return ppc::ReadGOTPtrMode::SecurePlt;
-- if (Triple.isOSNetBSD() || Triple.isOSOpenBSD())
-+ if (Triple.isOSNetBSD() || Triple.isOSOpenBSD() || Triple.isMusl())
- return ppc::ReadGOTPtrMode::SecurePlt;
- else
- return ppc::ReadGOTPtrMode::Bss;
diff --git a/user/clang/use-llvm-lit.patch b/user/clang/use-llvm-lit.patch
index f5e10d9d6..5652ff12f 100644
--- a/user/clang/use-llvm-lit.patch
+++ b/user/clang/use-llvm-lit.patch
@@ -1,6 +1,6 @@
--- cfe-6.0.1.src/test/CMakeLists.txt.old 2017-12-12 19:47:40.000000000 +0000
+++ cfe-6.0.1.src/test/CMakeLists.txt 2018-09-13 17:01:03.690000000 +0000
-@@ -126,7 +126,7 @@
+@@ -170,7 +170,7 @@
add_lit_testsuite(check-clang "Running the Clang regression tests"
${CMAKE_CURRENT_BINARY_DIR}