From 8ebdc8cedce5408582cc1714d81ed5d139463dad Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Fri, 7 Aug 2015 22:43:53 +0000 Subject: [PATCH] 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. llvm-svn: 244367 --- lld/COFF/Config.h | 1 - lld/COFF/Driver.cpp | 5 ++--- lld/COFF/Writer.cpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lld/COFF/Config.h b/lld/COFF/Config.h index 3d74deffe29c..84794914dfec 100644 --- a/lld/COFF/Config.h +++ b/lld/COFF/Config.h @@ -79,7 +79,6 @@ struct Configuration { std::vector Exports; std::set DelayLoads; Undefined *DelayLoadHelper = nullptr; - StringRef LoadConfigUsed; // Used for SafeSEH. DefinedRelative *SEHTable = nullptr; diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index d363230f1ec0..7f136d6501e0 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -535,7 +535,6 @@ void LinkerDriver::link(llvm::ArrayRef ArgsArr) { 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 ArgsArr) { } // 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; diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp index 6ee77001d7c8..bc9e29be53a5 100644 --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -661,7 +661,7 @@ template void Writer::writeHeader() { 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(Sym->Body)) { Dir[LOAD_CONFIG_TABLE].RelativeVirtualAddress = B->getRVA(); Dir[LOAD_CONFIG_TABLE].Size = Config->is64() ? 112 : 64;