[lld] r250096 - Continue early to reduce indentation.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 13:28:24 PDT 2015


Author: ruiu
Date: Mon Oct 12 15:28:23 2015
New Revision: 250096

URL: http://llvm.org/viewvc/llvm-project?rev=250096&view=rev
Log:
Continue early to reduce indentation.

Modified:
    lld/trunk/ELF/InputSection.cpp

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=250096&r1=250095&r2=250096&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Mon Oct 12 15:28:23 2015
@@ -35,30 +35,31 @@ void InputSection<ELFT>::relocate(
   for (const RelType &RI : Rels) {
     uint32_t SymIndex = RI.getSymbol(IsMips64EL);
     uint32_t Type = RI.getType(IsMips64EL);
-    uintX_t SymVA;
 
     // Handle relocations for local symbols -- they never get
     // resolved so we don't allocate a SymbolBody.
     const Elf_Shdr *SymTab = File.getSymbolTable();
     if (SymIndex < SymTab->sh_info) {
-      SymVA = getLocalRelTarget(File, RI);
-    } else {
-      SymbolBody &Body = *File.getSymbolBody(SymIndex)->repl();
-      SymVA = getSymVA<ELFT>(Body);
-      if (Target->relocNeedsPlt(Type, Body)) {
-        SymVA = Out<ELFT>::Plt->getEntryAddr(Body);
-        Type = Target->getPCRelReloc();
-      } else if (Target->relocNeedsGot(Type, Body)) {
-        SymVA = Out<ELFT>::Got->getEntryAddr(Body);
-        Type = Target->getGotRefReloc();
-      } else if (Target->relocPointsToGot(Type)) {
-        SymVA = Out<ELFT>::Got->getVA();
-        Type = Target->getPCRelReloc();
-      } else if (isa<SharedSymbol<ELFT>>(Body)) {
-        continue;
-      }
+      uintX_t SymVA = getLocalRelTarget(File, RI);
+      Target->relocateOne(Buf, reinterpret_cast<const void *>(&RI), Type,
+                          BaseAddr, SymVA);
+      continue;
     }
 
+    SymbolBody &Body = *File.getSymbolBody(SymIndex)->repl();
+    uintX_t SymVA = getSymVA<ELFT>(Body);
+    if (Target->relocNeedsPlt(Type, Body)) {
+      SymVA = Out<ELFT>::Plt->getEntryAddr(Body);
+      Type = Target->getPCRelReloc();
+    } else if (Target->relocNeedsGot(Type, Body)) {
+      SymVA = Out<ELFT>::Got->getEntryAddr(Body);
+      Type = Target->getGotRefReloc();
+    } else if (Target->relocPointsToGot(Type)) {
+      SymVA = Out<ELFT>::Got->getVA();
+      Type = Target->getPCRelReloc();
+    } else if (isa<SharedSymbol<ELFT>>(Body)) {
+      continue;
+    }
     Target->relocateOne(Buf, reinterpret_cast<const void *>(&RI), Type,
                         BaseAddr, SymVA);
   }




More information about the llvm-commits mailing list