From 488d41e6ef15db0d646b8d770eb3ab11cf47f23f Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 27 Aug 2013 05:15:20 +0000 Subject: [PECOFF] Add the entry symbol and /include symbols to dead strip root set. Differential Revision: http://llvm-reviews.chandlerc.com/D1527 llvm-svn: 189318 --- lld/lib/Driver/WinLinkDriver.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lld/lib/Driver/WinLinkDriver.cpp') 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. -- cgit v1.2.3