summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2018-08-03 18:32:44 +0000
committerNico Weber <nicolasweber@gmx.de>2018-08-03 18:32:44 +0000
commit397985db5110031e526385905c30f5dede668d2b (patch)
treea405abacffe1df58ecdf2f682efd31ea7e876b32
parentc3dc8e65e250831173f1f9b6b7c0718e2b4d56c4 (diff)
downloadbcm5719-llvm-397985db5110031e526385905c30f5dede668d2b.tar.gz
bcm5719-llvm-397985db5110031e526385905c30f5dede668d2b.zip
lld-link: Simplify LinkerDriver::findDefaultEntry()
No intended behavior change. Not repeating the CRTStartup names makes fixing PR36523 simpler. https://reviews.llvm.org/D50253 llvm-svn: 338911
-rw-r--r--lld/COFF/Driver.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 72cbfcbc3ea..845808fcd2f 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -426,18 +426,6 @@ Symbol *LinkerDriver::addUndefined(StringRef Name) {
// each of which corresponds to a user-defined "main" function. This function
// infers an entry point from a user-defined "main" function.
StringRef LinkerDriver::findDefaultEntry() {
- // As a special case, if /nodefaultlib is given, we directly look for an
- // entry point. This is because, if no default library is linked, users
- // need to define an entry point instead of a "main".
- if (Config->NoDefaultLibAll) {
- for (StringRef S : {"mainCRTStartup", "wmainCRTStartup",
- "WinMainCRTStartup", "wWinMainCRTStartup"}) {
- if (findUnderscoreMangle(S))
- return mangle(S);
- }
- return "";
- }
-
// User-defined main functions and their corresponding entry points.
static const char *Entries[][2] = {
{"main", "mainCRTStartup"},
@@ -446,7 +434,10 @@ StringRef LinkerDriver::findDefaultEntry() {
{"wWinMain", "wWinMainCRTStartup"},
};
for (auto E : Entries) {
- if (findUnderscoreMangle(E[0]))
+ // As a special case, if /nodefaultlib is given, we directly look for an
+ // entry point. This is because, if no default library is linked, users
+ // need to define an entry point instead of a "main".
+ if (findUnderscoreMangle(E[Config->NoDefaultLibAll]))
return mangle(E[1]);
}
return "";
OpenPOWER on IntegriCloud