ELF: Implement --wrap.
In this patch, all symbols are resolved normally and then wrap options
are applied. Renaming is implemented by mutating `Body` pointers of
Symbols. (As a result, Symtab.find(SymbolName)->getName() may return
a string that's different from SymbolName, but that is by design.
I designed the symbol and the symbol table to allow this kind of
operations.)
http://reviews.llvm.org/D15896
llvm-svn: 257075
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index da666cf..12ad8ec 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -310,6 +310,9 @@
for (StringRef S : Config->Undefined)
Symtab.addUndefinedOpt(S);
+ for (auto *Arg : Args.filtered(OPT_wrap))
+ Symtab.wrap(Arg->getValue());
+
if (Config->OutputFile.empty())
Config->OutputFile = "a.out";