[llvm] [BOLT][RISCV] Preserve distinct IPLT entries for IFUNC aliases and fix RISC-V call targets (PR #222901)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 11 03:07:14 PDT 2026


================
@@ -1930,37 +1901,21 @@ void RewriteInstance::createPLTBinaryFunction(uint64_t TargetAddress,
     Symbol = TargetBF->getSymbol();
   }
 
+  // Distinct PLT/GOT entries must not reuse an MCSymbol, even when their
+  // IRELATIVE addends identify the same resolver.
+  std::string Name = Symbol->getName().str();
+  if (const BinaryData *BD = BC->getBinaryDataByName(Name + "@PLT"))
+    if (BD->getAddress() != EntryAddress)
+      Name += ".0x" + Twine::utohexstr(EntryAddress).str();
----------------
Thrrreeee wrote:

Different IPLT entries may share the same IFUNC resolver, but they must use distinct PLT/GOT symbols. Otherwise, reusing the same symbol could cause both IPLT entries to reference the same GOT slot. The address suffix prevents this symbol collision.

Although this may not affect runtime behavior when both GOT entries resolve to the same implementation, the distinct IPLT/GOT entries should still use separate symbols?

https://github.com/llvm/llvm-project/pull/222901


More information about the llvm-commits mailing list