[lld] r262705 - [ELF][MIPS] Use writeMipsHi16 to apply result of R_MIPS_PCHI16 relocation. NFC
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 4 02:55:16 PST 2016
Author: atanasyan
Date: Fri Mar 4 04:55:16 2016
New Revision: 262705
URL: http://llvm.org/viewvc/llvm-project?rev=262705&view=rev
Log:
[ELF][MIPS] Use writeMipsHi16 to apply result of R_MIPS_PCHI16 relocation. NFC
Modified:
lld/trunk/ELF/Target.cpp
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=262705&r1=262704&r2=262705&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Fri Mar 4 04:55:16 2016
@@ -1771,14 +1771,13 @@ void MipsTargetInfo<ELFT>::relocateOne(u
applyMipsPcReloc<E, 32, 0>(Loc, Type, P, S);
break;
case R_MIPS_PCHI16: {
- uint32_t Instr = read32<E>(Loc);
if (PairedLoc) {
- uint64_t AHL = ((Instr & 0xffff) << 16) +
+ uint64_t AHL = ((read32<E>(Loc) & 0xffff) << 16) +
SignExtend64<16>(read32<E>(PairedLoc) & 0xffff);
- write32<E>(Loc, (Instr & 0xffff0000) | mipsHigh(S + AHL - P));
+ writeMipsHi16<E>(Loc, S + AHL - P);
} else {
warning("Can't find matching R_MIPS_PCLO16 relocation for R_MIPS_PCHI16");
- write32<E>(Loc, (Instr & 0xffff0000) | mipsHigh(S - P));
+ writeMipsHi16<E>(Loc, S - P);
}
break;
}
More information about the llvm-commits
mailing list