diff options
author | Teresa Johnson <tejohnson@google.com> | 2020-12-30 15:56:53 -0800 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2021-01-27 15:54:13 -0800 |
commit | 1487747e990ce9f8851f3d92c3006a74134d7518 (patch) | |
tree | dd10c1157a066f0da3125a1168d5c18ea37fd71f /llvm/tools/gold | |
parent | 6110e7716cd0000fdeb2a7edfbec7c9991f1a08a (diff) | |
download | llvm-1487747e990ce9f8851f3d92c3006a74134d7518.zip llvm-1487747e990ce9f8851f3d92c3006a74134d7518.tar.gz llvm-1487747e990ce9f8851f3d92c3006a74134d7518.tar.bz2 |
[LTO] Prevent devirtualization for symbols dynamically exported
Identify dynamically exported symbols (--export-dynamic[-symbol=],
--dynamic-list=, or definitions needed to preempt shared objects) and
prevent their LTO visibility from being upgraded.
This helps avoid use of whole program devirtualization when there may
be overrides in dynamic libraries.
Differential Revision: https://reviews.llvm.org/D91583
Diffstat (limited to 'llvm/tools/gold')
-rw-r--r-- | llvm/tools/gold/gold-plugin.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 94a26bb..c0e0d5b 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -765,6 +765,9 @@ static void addModule(LTO &Lto, claimed_file &F, const void *View, case LDPR_PREVAILING_DEF_IRONLY_EXP: R.Prevailing = !isUndefined(Sym); + // Identify symbols exported dynamically, and that therefore could be + // referenced by a shared library not visible to the linker. + R.ExportDynamic = true; if (!Res.CanOmitFromDynSym) R.VisibleToRegularObj = true; break; |