diff options
Diffstat (limited to 'user/clang')
-rw-r--r-- | user/clang/0001-Add-support-for-Ad-lie-Linux.patch | 18 | ||||
-rw-r--r-- | user/clang/APKBUILD | 47 | ||||
-rw-r--r-- | user/clang/big-endian-32.patch | 183 | ||||
-rw-r--r-- | user/clang/cfe-005-ppc64-dynamic-linker-path.patch | 2 | ||||
-rw-r--r-- | user/clang/ppc-interp.patch | 42 | ||||
-rw-r--r-- | user/clang/ppc64-elfv2.patch | 11 | ||||
-rw-r--r-- | user/clang/use-llvm-lit.patch | 2 |
7 files changed, 247 insertions, 58 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 a6fbcdd3f..9f2612440 100644 --- a/user/clang/0001-Add-support-for-Ad-lie-Linux.patch +++ b/user/clang/0001-Add-support-for-Ad-lie-Linux.patch @@ -24,7 +24,7 @@ index 7b34a09256..7a3774a4f1 100644 AlpineLinux, ArchLinux, DebianLenny, -@@ -130,3 +130,5 @@ public: +@@ -134,3 +135,5 @@ public: } + bool IsAdelieLinux() const { return DistroVal == AdelieLinux; } @@ -36,7 +36,7 @@ index 2c4d44faf8..7ef35ab379 100644 +++ b/lib/Driver/Distro.cpp @@ -36,6 +36,7 @@ for (StringRef Line : Lines) - if (Version == Distro::UnknownDistro && Line.startswith("ID=")) + if (Version == Distro::UnknownDistro && Line.starts_with("ID=")) Version = llvm::StringSwitch<Distro::DistroType>(Line.substr(3)) + .Case("adelie", Distro::AdelieLinux) .Case("alpine", Distro::AlpineLinux) @@ -44,9 +44,9 @@ index 2c4d44faf8..7ef35ab379 100644 .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 -@@ -188,13 +188,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()) { @@ -60,13 +60,3 @@ index 2c4d44faf8..7ef35ab379 100644 ExtraOpts.push_back("-z"); ExtraOpts.push_back("relro"); } -@@ -234,7 +234,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/APKBUILD b/user/clang/APKBUILD index d829f0032..7d8f46369 100644 --- a/user/clang/APKBUILD +++ b/user/clang/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: A. Wilcox <awilfox@adelielinux.org> pkgname=clang # Note: Update together with llvm. -pkgver=14.0.6 +pkgver=18.1.8 pkgrel=0 _llvmver=${pkgver%%.*} pkgdesc="A C language family front-end for LLVM" @@ -16,16 +16,15 @@ makedepends="cmake isl-dev libedit-dev libexecinfo-dev libxml2-dev libxml2-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/$pkgname-$pkgver.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/llvm-$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 + big-endian-32.patch cfe-005-ppc64-dynamic-linker-path.patch ppc-dirwatcher.patch ppc-interp.patch - ppc64-elfv2.patch use-llvm-lit.patch " -builddir="$srcdir/$pkgname-$pkgver.src" +builddir="$srcdir/llvm-project-$pkgver.src/$pkgname" prepare() { default_prepare @@ -63,12 +62,32 @@ prepare() { 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 + + case $CARCH in + ppc) + for _interp_test in code-undo.cpp const.cpp execute-stmts.cpp \ + execute-weak.cpp execute.cpp fail.cpp global-dtor.cpp \ + inline-virtual.cpp lambda.cpp multiline.cpp \ + simple-exception.cpp; do + rm test/Interpreter/$_interp_test + done;; + esac } 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} \ @@ -80,7 +99,7 @@ build() { -DLLVM_ENABLE_EH=ON \ -DLLVM_ENABLE_RTTI=ON \ -DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src" \ - -DLLVM_EXTERNAL_LIT="$builddir/build/bin/llvm-lit" \ + -DLLVM_EXTERNAL_LIT="/usr/lib/llvm$_llvmver/bin/lit" \ -Bbuild \ . @@ -94,7 +113,6 @@ build() { } check() { - [ -f build/bin/llvm-lit ] || ln -s /usr/bin/lit build/bin/llvm-lit make -C build check-clang } @@ -143,11 +161,10 @@ analyzer() { mv usr/share/scan-* "$subpkgdir"/usr/share/ } -sha512sums="5f5497b57dd116225e90f321902f1015beb50c0b1bb90d0fc6c026f13aa748feabe44f98eb75e86f98f3b1785ad5e850210732f3eae75b942ecd520527dcd30b clang-14.0.6.src.tar.xz -6461bdde27aac17fa44c3e99a85ec47ffb181d0d4e5c3ef1c4286a59583e3b0c51af3c8081a300f45b99524340773a3011380059e3b3a571c3b0a8733e96fc1d llvm-14.0.6.src.tar.xz -7f422f671167498102789e8c0b3ab4e46d6a4433d89f0f6b2cf0736ad257146e5eeb04b6f1d9431cce4635c9691d0cc80e643f852269bf7119ce312ae9bb8068 0001-Add-support-for-Ad-lie-Linux.patch -b3c999ef1e380b02a25f1ebca4811f1c696b88309b73af0c19865e3b92084becc9529b910d24b4fb7133606c1e105860104017406d876f95e9260c716348bd1c cfe-005-ppc64-dynamic-linker-path.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 -0d8f77100cd8550be0dc251704081574b0cdc46169df1428ad8cc9f689cdaa47adcd9ff45a816e238ee279395036c7548bf1033307aabbb3a62cce9f360698eb ppc-interp.patch -4f534e72cf3ec9134d9f77a1a787c84859a5ee84b52da529d47745eb7d75d383070573018588bfbf622e826fcb281fdf20fa79217024df5cb824e6ae1ea1d7bf ppc64-elfv2.patch -1f93918d512849e8bf7eb4e71d2b623c0ae3361e4b6ed5b50b76b0fe78e3d70f8773061b1ea0f327950a4f7c2ffdcdaafcb224301732df2a7469c742e8f5883f use-llvm-lit.patch" +a2d90bcfc7cee261d6c8ac3b5dd011f55eab94deff456b63c5ef3598397e358b271e7ae86dec9e56c09c874736645ffbecccde4d31826d9b20908a4a16c61387 ppc-interp.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 eadc65bfa..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 -@@ -485,12 +485,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/ppc-interp.patch b/user/clang/ppc-interp.patch index a8cb6bc90..fae58aa3d 100644 --- a/user/clang/ppc-interp.patch +++ b/user/clang/ppc-interp.patch @@ -3,23 +3,33 @@ implemented in RuntimeDyld. --- clang-14.0.6.src/test/Interpreter/execute.cpp.old 2022-06-22 16:46:24.000000000 +0000 +++ clang-14.0.6.src/test/Interpreter/execute.cpp 2022-12-05 01:04:26.517960246 +0000 -@@ -1,7 +1,7 @@ - // RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \ - // RUN: 'auto r1 = printf("i = %d\n", i);' | FileCheck --check-prefix=CHECK-DRIVER %s - // REQUIRES: host-supports-jit +@@ -1,4 +1,4 @@ -// UNSUPPORTED: system-aix +// UNSUPPORTED: system-aix, powerpc- - // CHECK-DRIVER: i = 10 - // RUN: cat %s | clang-repl | FileCheck %s - extern "C" int printf(const char *, ...); ---- clang-14.0.6.src/unittests/Interpreter/InterpreterTest.cpp.old 2022-06-22 16:46:24.000000000 +0000 -+++ clang-14.0.6.src/unittests/Interpreter/InterpreterTest.cpp 2022-12-05 01:53:47.058187317 +0000 -@@ -205,7 +205,7 @@ - return R.getFoundDecl(); - } --#ifdef _AIX + // clang-format off + // RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \ +--- clang/unittests/Interpreter/InterpreterTest.cpp.old 2024-10-10 18:11:05.390017076 +0000 ++++ clang/unittests/Interpreter/InterpreterTest.cpp 2024-10-10 22:34:07.176019197 +0000 +@@ -30,7 +30,7 @@ + + using namespace clang; + +-#if defined(_AIX) +#if defined(_AIX) || (!defined(__powerpc64__) && defined(__powerpc__)) - TEST(IncrementalProcessing, DISABLED_InstantiateTemplate) { - #else - TEST(IncrementalProcessing, InstantiateTemplate) { + #define CLANG_INTERPRETER_NO_SUPPORT_EXEC + #endif + +--- clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp.old 2024-06-15 17:21:32.000000000 +0000 ++++ clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp 2024-10-10 22:36:53.358466534 +0000 +@@ -113,8 +113,8 @@ + if (Triple.isOSAIX()) + GTEST_SKIP(); + +- // FIXME: ARM fails due to `Not implemented relocation type!` +- if (Triple.isARM()) ++ // FIXME: ARM and PPC32 fail due to `Not implemented relocation type!` ++ if (Triple.isARM() || Triple.isPPC32()) + GTEST_SKIP(); + + // FIXME: libunwind on darwin is broken, see PR49692. diff --git a/user/clang/ppc64-elfv2.patch b/user/clang/ppc64-elfv2.patch deleted file mode 100644 index 7c5ef421c..000000000 --- a/user/clang/ppc64-elfv2.patch +++ /dev/null @@ -1,11 +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 -@@ -427,7 +427,7 @@ - ABI = "elfv2"; - } else { - DataLayout = "E-m:e-i64:64-n32:64"; -- ABI = "elfv1"; -+ ABI = (Triple.getEnvironment() == llvm::Triple::Musl) ? "elfv2" : "elfv1"; - } - - if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) { diff --git a/user/clang/use-llvm-lit.patch b/user/clang/use-llvm-lit.patch index 4ce2bedde..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 -@@ -164,7 +164,7 @@ +@@ -170,7 +170,7 @@ add_lit_testsuite(check-clang "Running the Clang regression tests" ${CMAKE_CURRENT_BINARY_DIR} |