[lld] r315881 - Remove Config::FirstElf.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 15 14:43:10 PDT 2017


Author: ruiu
Date: Sun Oct 15 14:43:09 2017
New Revision: 315881

URL: http://llvm.org/viewvc/llvm-project?rev=315881&view=rev
Log:
Remove Config::FirstElf.

Modified:
    lld/trunk/ELF/Config.h
    lld/trunk/ELF/SymbolTable.cpp

Modified: lld/trunk/ELF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=315881&r1=315880&r2=315881&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Sun Oct 15 14:43:09 2017
@@ -72,7 +72,6 @@ struct VersionDefinition {
 // and such fields have the same name as the corresponding options.
 // Most fields are initialized by the driver.
 struct Configuration {
-  InputFile *FirstElf = nullptr;
   uint8_t OSABI = 0;
   llvm::CachePruningPolicy ThinLTOCachePolicy;
   llvm::StringMap<uint64_t> SectionStartMap;

Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=315881&r1=315880&r2=315881&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Sun Oct 15 14:43:09 2017
@@ -31,6 +31,14 @@ using namespace lld::elf;
 
 SymbolTable *elf::Symtab;
 
+static InputFile *getFirstElf() {
+  if (!ObjectFiles.empty())
+    return ObjectFiles[0];
+  if (!SharedFiles.empty())
+    return SharedFiles[0];
+  return nullptr;
+}
+
 // All input object files must be for the same architecture
 // (e.g. it does not make sense to link x86 object files with
 // MIPS object files.) This function checks for that error.
@@ -48,15 +56,12 @@ template <class ELFT> static bool isComp
   if (!Config->Emulation.empty())
     error(toString(F) + " is incompatible with " + Config->Emulation);
   else
-    error(toString(F) + " is incompatible with " + toString(Config->FirstElf));
+    error(toString(F) + " is incompatible with " + toString(getFirstElf()));
   return false;
 }
 
 // Add symbols in File to the symbol table.
 template <class ELFT> void SymbolTable::addFile(InputFile *File) {
-  if (!Config->FirstElf && isa<ELFFileBase<ELFT>>(File))
-    Config->FirstElf = File;
-
   if (!isCompatible<ELFT>(File))
     return;
 




More information about the llvm-commits mailing list