[PATCH] D91583: [LTO] Prevent devirtualization for symbols exported to dynamic linker

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 27 13:11:14 PST 2021


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

LG. There are several minor required comment/description changes and test updates.

> Under --export-dynamic[-symbol=] and --dynamic-list=, identify the exported symbols and prevent their LTO visibility from being upgraded.

The description needs a update now, something like: Identify the exported symbols (--export-dynamic[-symbol=], --dynamic-list=, or definitions needed to preempt shared objects)

> This helps avoid use of whole program devirtualization when there may be overrides in dynamically loaded libraries.

Perhaps just dynamic libraries. "dynamically loaded libraries" gives me a feeling of `dlopen`, but the issue can arise with regular link-time shared objects as well: it is valid for a new version shared object to add more symbols (derived classes with vtables).



================
Comment at: lld/test/ELF/lto/devirt_vcall_vis_export_dynamic.ll:2
+; REQUIRES: x86
+;; Test that --export-dynamic[-symbol] and --dynamic-list prevents devirtualization.
+
----------------
This needs an update (due to a new case: shared object preemption): exported symbols prevent devirtualization.


================
Comment at: lld/test/ELF/lto/devirt_vcall_vis_export_dynamic.ll:101
+;; Index based WPD
+; RUN opt -relocation-model=pic -o %t5.o %s
+; RUN: ld.lld %t5.o -o %t5.so -shared
----------------



================
Comment at: lld/test/ELF/lto/devirt_vcall_vis_export_dynamic.ll:107
+;; Hybrid WPD
+; RUN opt -relocation-model=pic --thinlto-bc -o %t5.o %s
+; RUN: ld.lld %t5.o -o %t5.so -shared
----------------



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