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
This commit is contained in:
Rui Ueyama 2015-08-07 22:43:53 +00:00
parent 7d8c74ff3f
commit 8ebdc8cedc
3 changed files with 3 additions and 5 deletions

View File

@ -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;

View File

@ -535,7 +535,6 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> 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<const char *> 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;

View File

@ -661,7 +661,7 @@ template <typename PEHeaderTy> 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<Defined>(Sym->Body)) {
Dir[LOAD_CONFIG_TABLE].RelativeVirtualAddress = B->getRVA();
Dir[LOAD_CONFIG_TABLE].Size = Config->is64() ? 112 : 64;