[lld] r255823 - Merge two `if`s for MIPS. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 13:35:40 PST 2015


Author: ruiu
Date: Wed Dec 16 15:35:39 2015
New Revision: 255823

URL: http://llvm.org/viewvc/llvm-project?rev=255823&view=rev
Log:
Merge two `if`s for MIPS. NFC.

Modified:
    lld/trunk/ELF/Driver.cpp

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=255823&r1=255822&r2=255823&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Dec 16 15:35:39 2015
@@ -263,11 +263,6 @@ template <class ELFT> void LinkerDriver:
     Symtab.addIgnoredSym("_GLOBAL_OFFSET_TABLE_");
   }
 
-  // On MIPS O32 ABI _gp_disp is a magic symbol designates offset between
-  // start of function and gp pointer into GOT.
-  if (Config->EMachine == EM_MIPS)
-    Config->MipsGpDisp = Symtab.addIgnoredSym("_gp_disp");
-
   if (!Config->Entry.empty()) {
     // Set either EntryAddr (if S is a number) or EntrySym (otherwise).
     StringRef S = Config->Entry;
@@ -275,12 +270,17 @@ template <class ELFT> void LinkerDriver:
       Config->EntrySym = Symtab.addUndefined(S);
   }
 
-  // Define _gp for MIPS. st_value of _gp symbol will be updated by Writer
-  // so that it points to an absolute address which is relative to GOT.
-  // See "Global Data Symbols" in Chapter 6 in the following document:
-  // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
-  if (Config->EMachine == EM_MIPS)
+  if (Config->EMachine == EM_MIPS) {
+    // On MIPS O32 ABI, _gp_disp is a magic symbol designates offset between
+    // start of function and gp pointer into GOT.
+    Config->MipsGpDisp = Symtab.addIgnoredSym("_gp_disp");
+
+    // Define _gp for MIPS. st_value of _gp symbol will be updated by Writer
+    // so that it points to an absolute address which is relative to GOT.
+    // See "Global Data Symbols" in Chapter 6 in the following document:
+    // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
     Symtab.addAbsoluteSym("_gp", DefinedAbsolute<ELFT>::MipsGp);
+  }
 
   for (std::unique_ptr<InputFile> &F : Files)
     Symtab.addFile(std::move(F));




More information about the llvm-commits mailing list