summaryrefslogtreecommitdiff
path: root/user/llvm14/dyld-elf-ppc32.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2022-11-28 23:40:21 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2022-11-28 23:44:16 -0600
commit2ca2069f91c77a186e098c0ae391b379cab594cc (patch)
treeccb7df3b200b4cfea490780974f6a736878ea4a0 /user/llvm14/dyld-elf-ppc32.patch
parente78459be10169c4bd2499648a23e2935873a3e13 (diff)
downloadpackages-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/llvm14/dyld-elf-ppc32.patch')
-rw-r--r--user/llvm14/dyld-elf-ppc32.patch24
1 files changed, 24 insertions, 0 deletions
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;
+ }
+ }
+