[PATCH] D43361: [ThinLTO] Enable AutoHide on symbols with local_unnamed_addr
Rafael Avila de Espindola via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 15 16:43:18 PDT 2018
espindola added a comment.
In https://reviews.llvm.org/D43361#1039665, @steven_wu wrote:
> > The solution is to use canBeOmittedFromSymbolTable from include/llvm/Object/IRSymtab.h.
> >
> > The symbol table is computed earlier and so the above predicate still returns 1. Your examples work with lld and ThinLTO if you want to check the implementation details.
>
> It is easy to get 1 correct. This patch is to get 2 to be hidden using LTO.
Using the IRSymtab also solves 2.
> Sure, linker can consult the symbol table in IRSymtab but the problem is how much can it be trusted? LTO can already add/remove symbols from IRSymtab. Is changing symbol linkage/visibility legal during LTO?
It can be trusted. That is what lld and the gold plugin are using. The only theoretical change I can think of is a pass adding a use and dropping local_unnamed_addr, but the linker will see that in the .o file that LTO produces.
Repository:
rL LLVM
https://reviews.llvm.org/D43361
More information about the llvm-commits
mailing list