diff options
| author | Rui Ueyama <ruiu@google.com> | 2013-08-27 05:15:20 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2013-08-27 05:15:20 +0000 |
| commit | 488d41e6ef15db0d646b8d770eb3ab11cf47f23f (patch) | |
| tree | 76a5f8302abbf1b607e684a8b39db063b58415d6 /lld/lib/Driver/WinLinkDriver.cpp | |
| parent | 510938e5283ac05b0b9fa52e0bd39695ca0f6531 (diff) | |
| download | bcm5719-llvm-488d41e6ef15db0d646b8d770eb3ab11cf47f23f.tar.gz bcm5719-llvm-488d41e6ef15db0d646b8d770eb3ab11cf47f23f.zip | |
[PECOFF] Add the entry symbol and /include symbols to dead strip root set.
Differential Revision: http://llvm-reviews.chandlerc.com/D1527
llvm-svn: 189318
Diffstat (limited to 'lld/lib/Driver/WinLinkDriver.cpp')
| -rw-r--r-- | lld/lib/Driver/WinLinkDriver.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp index 1a0602c5848..a49c8c9944b 100644 --- a/lld/lib/Driver/WinLinkDriver.cpp +++ b/lld/lib/Driver/WinLinkDriver.cpp @@ -436,6 +436,15 @@ bool WinLinkDriver::parse(int argc, const char *argv[], return true; } + // 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()) { + ctx.addDeadStripRoot(ctx.entrySymbolName()); + 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 // but useful for us to test lld on Unix. |

