diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2022-11-28 23:40:21 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2022-11-28 23:44:16 -0600 |
commit | 2ca2069f91c77a186e098c0ae391b379cab594cc (patch) | |
tree | ccb7df3b200b4cfea490780974f6a736878ea4a0 /user | |
parent | e78459be10169c4bd2499648a23e2935873a3e13 (diff) | |
download | packages-2ca2069f91c77a186e098c0ae391b379cab594cc.tar.gz packages-2ca2069f91c77a186e098c0ae391b379cab594cc.tar.bz2 packages-2ca2069f91c77a186e098c0ae391b379cab594cc.tar.xz packages-2ca2069f91c77a186e098c0ae391b379cab594cc.zip |
user/llvm14: Fix tests on 32-bit machines
* DWARF info patch fixes issue seen on ARMv7 and PPC.
* Dyld patch fixes OrcJIT on PPC (also needed for mesa).
* MachO fix is being sent upstream and affects all 32-bit CPUs.
* PPC test fix is already upstream, backported to 14 branch.
Fixes: #846
Diffstat (limited to 'user')
-rw-r--r-- | user/llvm14/APKBUILD | 14 | ||||
-rw-r--r-- | user/llvm14/dwarf-info.patch | 28 | ||||
-rw-r--r-- | user/llvm14/dyld-elf-ppc32.patch | 24 | ||||
-rw-r--r-- | user/llvm14/macho32.patch | 17 | ||||
-rw-r--r-- | user/llvm14/ppc-test.patch | 13 |
5 files changed, 90 insertions, 6 deletions
diff --git a/user/llvm14/APKBUILD b/user/llvm14/APKBUILD index 10fb0a493..2150a522a 100644 --- a/user/llvm14/APKBUILD +++ b/user/llvm14/APKBUILD @@ -23,8 +23,12 @@ source="https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver/l llvm-fix-build-with-musl-libc.patch disable-FileSystemTest.CreateDir-perms-assert.patch disable-dlclose-test.patch + dwarf-info.patch + dyld-elf-ppc32.patch hexagon.patch + macho32.patch musl-ppc64-elfv2.patch + ppc-test.patch python3-test.patch roundeven.patch " @@ -71,12 +75,6 @@ prepare() { rm test/tools/llvm-symbolizer/print_context.c case $CARCH in - pmmx|x86) - # https://github.com/llvm/llvm-project/issues/56746 - rm test/Object/macho-invalid.test;; - esac - - case $CARCH in pmmx|x86|ppc|armhf|armv7) # Appears to not work when building 32-bit code on 64-bit host. rm test/tools/llvm-size/radix.test;; @@ -245,7 +243,11 @@ sha512sums="6461bdde27aac17fa44c3e99a85ec47ffb181d0d4e5c3ef1c4286a59583e3b0c51af f84cd65d7042e89826ba6e8d48c4c302bf4980da369d7f19a55f217e51c00ca8ed178d453df3a3cee76598a7cecb94aed0775a6d24fe73266f82749913fc3e71 llvm-fix-build-with-musl-libc.patch 49c47f125014b60d0ea7870f981a2c1708ad705793f89287ed846ee881a837a4dc0170bf467e03f2ef56177473128945287749ac80dc2d13cfabcf8b929ba58a disable-FileSystemTest.CreateDir-perms-assert.patch caeec8e4dbd92f5f74940780b69075f3879a267a8623822cbdc193fd14706eb089071e3a5a20d60cc2eca59e4c5b2a61d29827a2f3362ee7c5f74f11d9ace200 disable-dlclose-test.patch +9d767d8d9096a655009fe5c55bb66a668ed6a4a3b62e7cfa03fa661c38cb835cee985b447adea021fb69402c81e7cdf3adbf60f78ab4fbcfe23931f147d3088e dwarf-info.patch +5fa36157f7a76ca70d22af7bd96850db454d6add3a19cc3272962633c453087015755ca9df0de29cc40359e89279e470e91ff1a69d1453596a73291b36f39b23 dyld-elf-ppc32.patch 9abe376068801a09b2af01eef0cd319f48862b5ff7cce62af3cf4e7597a0898842125ae574577b545734ec1381f192b924b4f717a9c094f119e32ada81a2b9a2 hexagon.patch +de9791cc476817782b553c4edab696132da4ed2b9a3d80dbf1b85b7dc7a8c5e4caf14f2f26e33c27cd80a91b36709d3b24caea910c0a6315ffbb297cb748468d macho32.patch e5ddbc4b6c4928e79846dc3c022eb7928aaa8fed40515c78f5f03b8ab8264f34f1eb8aa8bfc0f436450932f4917e54ad261603032092ea271d9590f11a37cf1e musl-ppc64-elfv2.patch +62de403e4cfd58d9f33f8b35ff31f66c906fd39c667fbcfa394d03f636fb10977c2f53c3a780d0c8e099f9a081951402757e12842d82a7cbd1aef4158f51d5c2 ppc-test.patch 89ef5fbab039b017a5652656adf17b680525f1c5dd0b1afc8034fe0b34a2ca196d87640f54cc826356cfcd88c6e5f10754b7e38f04ca49ede4f3864080b787bd python3-test.patch dca77af49ea181ab8d41630b8e7575b83aac22686a1119479abf8fe22d8f13032d69ef83a9635b9ad9b935cd3b51251d939e05967ad40db43abf69ac40e0eccd roundeven.patch" diff --git a/user/llvm14/dwarf-info.patch b/user/llvm14/dwarf-info.patch new file mode 100644 index 000000000..44b9e88ad --- /dev/null +++ b/user/llvm14/dwarf-info.patch @@ -0,0 +1,28 @@ +Author: A. Wilcox <awilfox@adelielinux.org> + +This isn't the proper fix, but debugging the LLVM formatter is a bit +above my paygrade at the moment. + +The issue shows up in the DWARF X86 test on ppc and armv7: + +error: Simplified template DW_AT_name could not be reconstituted: + original: f3<char, '\x00', '\x01', '\x06', '\a', '\r', '\x0e', '\x1f', ' ', '!', '\x7f', '\x80'> + reconstituted: f3<char, '\x00', '\x00', '\x00', '\a', '\r', '\x00', '\x00', ' ', '!', '\x00', '\x00'> + +With this patch, this error does not occur. Debugging shows that the +llvm::format overload called in the error case is <long long>, so I +think it is having an issue converting a 64-bit value on platforms +where char is default-unsigned. + +(pmmx does not show this issue, and has signed char.) +--- llvm-14.0.6.src/lib/DebugInfo/DWARF/DWARFDie.cpp.old 2022-06-22 16:46:24.000000000 +0000 ++++ llvm-14.0.6.src/lib/DebugInfo/DWARF/DWARFDie.cpp 2022-11-28 10:32:05.573627744 +0000 +@@ -506,7 +506,7 @@ + OS << (char)Val; + OS << "'"; + } else if (Val < 256) +- OS << to_string(llvm::format("'\\x%02x'", Val)); ++ OS << to_string(llvm::format("'\\x%02x'", (char)Val)); + else if (Val <= 0xFFFF) + OS << to_string(llvm::format("'\\u%04x'", Val)); + else diff --git a/user/llvm14/dyld-elf-ppc32.patch b/user/llvm14/dyld-elf-ppc32.patch new file mode 100644 index 000000000..badea265f --- /dev/null +++ b/user/llvm14/dyld-elf-ppc32.patch @@ -0,0 +1,24 @@ +Author: A. Wilcox <awilfox@adelielinux.org> +Upstream-Status: Pending + +This implements the R_PPC_REL32 relocation type, which is needed for the +OrcJIT to work properly on 32-bit PowerPC. + +Needs more tests before submitting upstream, but seems to DTRT. + +--- llvm-14.0.6.src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp.old 2022-06-22 16:46:24.000000000 +0000 ++++ llvm-14.0.6.src/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp 2022-11-28 06:33:12.239921624 +0000 +@@ -818,6 +818,13 @@ + case ELF::R_PPC_ADDR16_HA: + writeInt16BE(LocalAddress, applyPPCha(Value + Addend)); + break; ++ case ELF::R_PPC_REL32: ++ uint32_t FinalAddress = Section.getLoadAddressWithOffset(Offset); ++ int64_t delta = static_cast<int64_t>(Value - FinalAddress + Addend); ++ if (SignExtend64<32>(delta) != delta) ++ llvm_unreachable("Relocation R_PPC_REL32 overflow"); ++ writeInt32BE(LocalAddress, delta); ++ break; + } + } + diff --git a/user/llvm14/macho32.patch b/user/llvm14/macho32.patch new file mode 100644 index 000000000..31279d502 --- /dev/null +++ b/user/llvm14/macho32.patch @@ -0,0 +1,17 @@ +Use integer offset math instead of pointer math to determine load +command bounds. + +Upstream-URL: https://github.com/llvm/llvm-project/issues/56746 + +--- llvm-14.0.6.src/lib/Object/MachOObjectFile.cpp.old 2022-06-22 16:46:24.000000000 +0000 ++++ llvm-14.0.6.src/lib/Object/MachOObjectFile.cpp 2022-11-28 04:21:02.730211841 +0000 +@@ -190,7 +190,8 @@ + getLoadCommandInfo(const MachOObjectFile &Obj, const char *Ptr, + uint32_t LoadCommandIndex) { + if (auto CmdOrErr = getStructOrErr<MachO::load_command>(Obj, Ptr)) { +- if (CmdOrErr->cmdsize + Ptr > Obj.getData().end()) ++ uint64_t Offset = Ptr - Obj.getData().begin(); ++ if (CmdOrErr->cmdsize + Offset > Obj.getData().size()) + return malformedError("load command " + Twine(LoadCommandIndex) + + " extends past end of file"); + if (CmdOrErr->cmdsize < 8) diff --git a/user/llvm14/ppc-test.patch b/user/llvm14/ppc-test.patch new file mode 100644 index 000000000..46ed8fbf0 --- /dev/null +++ b/user/llvm14/ppc-test.patch @@ -0,0 +1,13 @@ +The ifdef tree uses __powerpc__ so 32-bit PPC is supported as well. + +--- llvm-14.0.6.src/unittests/Support/Host.cpp.old 2022-06-22 16:46:24.000000000 +0000 ++++ llvm-14.0.6.src/unittests/Support/Host.cpp 2022-11-28 02:15:41.512865406 +0000 +@@ -40,7 +40,7 @@ + // some systems. + return (Host.isOSWindows() && llvm_is_multithreaded()) || + Host.isOSDarwin() || (Host.isX86() && Host.isOSLinux()) || +- (Host.isPPC64() && Host.isOSLinux()) || ++ (Host.isPPC() && Host.isOSLinux()) || + (Host.isSystemZ() && (Host.isOSLinux() || Host.isOSzOS())); + } + |