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

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 07:59:05 PST 2018


Author: atanasyan
Date: Thu Jan 18 07:59:05 2018
New Revision: 322860

URL: http://llvm.org/viewvc/llvm-project?rev=322860&view=rev
Log:
[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.

Modified:
    lld/trunk/ELF/Arch/Mips.cpp

Modified: lld/trunk/ELF/Arch/Mips.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/Mips.cpp?rev=322860&r1=322859&r2=322860&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/Mips.cpp (original)
+++ lld/trunk/ELF/Arch/Mips.cpp Thu Jan 18 07:59:05 2018
@@ -467,6 +467,9 @@ template <class ELFT>
 void MIPS<ELFT>::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<ELFT>::relocateOne(uint8_t *Lo
     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:




More information about the llvm-commits mailing list