[lld] r268741 - [ELF][MIPS] Simplify `if` condition. NFC

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Fri May 6 08:02:46 PDT 2016


Author: atanasyan
Date: Fri May  6 10:02:45 2016
New Revision: 268741

URL: http://llvm.org/viewvc/llvm-project?rev=268741&view=rev
Log:
[ELF][MIPS] Simplify `if` condition. NFC

In case of MIPS ABI relocation has R_GOTREL expression's type iif the
relocation type is either R_MIPS_GPREL16 or R_MIPS_GPREL32. So it is
enough to check expression's type only.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=268741&r1=268740&r2=268741&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri May  6 10:02:45 2016
@@ -746,8 +746,7 @@ void Writer<ELFT>::scanRelocs(InputSecti
     // can process some of it and and just ask the dynamic linker to add the
     // load address.
     if (!Config->Pic || isStaticLinkTimeConstant<ELFT>(Expr, Type, Body)) {
-      if (Config->EMachine == EM_MIPS && Body.isLocal() &&
-          (Type == R_MIPS_GPREL16 || Type == R_MIPS_GPREL32))
+      if (Config->EMachine == EM_MIPS && Body.isLocal() && Expr == R_GOTREL)
         Addend += File.getMipsGp0();
       C.Relocations.push_back({Expr, Type, Offset, Addend, &Body});
       continue;




More information about the llvm-commits mailing list