[PATCH] D33621: Fix for -wrap linker option and LTO, PR 33145

Dmitry Mikulin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 11:56:37 PDT 2017


dmikulin added inline comments.


================
Comment at: lld/ELF/SymbolTable.cpp:203-231
 template <class ELFT> void SymbolTable<ELFT>::wrap(StringRef Name) {
-  SymbolBody *B = find(Name);
-  if (!B)
+  SymbolBody *SB = find(Name);
+  if (!SB)
     return;
-  Symbol *Sym = B->symbol();
-  Symbol *Real = addUndefined(Saver.save("__real_" + Name));
-  Symbol *Wrap = addUndefined(Saver.save("__wrap_" + Name));
+  Symbol *Sym = SB->symbol();
+  SymbolBody *RB = find("__real_" + Name.str());
+  SymbolBody *WB = find("__wrap_" + Name.str());
----------------
pcc wrote:
> dmikulin wrote:
> > pcc wrote:
> > > Can we now replace these functions with something that applies the rename to each symbol in `Config->RenamedSymbols`? I think it should be possible with this change to how we declare `RenamedSymbols`.
> > > 
> > > ```
> > > struct RenamedSymbol {
> > >   uint8_t OrigBinding;
> > >   Symbol *Target;
> > > };
> > > MapVector<Symbol*, RenamedSymbol> RenamedSymbols;
> > > ```
> > But __wrap_ symbols are different: they need to be on the list, but they are not being replaced.
> They only need to be marked as `IsUsedInRegularObj`. And that's taken care of for you by `addUndefined`.
Map it to NULL?


https://reviews.llvm.org/D33621





More information about the llvm-commits mailing list