void writePltHeader(uint8_t *Buf) const override;
void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr,
int32_t Index, unsigned RelOff) const override;
- void addPltSymbols(InputSectionBase *IS, uint64_t Off) const override;
- void addPltHeaderSymbols(InputSectionBase *ISD) const override;
+ void addPltSymbols(InputSection &IS, uint64_t Off) const override;
+ void addPltHeaderSymbols(InputSection &ISD) const override;
bool needsThunk(RelExpr Expr, RelType Type, const InputFile *File,
uint64_t BranchAddr, const Symbol &S) const override;
bool inBranchRange(RelType Type, uint64_t Src, uint64_t Dst) const override;
write32le(Buf + 28, TrapInstr);
}
-void ARM::addPltHeaderSymbols(InputSectionBase *ISD) const {
- auto *IS = cast<InputSection>(ISD);
+void ARM::addPltHeaderSymbols(InputSection &IS) const {
addSyntheticLocal("$a", STT_NOTYPE, 0, 0, IS);
addSyntheticLocal("$d", STT_NOTYPE, 16, 0, IS);
}
write32le(Buf + 12, TrapInstr); // Pad to 16-byte boundary
}
-void ARM::addPltSymbols(InputSectionBase *ISD, uint64_t Off) const {
- auto *IS = cast<InputSection>(ISD);
+void ARM::addPltSymbols(InputSection &IS, uint64_t Off) const {
addSyntheticLocal("$a", STT_NOTYPE, Off, 0, IS);
addSyntheticLocal("$d", STT_NOTYPE, Off + 12, 0, IS);
}
}
Symbol *elf::addSyntheticLocal(StringRef Name, uint8_t Type, uint64_t Value,
- uint64_t Size, InputSectionBase *Section) {
- auto *S = make<Defined>(Section->File, Name, STB_LOCAL, STV_DEFAULT, Type,
- Value, Size, Section);
+ uint64_t Size, InputSectionBase &Section) {
+ auto *S = make<Defined>(Section.File, Name, STB_LOCAL, STV_DEFAULT, Type,
+ Value, Size, &Section);
if (InX::SymTab)
InX::SymTab->addSymbol(S);
return S;
void PltSection::addSymbols() {
// The PLT may have symbols defined for the Header, the IPLT has no header
if (HeaderSize != 0)
- Target->addPltHeaderSymbols(this);
+ Target->addPltHeaderSymbols(*this);
size_t Off = HeaderSize;
for (size_t I = 0; I < Entries.size(); ++I) {
- Target->addPltSymbols(this, Off);
+ Target->addPltSymbols(*this, Off);
Off += Target->PltEntrySize;
}
}
void AArch64ABSLongThunk::addSymbols(ThunkSection &IS) {
ThunkSym = addSyntheticLocal(
Saver.save("__AArch64AbsLongThunk_" + Destination.getName()), STT_FUNC,
- Offset, size(), &IS);
- addSyntheticLocal("$x", STT_NOTYPE, Offset, 0, &IS);
- addSyntheticLocal("$d", STT_NOTYPE, Offset + 8, 0, &IS);
+ Offset, size(), IS);
+ addSyntheticLocal("$x", STT_NOTYPE, Offset, 0, IS);
+ addSyntheticLocal("$d", STT_NOTYPE, Offset + 8, 0, IS);
}
// This Thunk has a maximum range of 4Gb, this is sufficient for all programs
{
ThunkSym = addSyntheticLocal(
Saver.save("__AArch64ADRPThunk_" + Destination.getName()), STT_FUNC,
- Offset, size(), &IS);
- addSyntheticLocal("$x", STT_NOTYPE, Offset, 0, &IS);
+ Offset, size(), IS);
+ addSyntheticLocal("$x", STT_NOTYPE, Offset, 0, IS);
}
// ARM Target Thunks
void ARMV7ABSLongThunk::addSymbols(ThunkSection &IS) {
ThunkSym = addSyntheticLocal(
Saver.save("__ARMv7ABSLongThunk_" + Destination.getName()), STT_FUNC,
- Offset, size(), &IS);
- addSyntheticLocal("$a", STT_NOTYPE, Offset, 0, &IS);
+ Offset, size(), IS);
+ addSyntheticLocal("$a", STT_NOTYPE, Offset, 0, IS);
}
bool ARMV7ABSLongThunk::isCompatibleWith(RelType Type) const {
void ThumbV7ABSLongThunk::addSymbols(ThunkSection &IS) {
ThunkSym = addSyntheticLocal(
Saver.save("__Thumbv7ABSLongThunk_" + Destination.getName()), STT_FUNC,
- Offset | 0x1, size(), &IS);
- addSyntheticLocal("$t", STT_NOTYPE, Offset, 0, &IS);
+ Offset | 0x1, size(), IS);
+ addSyntheticLocal("$t", STT_NOTYPE, Offset, 0, IS);
}
bool ThumbV7ABSLongThunk::isCompatibleWith(RelType Type) const {
void ARMV7PILongThunk::addSymbols(ThunkSection &IS) {
ThunkSym = addSyntheticLocal(
Saver.save("__ARMV7PILongThunk_" + Destination.getName()), STT_FUNC,
- Offset, size(), &IS);
- addSyntheticLocal("$a", STT_NOTYPE, Offset, 0, &IS);
+ Offset, size(), IS);
+ addSyntheticLocal("$a", STT_NOTYPE, Offset, 0, IS);
}
bool ARMV7PILongThunk::isCompatibleWith(RelType Type) const {
void ThumbV7PILongThunk::addSymbols(ThunkSection &IS) {
ThunkSym = addSyntheticLocal(
Saver.save("__ThumbV7PILongThunk_" + Destination.getName()), STT_FUNC,
- Offset | 0x1, size(), &IS);
- addSyntheticLocal("$t", STT_NOTYPE, Offset, 0, &IS);
+ Offset | 0x1, size(), IS);
+ addSyntheticLocal("$t", STT_NOTYPE, Offset, 0, IS);
}
bool ThumbV7PILongThunk::isCompatibleWith(RelType Type) const {
void MipsThunk::addSymbols(ThunkSection &IS) {
ThunkSym =
addSyntheticLocal(Saver.save("__LA25Thunk_" + Destination.getName()),
- STT_FUNC, Offset, size(), &IS);
+ STT_FUNC, Offset, size(), IS);
}
InputSection *MipsThunk::getTargetInputSection() const {
void MicroMipsThunk::addSymbols(ThunkSection &IS) {
ThunkSym =
addSyntheticLocal(Saver.save("__microLA25Thunk_" + Destination.getName()),
- STT_FUNC, Offset, size(), &IS);
+ STT_FUNC, Offset, size(), IS);
ThunkSym->StOther |= STO_MIPS_MICROMIPS;
}
void MicroMipsR6Thunk::addSymbols(ThunkSection &IS) {
ThunkSym =
addSyntheticLocal(Saver.save("__microLA25Thunk_" + Destination.getName()),
- STT_FUNC, Offset, size(), &IS);
+ STT_FUNC, Offset, size(), IS);
ThunkSym->StOther |= STO_MIPS_MICROMIPS;
}