From 50ac3b1d780fd385d50589641bfc91b95cd2d12f Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Mon, 15 Feb 2021 09:19:50 -0800 Subject: [gold] Match lld WPD behavior for shared library symbols and add test lld already marks shared library defs as ExportDynamic, which prevents potentially unsafe devirtualization of symbols defined in shared libraries. Match that behavior in the gold plugin, and add the same test. Depends on D96721. Differential Revision: https://reviews.llvm.org/D96722 --- llvm/tools/gold/gold-plugin.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/tools/gold') diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 38f9596..9870f3a 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -748,12 +748,15 @@ static void addModule(LTO &Lto, claimed_file &F, const void *View, case LDPR_RESOLVED_IR: case LDPR_RESOLVED_EXEC: - case LDPR_RESOLVED_DYN: case LDPR_PREEMPTED_IR: case LDPR_PREEMPTED_REG: case LDPR_UNDEF: break; + case LDPR_RESOLVED_DYN: + R.ExportDynamic = true; + break; + case LDPR_PREVAILING_DEF_IRONLY: R.Prevailing = !isUndefined(Sym); break; -- cgit v1.1