return nullptr;
}
+std::error_code SymbolTable::resolveIfPossible(StringRef Name) {
+ auto It = Symtab.find(Name);
+ if (It != Symtab.end())
+ if (auto *B = dyn_cast<Lazy>(It->second->Body))
+ return addMemberFile(B);
+ return std::error_code();
+}
+
// Windows specific -- Link default entry point name.
ErrorOr<StringRef> SymbolTable::findDefaultEntry() {
// If it's DLL, the rule is easy.
{"wWinMain", "wWinMainCRTStartup"},
};
for (auto E : Entries) {
+ resolveIfPossible(E[1]);
if (find(E[1]))
return StringRef(E[1]);
if (!find(E[0]))
std::error_code addBitcode(BitcodeFile *File);
std::error_code resolve(SymbolBody *Body);
+ std::error_code resolveIfPossible(StringRef Name);
std::error_code addMemberFile(Lazy *Body);
ErrorOr<ObjectFile *> createLTOObject(llvm::LTOCodeGenerator *CG);
--- /dev/null
+; RUN: llvm-as -o %t.obj %s
+; RUN: rm -f %t.lib
+; RUN: llvm-ar cru %t.lib %t.obj
+; RUN: lld -flavor link2 /out:%t.exe %t.lib
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+define i32 @mainCRTStartup() {
+ ret i32 0
+}