forked from OSchip/llvm-project
Fix a bug that the empty string could be added to dead strip root.
llvm-svn: 192772
This commit is contained in:
parent
2847831771
commit
c726c1962d
|
@ -88,6 +88,7 @@ public:
|
|||
/// deadStrip() returns true.
|
||||
void addDeadStripRoot(StringRef symbolName) {
|
||||
assert(_deadStrip && "only applicable when deadstripping enabled");
|
||||
assert(!symbolName.empty() && "Empty symbol cannot be a dead strip root");
|
||||
_deadStripRoots.push_back(symbolName);
|
||||
}
|
||||
|
||||
|
|
|
@ -501,7 +501,8 @@ WinLinkDriver::parse(int argc, const char *argv[], PECOFFLinkingContext &ctx,
|
|||
// 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());
|
||||
if (!ctx.entrySymbolName().empty())
|
||||
ctx.addDeadStripRoot(ctx.entrySymbolName());
|
||||
for (const StringRef symbolName : ctx.initialUndefinedSymbols())
|
||||
ctx.addDeadStripRoot(symbolName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue