unsigned getTlsGotRel(unsigned Type) const override;
bool isTlsDynRel(unsigned Type, const SymbolBody &S) const override;
void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const override;
+ void writePltZero(uint8_t *Buf) const override;
void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
uint64_t PltEntryAddr, int32_t Index,
unsigned RelOff) const override;
bool isTlsDynRel(unsigned Type, const SymbolBody &S) const override;
void writeGotPltHeader(uint8_t *Buf) const override;
void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const override;
+ void writePltZero(uint8_t *Buf) const override;
void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
uint64_t PltEntryAddr, int32_t Index,
unsigned RelOff) const override;
public:
PPCTargetInfo();
void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const override;
+ void writePltZero(uint8_t *Buf) const override;
void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
uint64_t PltEntryAddr, int32_t Index,
unsigned RelOff) const override;
public:
PPC64TargetInfo();
void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const override;
+ void writePltZero(uint8_t *Buf) const override;
void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
uint64_t PltEntryAddr, int32_t Index,
unsigned RelOff) const override;
AArch64TargetInfo();
unsigned getDynRel(unsigned Type) const override;
void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const override;
+ void writePltZero(uint8_t *Buf) const override;
void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
uint64_t PltEntryAddr, int32_t Index,
unsigned RelOff) const override;
public:
AMDGPUTargetInfo();
void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const override;
+ void writePltZero(uint8_t *Buf) const override;
void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
uint64_t PltEntryAddr, int32_t Index,
unsigned RelOff) const override;
unsigned getDynRel(unsigned Type) const override;
void writeGotHeader(uint8_t *Buf) const override;
void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const override;
+ void writePltZero(uint8_t *Buf) const override;
void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
uint64_t PltEntryAddr, int32_t Index,
unsigned RelOff) const override;
return Type == R_386_TLS_GD;
}
-void X86TargetInfo::writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const {
+void X86TargetInfo::writePltZero(uint8_t *Buf) const {
// Executable files and shared object files have
// separate procedure linkage tables.
if (Config->Shared) {
0x90, 0x90, 0x90, 0x90 // nop;nop;nop;nop
};
memcpy(Buf, PltData, sizeof(PltData));
- write32le(Buf + 2, GotAddr + 4); // GOT+4
- write32le(Buf + 8, GotAddr + 8); // GOT+8
+ uint32_t Got = Out<ELF32LE>::GotPlt->getVA();
+ write32le(Buf + 2, Got + 4); // GOT+4
+ write32le(Buf + 8, Got + 8); // GOT+8
}
void X86TargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
write32le(Buf, Plt + 6);
}
-void X86_64TargetInfo::writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const {
+void X86_64TargetInfo::writePltZero(uint8_t *Buf) const {
const uint8_t PltData[] = {
0xff, 0x35, 0x00, 0x00, 0x00, 0x00, // pushq GOT+8(%rip)
0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp *GOT+16(%rip)
0x0f, 0x1f, 0x40, 0x00 // nopl 0x0(rax)
};
memcpy(Buf, PltData, sizeof(PltData));
- write32le(Buf + 2, GotAddr - PltAddr + 2); // GOT+8
- write32le(Buf + 8, GotAddr - PltAddr + 4); // GOT+16
+ uint64_t Got = Out<ELF64LE>::GotPlt->getVA();
+ uint64_t Plt = Out<ELF64LE>::Plt->getVA();
+ write32le(Buf + 2, Got - Plt + 2); // GOT+8
+ write32le(Buf + 8, Got - Plt + 4); // GOT+16
}
void X86_64TargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
PPCTargetInfo::PPCTargetInfo() {}
void PPCTargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {}
-void PPCTargetInfo::writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const {}
+void PPCTargetInfo::writePltZero(uint8_t *Buf) const {}
void PPCTargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
uint64_t GotEntryAddr, uint64_t PltEntryAddr,
int32_t Index, unsigned RelOff) const {}
}
void PPC64TargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {}
-void PPC64TargetInfo::writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const {}
+void PPC64TargetInfo::writePltZero(uint8_t *Buf) const {}
void PPC64TargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
uint64_t GotEntryAddr, uint64_t PltEntryAddr,
int32_t Index, unsigned RelOff) const {
write64le(Buf, Out<ELF64LE>::Plt->getVA());
}
-void AArch64TargetInfo::writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const {
+void AArch64TargetInfo::writePltZero(uint8_t *Buf) const {
const uint8_t PltData[] = {
0xf0, 0x7b, 0xbf, 0xa9, // stp x16, x30, [sp,#-16]!
0x10, 0x00, 0x00, 0x90, // adrp x16, Page(&(.plt.got[2]))
};
memcpy(Buf, PltData, sizeof(PltData));
- relocateOne(Buf + 4, Buf + 8, R_AARCH64_ADR_PREL_PG_HI21, PltAddr + 4,
- GotAddr + 16);
- relocateOne(Buf + 8, Buf + 12, R_AARCH64_LDST64_ABS_LO12_NC, PltAddr + 8,
- GotAddr + 16);
- relocateOne(Buf + 12, Buf + 16, R_AARCH64_ADD_ABS_LO12_NC, PltAddr + 12,
- GotAddr + 16);
+ uint64_t Got = Out<ELF64LE>::GotPlt->getVA();
+ uint64_t Plt = Out<ELF64LE>::Plt->getVA();
+ relocateOne(Buf + 4, Buf + 8, R_AARCH64_ADR_PREL_PG_HI21, Plt + 4, Got + 16);
+ relocateOne(Buf + 8, Buf + 12, R_AARCH64_LDST64_ABS_LO12_NC, Plt + 8,
+ Got + 16);
+ relocateOne(Buf + 12, Buf + 16, R_AARCH64_ADD_ABS_LO12_NC, Plt + 12,
+ Got + 16);
}
void AArch64TargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
llvm_unreachable("not implemented");
}
-void AMDGPUTargetInfo::writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const {
+void AMDGPUTargetInfo::writePltZero(uint8_t *Buf) const {
llvm_unreachable("not implemented");
}
template <class ELFT>
void MipsTargetInfo<ELFT>::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {}
template <class ELFT>
-void MipsTargetInfo<ELFT>::writePltZero(uint8_t *Buf, uint64_t GotAddr,
- uint64_t PltAddr) const {}
+void MipsTargetInfo<ELFT>::writePltZero(uint8_t *Buf) const {}
template <class ELFT>
void MipsTargetInfo<ELFT>::writePlt(uint8_t *Buf, uint64_t GotAddr,
uint64_t GotEntryAddr,