[ELF][MIPS] Decompose relocation type for N32 / N64 earlier. NFC

We need to decompose relocation type for N32 / N64 ABI. Let's do it
before any other manipulations with relocation type in the `relocateOne`
routine.

llvm-svn: 322860
This commit is contained in:
Simon Atanasyan 2018-01-18 15:59:05 +00:00
parent 6b5c300327
commit ceddcdf01c
1 changed files with 3 additions and 3 deletions

View File

@ -467,6 +467,9 @@ template <class ELFT>
void MIPS<ELFT>::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const { void MIPS<ELFT>::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const {
const endianness E = ELFT::TargetEndianness; const endianness E = ELFT::TargetEndianness;
if (ELFT::Is64Bits || Config->MipsN32Abi)
std::tie(Type, Val) = calculateMipsRelChain(Loc, Type, Val);
// Thread pointer and DRP offsets from the start of TLS data area. // Thread pointer and DRP offsets from the start of TLS data area.
// https://www.linux-mips.org/wiki/NPTL // https://www.linux-mips.org/wiki/NPTL
if (Type == R_MIPS_TLS_DTPREL_HI16 || Type == R_MIPS_TLS_DTPREL_LO16 || if (Type == R_MIPS_TLS_DTPREL_HI16 || Type == R_MIPS_TLS_DTPREL_LO16 ||
@ -481,9 +484,6 @@ void MIPS<ELFT>::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const {
Val -= 0x7000; Val -= 0x7000;
} }
if (ELFT::Is64Bits || Config->MipsN32Abi)
std::tie(Type, Val) = calculateMipsRelChain(Loc, Type, Val);
switch (Type) { switch (Type) {
case R_MIPS_32: case R_MIPS_32:
case R_MIPS_GPREL32: case R_MIPS_GPREL32: