[lld] r298794 - Inline a function that is used only once.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 25 20:21:08 PDT 2017


Author: ruiu
Date: Sat Mar 25 22:21:08 2017
New Revision: 298794

URL: http://llvm.org/viewvc/llvm-project?rev=298794&view=rev
Log:
Inline a function that is used only once.

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=298794&r1=298793&r2=298794&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Sat Mar 25 22:21:08 2017
@@ -237,10 +237,6 @@ handleTlsRelocation(uint32_t Type, Symbo
   return 0;
 }
 
-static int16_t readSignedLo16(const uint8_t *Loc) {
-  return read32(Loc, Config->Endianness) & 0xffff;
-}
-
 template <class RelTy>
 static uint32_t getMipsPairType(const RelTy *Rel, const SymbolBody &Sym) {
   switch (Rel->getType(Config->IsMips64EL)) {
@@ -276,8 +272,11 @@ static int32_t findMipsPairedAddend(cons
       continue;
     if (RI->getSymbol(Config->IsMips64EL) != SymIndex)
       continue;
-    return ((read32(BufLoc, Config->Endianness) & 0xffff) << 16) +
-           readSignedLo16(Buf + RI->r_offset);
+
+    endianness E = Config->Endianness;
+    int32_t Hi = (read32(BufLoc, E) & 0xffff) << 16;
+    int32_t Lo = SignExtend32<16>(read32(Buf + RI->r_offset, E));
+    return Hi + Lo;
   }
 
   warn("can't find matching " + toString(Type) + " relocation for " +




More information about the llvm-commits mailing list