[PATCH] D34993: Refine our --wrap implementation

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 13:11:56 PDT 2017


Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:

> ruiu added inline comments.
>
>
> ================
> Comment at: ELF/SymbolTable.cpp:169
> +  auto It = Symtab.find(CachedHashStringRef(Wrap->body()->getName()));
> +  std::pair<unsigned, Symbol *> Foo =
> +      std::make_pair<unsigned, Symbol *>(It->second.Idx, (Symbol *)Real);
> ----------------
> Foo?
Fixed

>
> ================
> Comment at: ELF/SymbolTable.cpp:170
> +  std::pair<unsigned, Symbol *> Foo =
> +      std::make_pair<unsigned, Symbol *>(It->second.Idx, (Symbol *)Real);
> +  WrapSymbols.push_back(Foo);
> ----------------
> Real is already a Symbol*.
Fixed

>
> ================
> Comment at: ELF/SymbolTable.cpp:193-195
> +  // __real_foo becomes foo
> +  // foo        becomes __wrap_foo
> +  // __wrap_foo becomes __real_foo
> ----------------
> Is this correct? I thought foo becomes real_foo and wrap_foo becomes foo.

It is correct with the followup observation:

// The last part is special in that we don't want to change what references to
// __wrap_foo point to, we just want to use its spot in the symboltable.

The main use of the option is to convert foo to __wrap_foo. Maybe we are
reading "becomes" in opposite directions?

Cheers,
Rafael



More information about the llvm-commits mailing list