[PATCH] D91583: [LTO] Prevent devirtualization for symbols dynamically exported

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 8 14:14:39 PST 2021


MaskRay added a comment.

In D91583#2612405 <https://reviews.llvm.org/D91583#2612405>, @lanza wrote:

>> To me this is WAI. Why is "config->shared" true for your bitcode module? This should only affect when using the linker flags that assert you have whole program visibility during the link, which isn't true for a shared library and its symbols.
>
> Got ya. For our Android apps we compute the actual `import` and `export` lists exactly and thus can compute the symbol visibility during linking and use `--lto-whole-program-visibility` accordingly. (Though this is not yet used in production for build system reasons). This change makes the list of symbols equivalent to the list of `DynamicExportSymbols`, so even though we can tell lld that `_ZTVN3xyz` is internal-only it won't get `vcall_visibility`.

The `sym->isExportDynamic(sym->kind(), sym->visibility) || sym->exportDynamic || sym->inDynamicList` condition is a bit conservative.
I sent D98220 <https://reviews.llvm.org/D98220> to allow WPD with hidden/internal symbols.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91583/new/

https://reviews.llvm.org/D91583



More information about the llvm-commits mailing list