[PATCH] D154198: [JITLink][PowerPC] Add TOC and relocations for ppc64
Kai Luo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 4 22:51:52 PDT 2023
lkail added inline comments.
================
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;
----------------
lhames wrote:
> 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);
> ...
> ```
> ELFLinkGraphBuilder_ppc64 converts R_PPC64_ADDR64 to RequestToBeGOTEntry when it's a relocation _from_ a preexisting GOT entry in the object file?
Yes, that's the case.
> 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?
That sounds nice.
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