summaryrefslogtreecommitdiffstats
path: root/lld/lib/Driver/WinLinkDriver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib/Driver/WinLinkDriver.cpp')
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp9
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.
OpenPOWER on IntegriCloud