diff options
| author | Rui Ueyama <ruiu@google.com> | 2013-10-19 03:34:00 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2013-10-19 03:34:00 +0000 |
| commit | 9b759d9fa294268586839700aa891a5d0bcaec84 (patch) | |
| tree | 1b24d21fa7500c68aa9c7d78445069667945504c | |
| parent | 46bf8286db83dfa1ff61d9804cfcaced1e59ef60 (diff) | |
| download | bcm5719-llvm-9b759d9fa294268586839700aa891a5d0bcaec84.tar.gz bcm5719-llvm-9b759d9fa294268586839700aa891a5d0bcaec84.zip | |
Simplify WinLinkDriver. No functionality change.
llvm-svn: 193030
| -rw-r--r-- | lld/lib/Driver/WinLinkDriver.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp index 644fc0ac9eb..1fc008c22c1 100644 --- a/lld/lib/Driver/WinLinkDriver.cpp +++ b/lld/lib/Driver/WinLinkDriver.cpp @@ -490,6 +490,9 @@ WinLinkDriver::parse(int argc, const char *argv[], PECOFFLinkingContext &ctx, // Use the default entry name if /entry option is not given. if (ctx.entrySymbolName().empty()) ctx.setEntrySymbolName(getDefaultEntrySymbolName(ctx)); + StringRef entry = ctx.entrySymbolName(); + if (!entry.empty()) + ctx.addInitialUndefinedSymbol(entry); // Specifying both /opt:ref and /opt:noref is an error. if (parsedArgs->getLastArg(OPT_ref) && parsedArgs->getLastArg(OPT_ref_no)) { @@ -500,17 +503,9 @@ WinLinkDriver::parse(int argc, const char *argv[], PECOFFLinkingContext &ctx, // If dead-stripping is enabled, we need to add the entry symbol and // symbols given by /include to the dead strip root set, so that it // won't be removed from the output. - if (ctx.deadStrip()) { - StringRef entry = ctx.entrySymbolName(); - if (!entry.empty()) { - ctx.addInitialUndefinedSymbol(entry); - ctx.addDeadStripRoot(entry); - } - for (const StringRef symbolName : ctx.initialUndefinedSymbols()) { - ctx.addInitialUndefinedSymbol(entry); + if (ctx.deadStrip()) + for (const StringRef symbolName : ctx.initialUndefinedSymbols()) ctx.addDeadStripRoot(symbolName); - } - } // Arguments after "--" are interpreted as filenames even if they // start with a hypen or a slash. This is not compatible with link.exe |

