forked from OSchip/llvm-project
Inline a trivial function. NFC.
I found that hiding this particular actual expression doesn't help readers understand the code. So I remove and inline that function. llvm-svn: 357140
This commit is contained in:
parent
7cd0dad834
commit
a0a50a7a5b
|
@ -139,7 +139,7 @@ void SPARCV9::writePlt(uint8_t *Buf, uint64_t GotEntryAddr,
|
|||
};
|
||||
memcpy(Buf, PltData, sizeof(PltData));
|
||||
|
||||
uint64_t Off = getPltEntryOffset(Index);
|
||||
uint64_t Off = PltHeaderSize + PltEntrySize * Index;
|
||||
relocateOne(Buf, R_SPARC_22, Off);
|
||||
relocateOne(Buf + 4, R_SPARC_WDISP19, -(Off + 4 - PltEntrySize));
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ void X86::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr,
|
|||
}
|
||||
|
||||
write32le(Buf + 7, RelOff);
|
||||
write32le(Buf + 12, -getPltEntryOffset(Index) - 16);
|
||||
write32le(Buf + 12, -PltHeaderSize - PltEntrySize * Index - 16);
|
||||
}
|
||||
|
||||
int64_t X86::getImplicitAddend(const uint8_t *Buf, RelType Type) const {
|
||||
|
@ -474,7 +474,7 @@ void RetpolinePic::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr,
|
|||
memcpy(Buf, Insn, sizeof(Insn));
|
||||
|
||||
uint32_t Ebx = In.GotPlt->getVA();
|
||||
unsigned Off = getPltEntryOffset(Index);
|
||||
unsigned Off = PltHeaderSize + PltEntrySize * Index;
|
||||
write32le(Buf + 3, GotPltEntryAddr - Ebx);
|
||||
write32le(Buf + 8, -Off - 12 + 32);
|
||||
write32le(Buf + 13, -Off - 17 + 18);
|
||||
|
@ -532,7 +532,7 @@ void RetpolineNoPic::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr,
|
|||
};
|
||||
memcpy(Buf, Insn, sizeof(Insn));
|
||||
|
||||
unsigned Off = getPltEntryOffset(Index);
|
||||
unsigned Off = PltHeaderSize + PltEntrySize * Index;
|
||||
write32le(Buf + 2, GotPltEntryAddr);
|
||||
write32le(Buf + 7, -Off - 11 + 32);
|
||||
write32le(Buf + 12, -Off - 16 + 17);
|
||||
|
|
|
@ -171,7 +171,7 @@ void X86_64<ELFT>::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr,
|
|||
|
||||
write32le(Buf + 2, GotPltEntryAddr - PltEntryAddr - 6);
|
||||
write32le(Buf + 7, Index);
|
||||
write32le(Buf + 12, -getPltEntryOffset(Index) - 16);
|
||||
write32le(Buf + 12, -this->PltHeaderSize - this->PltEntrySize * Index - 16);
|
||||
}
|
||||
|
||||
template <class ELFT> RelType X86_64<ELFT>::getDynRel(RelType Type) const {
|
||||
|
@ -632,7 +632,7 @@ void Retpoline<ELFT>::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr,
|
|||
};
|
||||
memcpy(Buf, Insn, sizeof(Insn));
|
||||
|
||||
uint64_t Off = getPltEntryOffset(Index);
|
||||
uint64_t Off = this->PltHeaderSize + this->PltEntrySize * Index;
|
||||
|
||||
write32le(Buf + 3, GotPltEntryAddr - PltEntryAddr - 7);
|
||||
write32le(Buf + 8, -Off - 12 + 32);
|
||||
|
@ -675,7 +675,7 @@ void RetpolineZNow<ELFT>::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr,
|
|||
memcpy(Buf, Insn, sizeof(Insn));
|
||||
|
||||
write32le(Buf + 3, GotPltEntryAddr - PltEntryAddr - 7);
|
||||
write32le(Buf + 8, -getPltEntryOffset(Index) - 12);
|
||||
write32le(Buf + 8, -this->PltHeaderSize - this->PltEntrySize * Index - 12);
|
||||
}
|
||||
|
||||
template <class ELFT> static TargetInfo *getTargetInfo() {
|
||||
|
|
|
@ -979,7 +979,9 @@ static void processRelocAux(InputSectionBase &Sec, RelExpr Expr, RelType Type,
|
|||
if (!Sym.isInPlt())
|
||||
addPltEntry<ELFT>(In.Plt, In.GotPlt, In.RelaPlt, Target->PltRel, Sym);
|
||||
if (!Sym.isDefined())
|
||||
replaceWithDefined(Sym, In.Plt, getPltEntryOffset(Sym.PltIndex), 0);
|
||||
replaceWithDefined(
|
||||
Sym, In.Plt,
|
||||
Target->PltHeaderSize + Target->PltEntrySize * Sym.PltIndex, 0);
|
||||
Sym.NeedsPltAddr = true;
|
||||
Sec.Relocations.push_back({Expr, Type, Offset, Addend, &Sym});
|
||||
return;
|
||||
|
|
|
@ -201,10 +201,6 @@ static inline void reportRangeError(uint8_t *Loc, RelType Type, const Twine &V,
|
|||
", " + Twine(Max).str() + "]" + Hint);
|
||||
}
|
||||
|
||||
inline unsigned getPltEntryOffset(unsigned Idx) {
|
||||
return Target->PltHeaderSize + Target->PltEntrySize * Idx;
|
||||
}
|
||||
|
||||
// Make sure that V can be represented as an N bit signed integer.
|
||||
inline void checkInt(uint8_t *Loc, int64_t V, int N, RelType Type) {
|
||||
if (V != llvm::SignExtend64(V, N))
|
||||
|
|
Loading…
Reference in New Issue