[PATCH] D154198: [JITLink][PowerPC] Add TOC and relocations for ppc64
Lang Hames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 4 16:45:08 PDT 2023
lhames added a comment.
Thanks very much @lkail!
I just tested this out locally and it's exciting to see nontrivial test cases running.
================
Comment at: llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h:112-117
+ case RequestToBeGOTEntry: {
+ this->appendEntry(
+ E.getTarget(),
+ G.addAnonymousSymbol(*B, 0, G.getPointerSize(), false, false));
+ E.setKind(ppc64::Pointer64);
+ return true;
----------------
Just to make sure I follow:
`ELFLinkGraphBuilder_ppc64` converts `R_PPC64_ADDR64` to `RequestToBeGOTEntry` when it's a relocation _from_ a preexisting GOT entry in the object file?
Rather than using a special edge kind, could we walk the `.toc` section in the `buildTables_ELF_ppc64` function to pre-register the entries before calling `visitExistingEdges`? Would that allow us to drop the `RequestToBeGOTEntry` edge kind and use `Pointer64` unconditionally for `R_PPC64_ADDR64`?
I'm imagining something like:
```
template <support::endianness Endianness>
Error buildTables_ELF_ppc64(LinkGraph &G) {
LLVM_DEBUG(dbgs() << "Visiting edges in graph:\n");
ppc64::TOCTableManager<Endianness> TOC;
// Register preexisting GOT entries with TOC table manager.
if (auto *dotTOCSection = G.findSectionByName(".toc")) {
for (<each GOT entry>)
TOC.appendEntry(<entry target>, <entry symbol>);
}
ppc64::PLTTableManager<Endianness> PLT(TOC);
createELFGOTHeader(G, TOC);
visitExistingEdges(G, TOC, PLT);
...
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154198/new/
https://reviews.llvm.org/D154198
More information about the llvm-commits
mailing list