[PATCH] D54917: [ELF] Comment about retpoline IPLT in getPltVA
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 26 14:20:27 PST 2018
MaskRay created this revision.
MaskRay added reviewers: ruiu, emaste.
Herald added subscribers: llvm-commits, arichardson.
Herald added a reviewer: espindola.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D54917
Files:
ELF/Symbols.cpp
ELF/Target.h
Index: ELF/Target.h
===================================================================
--- ELF/Target.h
+++ ELF/Target.h
@@ -45,8 +45,8 @@
virtual void addPltHeaderSymbols(InputSection &IS) const {}
virtual void addPltSymbols(InputSection &IS, uint64_t Off) const {}
- unsigned getPltEntryOffset(unsigned Index) const {
- return Index * PltEntrySize + PltHeaderSize;
+ unsigned getPltEntryOffset(unsigned Index, bool Header = true) const {
+ return (Header ? PltHeaderSize : 0) + Index * PltEntrySize;
}
// Returns true if a relocation only uses the low bits of a value such that
Index: ELF/Symbols.cpp
===================================================================
--- ELF/Symbols.cpp
+++ ELF/Symbols.cpp
@@ -145,9 +145,9 @@
uint64_t Symbol::getPltVA() const {
if (this->IsInIplt) {
- if (Config->ZRetpolineplt)
- return In.Iplt->getVA() + Target->getPltEntryOffset(PltIndex);
- return In.Iplt->getVA() + PltIndex * Target->PltEntrySize;
+ // Normal IPLT does not have a header but retpoline IPLT has one.
+ return In.Iplt->getVA() +
+ Target->getPltEntryOffset(PltIndex, Config->ZRetpolineplt);
}
return In.Plt->getVA() + Target->getPltEntryOffset(PltIndex);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54917.175341.patch
Type: text/x-patch
Size: 1233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181126/5256cd78/attachment.bin>
More information about the llvm-commits
mailing list