[PATCH] D50316: lld-link: Take /SUBSYSTEM into account for automatic /ENTRY detection.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 6 15:22:05 PDT 2018
ruiu added inline comments.
================
Comment at: lld/COFF/Driver.cpp:447
// need to define an entry point instead of a "main".
if (findUnderscoreMangle(E[Config->NoDefaultLibAll]))
return mangle(E[1]);
----------------
This function seems a bit tricky to me especially where a boolean value is used as 0 or 1 to access an array. Maybe something like this would work:
auto Find = [](StringRef X, StringRef Y) {
return findUnderscoreMangle(Config->NoDefaultLibAll ? Y : X);
};
if (Config->Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) {
if (find("main", "mainCRTStartup"))
return mangle("main");
if (find("wmain", "wmainCRTStartup"))
return mangle("wmain");
}
if (find("WinMain", "WinMainCRTStartup"))
return mangle("WinMain");
if (find("wWinMain", "wWinMainCRTStartup"))
return mangle("wWinMain");
return "";
https://reviews.llvm.org/D50316
More information about the llvm-commits
mailing list