RuntimeDyldELF implements many PPC64 relocations but none for PPC32. This patch adapts (copies, really) from PPC64 the code for two relocations that can be used to access global variables like in the attached test case.
I don't know how the JIT is tested for the PPC target. There only seem to be X86 and ARM tests in test/ExecutionEngine/RuntimeDyld
That's not good. The generic MCJIT tests are run on PPC64, but otherwise I don't know.
Can you please add a test for this patch (in test/ExecutionEngine/RuntimeDyld sounds good if that's easiest) -- (just remember that the new directory needs a lit.local.cfg file, like the others, that tests for 'PowerPC').
This can be isInt<32>(delta).
Thanks for looking at the patch.
I have added a llvm-rtdyld testcase for 'R_PPC_ADDR16_LO' and 'R_PPC_ADDR16_HA' relocation types. It seems to work on my VM by running the commands manually. I haven't got around to test it with 'lit' yet however, as I currently cross-compile LLVM outside of the VM.
I also removed the code for 'R_PPC_REL32' since it is not exercised by the test case. It will be part of another patch once I write a test case for it.
Sorry for the long hiatus. I have removed the .ll file that was used to generate the assembyl file, and ran the test on a PPC VM:
- Testing: 1 tests, 1 threads --
PASS: LLVM :: ExecutionEngine/RuntimeDyld/PowerPC/ppc32_elf_rel_addr16.s (1 of 1)
Testing Time: 0.42s
Expected Passes : 1
Do you see any other issue with the patch?