[llvm] [BOLT][RISCV] Handle static IFUNC calls through .iplt (PR #207733)
Kito Cheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 31 02:08:28 PDT 2026
================
@@ -1910,6 +1934,25 @@ void RewriteInstance::createPLTBinaryFunction(uint64_t TargetAddress,
else
BF->addAlternativeName(Symbol->getName().str() + "@PLT");
setPLTSymbol(BF, Symbol->getName());
+
+ // Keep RISC-V alias recovery local to the new path so the established x86
+ // and AArch64 PLT naming behavior remains unchanged.
+ if (BC->isRISCV() && Rel->isIRelative()) {
+ auto ResolverSyms = FileSymRefs.equal_range(Rel->Addend);
+ for (const SymbolRef &AliasSymbol : llvm::make_second_range(
+ llvm::make_range(ResolverSyms.first, ResolverSyms.second))) {
+ if (ELFSymbolRef(AliasSymbol).getELFType() != ELF::STT_GNU_IFUNC)
+ continue;
+ StringRef AliasName = cantFail(AliasSymbol.getName());
+ const std::string PLTName = AliasName.str() + "@PLT";
+ if (!BC->getBinaryDataByName(PLTName)) {
+ BF->addAlternativeName(PLTName);
+ BC->registerNameAtAddress(PLTName, EntryAddress, EntrySize,
+ Section->getAlignment());
+ }
+ setPLTSymbol(BF, AliasName);
+ }
+ }
----------------
kito-cheng wrote:
Could you explain this in more detail? I'm not sure if I understand correctly
https://github.com/llvm/llvm-project/pull/207733
More information about the llvm-commits
mailing list