forked from OSchip/llvm-project
[ELF][MIPS] s/applyMipsHi16Reloc/writeMipsHi16/ NFC
llvm-svn: 262703
This commit is contained in:
parent
4dbf3371bb
commit
3474b907dd
|
@ -1641,7 +1641,7 @@ static void applyMipsPcReloc(uint8_t *Loc, uint32_t Type, uint64_t P,
|
||||||
}
|
}
|
||||||
|
|
||||||
template <endianness E>
|
template <endianness E>
|
||||||
static void applyMipsHi16Reloc(uint8_t *Loc, uint64_t S, int64_t A) {
|
static void writeMipsHi16(uint8_t *Loc, uint64_t S, int64_t A) {
|
||||||
uint32_t Instr = read32<E>(Loc);
|
uint32_t Instr = read32<E>(Loc);
|
||||||
write32<E>(Loc, (Instr & 0xffff0000) | mipsHigh(S + A));
|
write32<E>(Loc, (Instr & 0xffff0000) | mipsHigh(S + A));
|
||||||
}
|
}
|
||||||
|
@ -1659,7 +1659,7 @@ void MipsTargetInfo<ELFT>::writePltZero(uint8_t *Buf) const {
|
||||||
write32<E>(Buf + 28, 0x2718fffe); // subu $24, $24, 2
|
write32<E>(Buf + 28, 0x2718fffe); // subu $24, $24, 2
|
||||||
uint64_t Got = Out<ELFT>::GotPlt->getVA();
|
uint64_t Got = Out<ELFT>::GotPlt->getVA();
|
||||||
uint64_t Plt = Out<ELFT>::Plt->getVA();
|
uint64_t Plt = Out<ELFT>::Plt->getVA();
|
||||||
applyMipsHi16Reloc<E>(Buf, Got, 0);
|
writeMipsHi16<E>(Buf, Got, 0);
|
||||||
relocateOne(Buf + 4, Buf + 8, R_MIPS_LO16, Plt + 4, Got);
|
relocateOne(Buf + 4, Buf + 8, R_MIPS_LO16, Plt + 4, Got);
|
||||||
relocateOne(Buf + 8, Buf + 12, R_MIPS_LO16, Plt + 8, Got);
|
relocateOne(Buf + 8, Buf + 12, R_MIPS_LO16, Plt + 8, Got);
|
||||||
}
|
}
|
||||||
|
@ -1673,7 +1673,7 @@ void MipsTargetInfo<ELFT>::writePlt(uint8_t *Buf, uint64_t GotEntryAddr,
|
||||||
write32<E>(Buf + 4, 0x8df90000); // l[wd] $25, %lo(.got.plt entry)($15)
|
write32<E>(Buf + 4, 0x8df90000); // l[wd] $25, %lo(.got.plt entry)($15)
|
||||||
write32<E>(Buf + 8, 0x03200008); // jr $25
|
write32<E>(Buf + 8, 0x03200008); // jr $25
|
||||||
write32<E>(Buf + 12, 0x25f80000); // addiu $24, $15, %lo(.got.plt entry)
|
write32<E>(Buf + 12, 0x25f80000); // addiu $24, $15, %lo(.got.plt entry)
|
||||||
applyMipsHi16Reloc<E>(Buf, GotEntryAddr, 0);
|
writeMipsHi16<E>(Buf, GotEntryAddr, 0);
|
||||||
relocateOne(Buf + 4, Buf + 8, R_MIPS_LO16, PltEntryAddr + 4, GotEntryAddr);
|
relocateOne(Buf + 4, Buf + 8, R_MIPS_LO16, PltEntryAddr + 4, GotEntryAddr);
|
||||||
relocateOne(Buf + 12, Buf + 16, R_MIPS_LO16, PltEntryAddr + 8, GotEntryAddr);
|
relocateOne(Buf + 12, Buf + 16, R_MIPS_LO16, PltEntryAddr + 8, GotEntryAddr);
|
||||||
}
|
}
|
||||||
|
@ -1739,10 +1739,10 @@ void MipsTargetInfo<ELFT>::relocateOne(uint8_t *Loc, uint8_t *BufEnd,
|
||||||
if (PairedLoc) {
|
if (PairedLoc) {
|
||||||
uint64_t AHL = ((Instr & 0xffff) << 16) +
|
uint64_t AHL = ((Instr & 0xffff) << 16) +
|
||||||
SignExtend64<16>(read32<E>(PairedLoc) & 0xffff);
|
SignExtend64<16>(read32<E>(PairedLoc) & 0xffff);
|
||||||
applyMipsHi16Reloc<E>(Loc, S, AHL);
|
writeMipsHi16<E>(Loc, S, AHL);
|
||||||
} else {
|
} else {
|
||||||
warning("Can't find matching R_MIPS_LO16 relocation for R_MIPS_HI16");
|
warning("Can't find matching R_MIPS_LO16 relocation for R_MIPS_HI16");
|
||||||
applyMipsHi16Reloc<E>(Loc, S, 0);
|
writeMipsHi16<E>(Loc, S, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue