[PATCH] D155672: [JITLink][PowerPC] Correct handling of R_PPC64_REL24_NOTOC

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 22:43:59 PDT 2023


lkail created this revision.
lkail added reviewers: PowerPC, lhames, MaskRay, stefanp, sfertile, nemanjai.
Herald added subscribers: shchenz, kbarton, hiraditya.
Herald added a project: All.
lkail requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

According to the ELFv2 ABI

> This relocation type is used to specify a function call where the TOC pointer is not initialized. It is

similar to R_PPC64_REL24 in that it specifies a symbol to be resolved. If the symbol resolves to a function that requires a TOC pointer (as determined by st_other bits) then a link editor must arrange
for the call to be via the global entry point of the called function. Any stub code must not rely on a
valid TOC base address in r2.

This patch fixes handling of `R_PPC64_REL24_NOTOC` by using the same stub code sequence as lld.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155672

Files:
  llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
  llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp
  llvm/lib/ExecutionEngine/JITLink/ppc64.cpp
  llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64le_relocations.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155672.541842.patch
Type: text/x-patch
Size: 10165 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230719/ce35cbaa/attachment.bin>


More information about the llvm-commits mailing list