std::vector<Export> Exports;
std::set<std::string> DelayLoads;
Undefined *DelayLoadHelper = nullptr;
+ StringRef LoadConfigUsed;
// Used for SafeSEH.
DefinedRelative *SEHTable = nullptr;
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.
if (auto EC = Symtab.run()) {
}
// Windows specific -- if __load_config_used can be resolved, resolve it.
- if (Config->Machine == I386)
- if (Symbol *Sym = Symtab.find("__load_config_used"))
- if (isa<Lazy>(Sym->Body))
- Symtab.addUndefined("__load_config_used");
+ if (Symbol *Sym = Symtab.find(Config->LoadConfigUsed))
+ if (isa<Lazy>(Sym->Body))
+ Symtab.addUndefined(Config->LoadConfigUsed);
if (Symtab.queueEmpty())
break;
Dir[TLS_TABLE].Size = 40;
}
}
- if (Symbol *Sym = Symtab->findUnderscore("_load_config_used")) {
+ if (Symbol *Sym = Symtab->find(Config->LoadConfigUsed)) {
if (Defined *B = dyn_cast<Defined>(Sym->Body)) {
Dir[LOAD_CONFIG_TABLE].RelativeVirtualAddress = B->getRVA();
- Dir[LOAD_CONFIG_TABLE].Size = 64;
+ Dir[LOAD_CONFIG_TABLE].Size = Config->is64() ? 112 : 64;
}
}
--- /dev/null
+# RUN: yaml2obj < %s > %t.obj
+# RUN: lld -flavor link2 /out:%t.exe %t.obj /entry:main /subsystem:console
+# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
+
+# CHECK: LoadConfigTableRVA: 0x1000
+# CHECK: LoadConfigTableSize: 0x70
+
+---
+header:
+ Machine: IMAGE_FILE_MACHINE_AMD64
+ Characteristics: []
+sections:
+ - Name: .text
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ SectionData: B82A000000C3
+symbols:
+ - Name: .text
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 6
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
+ - Name: main
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: _load_config_used
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...