diff options
| author | Simon Atanasyan <simon@atanasyan.com> | 2016-03-04 10:55:16 +0000 |
|---|---|---|
| committer | Simon Atanasyan <simon@atanasyan.com> | 2016-03-04 10:55:16 +0000 |
| commit | deed55d70600deac8e5df186325ef3aba5a82249 (patch) | |
| tree | 674ea33f3aee42812c7c5bebda468ec8df879993 | |
| parent | a888e6726f231364241c339d81cb06fddd6bbae0 (diff) | |
| download | bcm5719-llvm-deed55d70600deac8e5df186325ef3aba5a82249.tar.gz bcm5719-llvm-deed55d70600deac8e5df186325ef3aba5a82249.zip | |
[ELF][MIPS] Use writeMipsHi16 to apply result of R_MIPS_PCHI16 relocation. NFC
llvm-svn: 262705
| -rw-r--r-- | lld/ELF/Target.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index 5b19383cab0..2418644cf04 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -1771,14 +1771,13 @@ void MipsTargetInfo<ELFT>::relocateOne(uint8_t *Loc, uint8_t *BufEnd, 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; } |

