diff --git a/lld/ELF/Arch/AArch64.cpp b/lld/ELF/Arch/AArch64.cpp --- a/lld/ELF/Arch/AArch64.cpp +++ b/lld/ELF/Arch/AArch64.cpp @@ -37,8 +37,8 @@ RelType getDynRel(RelType type) const override; void writeGotPlt(uint8_t *buf, const Symbol &s) const override; void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; bool needsThunk(RelExpr expr, RelType type, const InputFile *file, uint64_t branchAddr, const Symbol &s, int64_t a) const override; @@ -214,8 +214,8 @@ relocateOne(buf + 12, R_AARCH64_ADD_ABS_LO12_NC, got + 16); } -void AArch64::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t index) const { +void AArch64::writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { const uint8_t inst[] = { 0x10, 0x00, 0x00, 0x90, // adrp x16, Page(&(.plt.got[n])) 0x11, 0x02, 0x40, 0xf9, // ldr x17, [x16, Offset(&(.plt.got[n]))] @@ -224,6 +224,7 @@ }; memcpy(buf, inst, sizeof(inst)); + uint64_t gotPltEntryAddr = s.getGotPltVA(); relocateOne(buf, R_AARCH64_ADR_PREL_PG_HI21, getAArch64Page(gotPltEntryAddr) - getAArch64Page(pltEntryAddr)); relocateOne(buf + 4, R_AARCH64_LDST64_ABS_LO12_NC, gotPltEntryAddr); @@ -569,8 +570,8 @@ public: AArch64BtiPac(); void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; private: bool btiHeader; // bti instruction needed in PLT Header @@ -631,8 +632,8 @@ memcpy(buf + sizeof(pltData), nopData, sizeof(nopData)); } -void AArch64BtiPac::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t index) const { +void AArch64BtiPac::writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { // The PLT entry is of the form: // [btiData] addrInst (pacBr | stdBr) [nopData] const uint8_t btiData[] = { 0x5f, 0x24, 0x03, 0xd5 }; // bti c @@ -657,6 +658,7 @@ pltEntryAddr += sizeof(btiData); } + uint64_t gotPltEntryAddr = s.getGotPltVA(); memcpy(buf, addrInst, sizeof(addrInst)); relocateOne(buf, R_AARCH64_ADR_PREL_PG_HI21, getAArch64Page(gotPltEntryAddr) - diff --git a/lld/ELF/Arch/ARM.cpp b/lld/ELF/Arch/ARM.cpp --- a/lld/ELF/Arch/ARM.cpp +++ b/lld/ELF/Arch/ARM.cpp @@ -34,8 +34,8 @@ void writeGotPlt(uint8_t *buf, const Symbol &s) const override; void writeIgotPlt(uint8_t *buf, const Symbol &s) const override; void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; void addPltSymbols(InputSection &isec, uint64_t off) const override; void addPltHeaderSymbols(InputSection &isd) const override; bool needsThunk(RelExpr expr, RelType type, const InputFile *file, @@ -231,8 +231,7 @@ // The default PLT entries require the .plt.got to be within 128 Mb of the // .plt in the positive direction. -void ARM::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t /*index*/) const { +void ARM::writePlt(uint8_t *buf, const Symbol &s, uint64_t pltEntryAddr) const { // The PLT entry is similar to the example given in Appendix A of ELF for // the Arm Architecture. Instead of using the Group Relocations to find the // optimal rotation for the 8-bit immediate used in the add instructions we @@ -244,6 +243,7 @@ 0xe5bcf000, // ldr pc, [ip, #0x00000NNN] Offset(&(.plt.got) - L1 - 8 }; + uint64_t gotPltEntryAddr = s.getGotPltVA(); uint64_t offset = gotPltEntryAddr - pltEntryAddr - 8; if (!llvm::isUInt<27>(offset)) { // We cannot encode the Offset, use the long form. diff --git a/lld/ELF/Arch/Hexagon.cpp b/lld/ELF/Arch/Hexagon.cpp --- a/lld/ELF/Arch/Hexagon.cpp +++ b/lld/ELF/Arch/Hexagon.cpp @@ -33,8 +33,8 @@ RelType getDynRel(RelType type) const override; void relocateOne(uint8_t *loc, RelType type, uint64_t val) const override; void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; }; } // namespace @@ -302,8 +302,8 @@ relocateOne(buf + 4, R_HEX_6_PCREL_X, off); } -void Hexagon::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t index) const { +void Hexagon::writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { const uint8_t inst[] = { 0x00, 0x40, 0x00, 0x00, // { immext (#0) 0x0e, 0xc0, 0x49, 0x6a, // r14 = add (pc, ##GOTn@PCREL) } @@ -312,6 +312,7 @@ }; memcpy(buf, inst, sizeof(inst)); + uint64_t gotPltEntryAddr = s.getGotPltVA(); relocateOne(buf, R_HEX_B32_PCREL_X, gotPltEntryAddr - pltEntryAddr); relocateOne(buf + 4, R_HEX_6_PCREL_X, gotPltEntryAddr - pltEntryAddr); } diff --git a/lld/ELF/Arch/Mips.cpp b/lld/ELF/Arch/Mips.cpp --- a/lld/ELF/Arch/Mips.cpp +++ b/lld/ELF/Arch/Mips.cpp @@ -32,8 +32,8 @@ RelType getDynRel(RelType type) const override; void writeGotPlt(uint8_t *buf, const Symbol &s) const override; void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; bool needsThunk(RelExpr expr, RelType type, const InputFile *file, uint64_t branchAddr, const Symbol &s, int64_t a) const override; @@ -318,8 +318,9 @@ } template -void MIPS::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t /*index*/) const { +void MIPS::writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { + uint64_t gotPltEntryAddr = s.getGotPltVA(); if (isMicroMips()) { // Overwrite trap instructions written by Writer::writeTrapInstr. memset(buf, 0, pltEntrySize); diff --git a/lld/ELF/Arch/PPC.cpp b/lld/ELF/Arch/PPC.cpp --- a/lld/ELF/Arch/PPC.cpp +++ b/lld/ELF/Arch/PPC.cpp @@ -31,8 +31,8 @@ void writePltHeader(uint8_t *buf) const override { llvm_unreachable("should call writePPC32GlinkSection() instead"); } - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override { + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override { llvm_unreachable("should call writePPC32GlinkSection() instead"); } void writeGotPlt(uint8_t *buf, const Symbol &s) const override; diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp --- a/lld/ELF/Arch/PPC64.cpp +++ b/lld/ELF/Arch/PPC64.cpp @@ -200,8 +200,8 @@ const uint8_t *loc) const override; RelType getDynRel(RelType type) const override; void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; void relocateOne(uint8_t *loc, RelType type, uint64_t val) const override; void writeGotHeader(uint8_t *buf) const override; bool needsThunk(RelExpr expr, RelType type, const InputFile *file, @@ -669,9 +669,9 @@ write64(buf + 52, gotPltOffset); } -void PPC64::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t index) const { - int32_t offset = pltHeaderSize + index * pltEntrySize; +void PPC64::writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { + int32_t offset = pltHeaderSize + s.pltIndex * pltEntrySize; // bl __glink_PLTresolve write32(buf, 0x48000000 | ((-offset) & 0x03FFFFFc)); } diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "InputFiles.h" +#include "Symbols.h" #include "SyntheticSections.h" #include "Target.h" @@ -27,8 +28,8 @@ void writeGotHeader(uint8_t *buf) const override; void writeGotPlt(uint8_t *buf, const Symbol &s) const override; void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; RelType getDynRel(RelType type) const override; RelExpr getRelExpr(RelType type, const Symbol &s, const uint8_t *loc) const override; @@ -163,13 +164,13 @@ write32le(buf + 28, itype(JALR, 0, X_T3, 0)); } -void RISCV::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t /*index*/) const { +void RISCV::writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { // 1: auipc t3, %pcrel_hi(f@.got.plt) // l[wd] t3, %pcrel_lo(1b)(t3) // jalr t1, t3 // nop - uint32_t offset = gotPltEntryAddr - pltEntryAddr; + uint32_t offset = s.getGotPltVA() - pltEntryAddr; write32le(buf + 0, utype(AUIPC, X_T3, hi20(offset))); write32le(buf + 4, itype(config->is64 ? LD : LW, X_T3, X_T3, lo12(offset))); write32le(buf + 8, itype(JALR, X_T1, X_T3, 0)); diff --git a/lld/ELF/Arch/SPARCV9.cpp b/lld/ELF/Arch/SPARCV9.cpp --- a/lld/ELF/Arch/SPARCV9.cpp +++ b/lld/ELF/Arch/SPARCV9.cpp @@ -26,8 +26,8 @@ SPARCV9(); RelExpr getRelExpr(RelType type, const Symbol &s, const uint8_t *loc) const override; - void writePlt(uint8_t *buf, uint64_t gotEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; void relocateOne(uint8_t *loc, RelType type, uint64_t val) const override; }; } // namespace @@ -124,8 +124,8 @@ } } -void SPARCV9::writePlt(uint8_t *buf, uint64_t gotEntryAddr, - uint64_t pltEntryAddr, int32_t index) const { +void SPARCV9::writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { const uint8_t pltData[] = { 0x03, 0x00, 0x00, 0x00, // sethi (. - .PLT0), %g1 0x30, 0x68, 0x00, 0x00, // ba,a %xcc, .PLT1 @@ -138,7 +138,7 @@ }; memcpy(buf, pltData, sizeof(pltData)); - uint64_t off = pltHeaderSize + pltEntrySize * index; + uint64_t off = pltEntryAddr - in.plt->getVA(); relocateOne(buf, R_SPARC_22, off); relocateOne(buf + 4, R_SPARC_WDISP19, -(off + 4 - pltEntrySize)); } diff --git a/lld/ELF/Arch/X86.cpp b/lld/ELF/Arch/X86.cpp --- a/lld/ELF/Arch/X86.cpp +++ b/lld/ELF/Arch/X86.cpp @@ -33,8 +33,8 @@ void writeGotPlt(uint8_t *buf, const Symbol &s) const override; void writeIgotPlt(uint8_t *buf, const Symbol &s) const override; void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; void relocateOne(uint8_t *loc, RelType type, uint64_t val) const override; RelExpr adjustRelaxExpr(RelType type, const uint8_t *data, @@ -214,9 +214,8 @@ write32le(buf + 8, gotPlt + 8); } -void X86::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t index) const { - unsigned relOff = in.relaPlt->entsize * index; +void X86::writePlt(uint8_t *buf, const Symbol &s, uint64_t pltEntryAddr) const { + unsigned relOff = in.relaPlt->entsize * s.pltIndex; if (config->isPic) { const uint8_t inst[] = { 0xff, 0xa3, 0, 0, 0, 0, // jmp *foo@GOT(%ebx) @@ -224,7 +223,7 @@ 0xe9, 0, 0, 0, 0, // jmp .PLT0@PC }; memcpy(buf, inst, sizeof(inst)); - write32le(buf + 2, gotPltEntryAddr - in.gotPlt->getVA()); + write32le(buf + 2, s.getGotPltVA() - in.gotPlt->getVA()); } else { const uint8_t inst[] = { 0xff, 0x25, 0, 0, 0, 0, // jmp *foo@GOT @@ -232,7 +231,7 @@ 0xe9, 0, 0, 0, 0, // jmp .PLT0@PC }; memcpy(buf, inst, sizeof(inst)); - write32le(buf + 2, gotPltEntryAddr); + write32le(buf + 2, s.getGotPltVA()); } write32le(buf + 7, relOff); @@ -416,8 +415,8 @@ RetpolinePic(); void writeGotPlt(uint8_t *buf, const Symbol &s) const override; void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; }; class RetpolineNoPic : public X86 { @@ -425,8 +424,8 @@ RetpolineNoPic(); void writeGotPlt(uint8_t *buf, const Symbol &s) const override; void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; }; } // namespace @@ -461,9 +460,9 @@ memcpy(buf, insn, sizeof(insn)); } -void RetpolinePic::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t index) const { - unsigned relOff = in.relaPlt->entsize * index; +void RetpolinePic::writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { + unsigned relOff = in.relaPlt->entsize * s.pltIndex; const uint8_t insn[] = { 0x50, // pushl %eax 0x8b, 0x83, 0, 0, 0, 0, // mov foo@GOT(%ebx), %eax @@ -477,7 +476,7 @@ uint32_t ebx = in.gotPlt->getVA(); unsigned off = pltEntryAddr - in.plt->getVA(); - write32le(buf + 3, gotPltEntryAddr - ebx); + write32le(buf + 3, s.getGotPltVA() - ebx); write32le(buf + 8, -off - 12 + 32); write32le(buf + 13, -off - 17 + 18); write32le(buf + 18, relOff); @@ -520,9 +519,9 @@ write32le(buf + 8, gotPlt + 8); } -void RetpolineNoPic::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t index) const { - unsigned relOff = in.relaPlt->entsize * index; +void RetpolineNoPic::writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { + unsigned relOff = in.relaPlt->entsize * s.pltIndex; const uint8_t insn[] = { 0x50, // 0: pushl %eax 0xa1, 0, 0, 0, 0, // 1: mov foo_in_GOT, %eax @@ -536,7 +535,7 @@ memcpy(buf, insn, sizeof(insn)); unsigned off = pltEntryAddr - in.plt->getVA(); - write32le(buf + 2, gotPltEntryAddr); + write32le(buf + 2, s.getGotPltVA()); write32le(buf + 7, -off - 11 + 32); write32le(buf + 12, -off - 16 + 17); write32le(buf + 17, relOff); diff --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp --- a/lld/ELF/Arch/X86_64.cpp +++ b/lld/ELF/Arch/X86_64.cpp @@ -33,8 +33,8 @@ void writeGotPltHeader(uint8_t *buf) const override; void writeGotPlt(uint8_t *buf, const Symbol &s) const override; void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; void relocateOne(uint8_t *loc, RelType type, uint64_t val) const override; RelExpr adjustRelaxExpr(RelType type, const uint8_t *data, @@ -156,8 +156,8 @@ write32le(buf + 8, gotPlt - plt + 4); // GOTPLT+16 } -void X86_64::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t index) const { +void X86_64::writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { const uint8_t inst[] = { 0xff, 0x25, 0, 0, 0, 0, // jmpq *got(%rip) 0x68, 0, 0, 0, 0, // pushq @@ -165,8 +165,8 @@ }; memcpy(buf, inst, sizeof(inst)); - write32le(buf + 2, gotPltEntryAddr - pltEntryAddr - 6); - write32le(buf + 7, index); + write32le(buf + 2, s.getGotPltVA() - pltEntryAddr - 6); + write32le(buf + 7, s.pltIndex); write32le(buf + 12, in.plt->getVA() - pltEntryAddr - 16); } @@ -583,8 +583,8 @@ Retpoline(); void writeGotPlt(uint8_t *buf, const Symbol &s) const override; void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; }; class RetpolineZNow : public X86_64 { @@ -592,8 +592,8 @@ RetpolineZNow(); void writeGotPlt(uint8_t *buf, const Symbol &s) const override {} void writePltHeader(uint8_t *buf) const override; - void writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, uint64_t pltEntryAddr, - int32_t index) const override; + void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const override; }; } // namespace @@ -629,8 +629,8 @@ write32le(buf + 9, gotPlt - plt - 13 + 16); } -void Retpoline::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t index) const { +void Retpoline::writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { const uint8_t insn[] = { 0x4c, 0x8b, 0x1d, 0, 0, 0, 0, // 0: mov foo@GOTPLT(%rip), %r11 0xe8, 0, 0, 0, 0, // 7: callq plt+0x20 @@ -643,10 +643,10 @@ uint64_t off = pltEntryAddr - in.plt->getVA(); - write32le(buf + 3, gotPltEntryAddr - pltEntryAddr - 7); + write32le(buf + 3, s.getGotPltVA() - pltEntryAddr - 7); write32le(buf + 8, -off - 12 + 32); write32le(buf + 13, -off - 17 + 18); - write32le(buf + 18, index); + write32le(buf + 18, s.pltIndex); write32le(buf + 23, -off - 27); } @@ -672,8 +672,8 @@ memcpy(buf, insn, sizeof(insn)); } -void RetpolineZNow::writePlt(uint8_t *buf, uint64_t gotPltEntryAddr, - uint64_t pltEntryAddr, int32_t index) const { +void RetpolineZNow::writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { const uint8_t insn[] = { 0x4c, 0x8b, 0x1d, 0, 0, 0, 0, // mov foo@GOTPLT(%rip), %r11 0xe9, 0, 0, 0, 0, // jmp plt+0 @@ -681,7 +681,7 @@ }; memcpy(buf, insn, sizeof(insn)); - write32le(buf + 3, gotPltEntryAddr - pltEntryAddr - 7); + write32le(buf + 3, s.getGotPltVA() - pltEntryAddr - 7); write32le(buf + 8, in.plt->getVA() - pltEntryAddr - 12); } diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -2470,11 +2470,8 @@ target->writePltHeader(buf); size_t off = headerSize; - for (size_t i = 0, e = entries.size(); i != e; ++i) { - const Symbol *b = entries[i]; - uint64_t got = b->getGotPltVA(); - uint64_t plt = this->getVA() + off; - target->writePlt(buf + off, got, plt, b->pltIndex); + for (const Symbol *sym : entries) { + target->writePlt(buf + off, *sym, getVA() + off); off += target->pltEntrySize; } } @@ -2516,8 +2513,7 @@ void IpltSection::writeTo(uint8_t *buf) { uint32_t off = 0; for (const Symbol *sym : entries) { - target->writeIplt(buf + off, sym->getGotPltVA(), getVA() + off, - sym->pltIndex); + target->writeIplt(buf + off, *sym, getVA() + off); off += target->ipltEntrySize; } } diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h --- a/lld/ELF/Target.h +++ b/lld/ELF/Target.h @@ -41,12 +41,12 @@ // they are called. This function writes that code. virtual void writePltHeader(uint8_t *buf) const {} - virtual void writePlt(uint8_t *buf, uint64_t gotEntryAddr, - uint64_t pltEntryAddr, int32_t index) const {} - virtual void writeIplt(uint8_t *buf, uint64_t gotEntryAddr, - uint64_t pltEntryAddr, int32_t index) const { - // All but PPC64 use the same format for .plt and .iplt entries. - writePlt(buf, gotEntryAddr, pltEntryAddr, index); + virtual void writePlt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const {} + virtual void writeIplt(uint8_t *buf, const Symbol &s, + uint64_t pltEntryAddr) const { + // All but PPC32 and PPC64 use the same format for .plt and .iplt entries. + writePlt(buf, s, pltEntryAddr); } virtual void addPltHeaderSymbols(InputSection &isec) const {} virtual void addPltSymbols(InputSection &isec, uint64_t off) const {}