[lld] r272388 - [ELF][MIPS] Fix mask used to parse MIPS 3-in-1 relocation packet

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 05:26:10 PDT 2016


Author: atanasyan
Date: Fri Jun 10 07:26:09 2016
New Revision: 272388

URL: http://llvm.org/viewvc/llvm-project?rev=272388&view=rev
Log:
[ELF][MIPS] Fix mask used to parse MIPS 3-in-1 relocation packet

In isPreemptible routine we interested in R_MIPS_GPREL16 relocation
only. This relocation fits 0xf. So the new mask 0xff is just to conform
the ABI specification.

Modified:
    lld/trunk/ELF/Relocations.cpp

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=272388&r1=272387&r2=272388&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Fri Jun 10 07:26:09 2016
@@ -72,11 +72,11 @@ static bool isPreemptible(const SymbolBo
   // if the target symbol is preemptible. There are two two MIPS GP-relative
   // relocations R_MIPS_GPREL16 and R_MIPS_GPREL32. But only R_MIPS_GPREL16
   // can be against a preemptible symbol.
-  // To get MIPS relocation type we apply 0xf mask. In case of O32 ABI all
+  // To get MIPS relocation type we apply 0xff mask. In case of O32 ABI all
   // relocation types occupy eight bit. In case of N64 ABI we extract first
   // relocation from 3-in-1 packet because only the first relocation can
   // be against a real symbol.
-  if (Config->EMachine == EM_MIPS && (Type & 0xf) == R_MIPS_GPREL16)
+  if (Config->EMachine == EM_MIPS && (Type & 0xff) == R_MIPS_GPREL16)
     return false;
   return Body.isPreemptible();
 }




More information about the llvm-commits mailing list