[lld] r244367 - COFF: Handle _load_config_used in the same way as other special symbols.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 15:43:54 PDT 2015


Author: ruiu
Date: Fri Aug  7 17:43:53 2015
New Revision: 244367

URL: http://llvm.org/viewvc/llvm-project?rev=244367&view=rev
Log:
COFF: Handle _load_config_used in the same way as other special symbols.

Handling the symbol this way is consistent with other symbols, such as
_tls_used. NFC.

Modified:
    lld/trunk/COFF/Config.h
    lld/trunk/COFF/Driver.cpp
    lld/trunk/COFF/Writer.cpp

Modified: lld/trunk/COFF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Config.h?rev=244367&r1=244366&r2=244367&view=diff
==============================================================================
--- lld/trunk/COFF/Config.h (original)
+++ lld/trunk/COFF/Config.h Fri Aug  7 17:43:53 2015
@@ -79,7 +79,6 @@ struct Configuration {
   std::vector<Export> Exports;
   std::set<std::string> DelayLoads;
   Undefined *DelayLoadHelper = nullptr;
-  StringRef LoadConfigUsed;
 
   // Used for SafeSEH.
   DefinedRelative *SEHTable = nullptr;

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=244367&r1=244366&r2=244367&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Fri Aug  7 17:43:53 2015
@@ -535,7 +535,6 @@ void LinkerDriver::link(llvm::ArrayRef<c
     Config->SEHTable = Symtab.addRelative("___safe_se_handler_table", 0);
     Config->SEHCount = Symtab.addAbsolute("___safe_se_handler_count", 0);
   }
-  Config->LoadConfigUsed = mangle("_load_config_used");
 
   // Read as much files as we can from directives sections.
   Symtab.run();
@@ -570,8 +569,8 @@ void LinkerDriver::link(llvm::ArrayRef<c
     }
 
     // Windows specific -- if __load_config_used can be resolved, resolve it.
-    if (Symtab.find(Config->LoadConfigUsed))
-      addUndefined(Config->LoadConfigUsed);
+    if (Symtab.findUnderscore("_load_config_used"))
+      addUndefined(mangle("_load_config_used"));
 
     if (Symtab.queueEmpty())
       break;

Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=244367&r1=244366&r2=244367&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Fri Aug  7 17:43:53 2015
@@ -661,7 +661,7 @@ template <typename PEHeaderTy> void Writ
       Dir[TLS_TABLE].Size = 40;
     }
   }
-  if (Symbol *Sym = Symtab->find(Config->LoadConfigUsed)) {
+  if (Symbol *Sym = Symtab->findUnderscore("_load_config_used")) {
     if (Defined *B = dyn_cast<Defined>(Sym->Body)) {
       Dir[LOAD_CONFIG_TABLE].RelativeVirtualAddress = B->getRVA();
       Dir[LOAD_CONFIG_TABLE].Size = Config->is64() ? 112 : 64;




More information about the llvm-commits mailing list