From ceddcdf01cfeeb78ad2bdafe6dd173e3886efb85 Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Thu, 18 Jan 2018 15:59:05 +0000 Subject: [PATCH] [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 --- lld/ELF/Arch/Mips.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lld/ELF/Arch/Mips.cpp b/lld/ELF/Arch/Mips.cpp index 495e2567006f..70dca40473b1 100644 --- a/lld/ELF/Arch/Mips.cpp +++ b/lld/ELF/Arch/Mips.cpp @@ -467,6 +467,9 @@ template void MIPS::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const { 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. // https://www.linux-mips.org/wiki/NPTL if (Type == R_MIPS_TLS_DTPREL_HI16 || Type == R_MIPS_TLS_DTPREL_LO16 || @@ -481,9 +484,6 @@ void MIPS::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const { Val -= 0x7000; } - if (ELFT::Is64Bits || Config->MipsN32Abi) - std::tie(Type, Val) = calculateMipsRelChain(Loc, Type, Val); - switch (Type) { case R_MIPS_32: case R_MIPS_GPREL32: