diff options
Diffstat (limited to 'user')
-rw-r--r-- | user/clang/APKBUILD | 16 | ||||
-rw-r--r-- | user/clang/big-endian-32.patch | 52 | ||||
-rw-r--r-- | user/clang/ppc-interp.patch | 33 |
3 files changed, 90 insertions, 11 deletions
diff --git a/user/clang/APKBUILD b/user/clang/APKBUILD index bdc1cdad7..433d79ca3 100644 --- a/user/clang/APKBUILD +++ b/user/clang/APKBUILD @@ -18,6 +18,7 @@ subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs $pkgname-analyzer::noarch" 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 @@ -63,6 +64,18 @@ prepare() { ; 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() { @@ -150,7 +163,8 @@ analyzer() { sha512sums="25eeee9984c8b4d0fbc240df90f33cbb000d3b0414baff5c8982beafcc5e59e7ef18f6f85d95b3a5f60cb3d4cd4f877c80487b5768bc21bc833f107698ad93db llvm-project-18.1.8.src.tar.xz d37d2339a76c21666aa4405b2a620100e6967eb933535b5cea05f5de25a4d75510479443500715529cea38014028741d71553c7b247d5f349a05660133d66bc6 0001-Add-support-for-Ad-lie-Linux.patch +8928e5f4c5c7160ff1c8bf94b49b54198a6472dfbcb125db45fa0f1f0944b956a33af6004a34636d2ce15022a7ef5a8b77158d8093fb2adde889e0e8085067b3 big-endian-32.patch 8272ec0eeb93287c9cc961099139f7cb0f94561befc31a4521387fa5f7216dc4b3d99750c4560a0b71ec4acde5bd776abef733cfafe81058ef054b62f72fc209 cfe-005-ppc64-dynamic-linker-path.patch 0032fdd3864870d345caff9c4ff44f58bebc802bddf06c4b3bf30276c89e237167e6dea03456d322d3f6e2ee5e3a2ecf9f649ed033f0ab078b80bda44371b3ce ppc-dirwatcher.patch -d6de2ed213e2c2a95e6ee68c7c6abe72cad0b97341b221f1c3eed13fc3fbeb95b0a4b07bff9504461d64a659b7f4ea6d61be4ec9ff5c63722b0f41ab135e29a0 ppc-interp.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..298137257 --- /dev/null +++ b/user/clang/big-endian-32.patch @@ -0,0 +1,52 @@ +We need to use uintptr_t, not uint64_t. + +getAddressOfPointer returns a pointer to the Ptr field. When dereferenced on +a 32-bit big endian platform, this will be the first (invalid) 32 bits, not the +actual 32 bits containing the pointer value. This leads to bad things. + +Ref: #1255 +Upstream-URL: https://github.com/llvm/llvm-project/issues/111993 +--- clang/include/clang/AST/ExternalASTSource.h.old 2024-06-15 17:21:32.000000000 +0000 ++++ clang/include/clang/AST/ExternalASTSource.h 2024-10-10 16:54:58.013411406 +0000 +@@ -326,25 +326,25 @@ + /// + /// 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; ++ mutable uintptr_t Ptr = 0; + + public: + LazyOffsetPtr() = default; +- explicit LazyOffsetPtr(T *Ptr) : Ptr(reinterpret_cast<uint64_t>(Ptr)) {} ++ explicit LazyOffsetPtr(T *Ptr) : Ptr(reinterpret_cast<uintptr_t>(Ptr)) {} + +- explicit LazyOffsetPtr(uint64_t Offset) : Ptr((Offset << 1) | 0x01) { +- assert((Offset << 1 >> 1) == Offset && "Offsets must require < 63 bits"); ++ explicit LazyOffsetPtr(uintptr_t Offset) : Ptr((Offset << 1) | 0x01) { ++ assert((Offset << 1 >> 1) == Offset && "Offsets must fit in addressable bits"); + if (Offset == 0) + Ptr = 0; + } + + LazyOffsetPtr &operator=(T *Ptr) { +- this->Ptr = reinterpret_cast<uint64_t>(Ptr); ++ this->Ptr = reinterpret_cast<uintptr_t>(Ptr); + return *this; + } + +- LazyOffsetPtr &operator=(uint64_t Offset) { +- assert((Offset << 1 >> 1) == Offset && "Offsets must require < 63 bits"); ++ LazyOffsetPtr &operator=(uintptr_t Offset) { ++ assert((Offset << 1 >> 1) == Offset && "Offsets must fit in addressable bits"); + if (Offset == 0) + Ptr = 0; + else +@@ -375,7 +375,7 @@ + if (isOffset()) { + assert(Source && + "Cannot deserialize a lazy pointer without an AST source"); +- Ptr = reinterpret_cast<uint64_t>((Source->*Get)(Ptr >> 1)); ++ Ptr = reinterpret_cast<uintptr_t>((Source->*Get)(Ptr >> 1)); + } + return reinterpret_cast<T*>(Ptr); + } diff --git a/user/clang/ppc-interp.patch b/user/clang/ppc-interp.patch index bc2905f42..fae58aa3d 100644 --- a/user/clang/ppc-interp.patch +++ b/user/clang/ppc-interp.patch @@ -9,14 +9,27 @@ implemented in RuntimeDyld. // clang-format off // RUN: clang-repl "int i = 10;" '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 -@@ -270,7 +270,7 @@ - return R.getFoundDecl(); - } +--- 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 @@ --#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC -+#if defined(CLANG_INTERPRETER_NO_SUPPORT_EXEC) || (!defined(__powerpc64__) && defined(__powerpc__)) - TEST(IncrementalProcessing, DISABLED_InstantiateTemplate) { - #else - TEST(IncrementalProcessing, InstantiateTemplate) { + using namespace clang; + +-#if defined(_AIX) ++#if defined(_AIX) || (!defined(__powerpc64__) && defined(__powerpc__)) + #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. |