[llvm-branch-commits] [lld] [ELF][PowerPC] Don't assume TOC pointer is valid in IPLT entries (PR #207555)
Fangrui Song via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jul 23 10:47:13 PDT 2026
================
@@ -1326,34 +1327,52 @@ void elf::writePPC32PltCallStub(Ctx &ctx, uint8_t *buf, uint64_t gotPltVA,
return;
}
uint32_t offset;
- if (addend >= 0x8000) {
+ uint32_t reg;
+ if (!addend) {
+ // We're a (position-independent) IPLT entry, so cannot assume anything
+ // about what value the caller left in r30 as this could be an indirect
+ // call.
+ write32(ctx, buf + 0, 0x7c0802a6); // mflr r0
+ write32(ctx, buf + 4, 0x429f0005); // bcl 20, 31, 1f
+ write32(ctx, buf + 8, 0x7d6802a6); // 1: mflr r11
+ write32(ctx, buf + 12, 0x7c0803a6); // mtlr r0
+ offset = gotPltVA - p - 8;
+ reg = 11;
+ buf += 16;
+ p += 16;
----------------
MaskRay wrote:
Is this dead?
https://github.com/llvm/llvm-project/pull/207555
More information about the llvm-branch-commits
mailing list