Blame SOURCES/0001-Limit-internalization-in-LLVM-8-ThinLTO.patch

Pablo Greco 3f2336
From b4131e297e18fde119f6f461b3e622218166b009 Mon Sep 17 00:00:00 2001
Pablo Greco 3f2336
From: Josh Stone <jistone@redhat.com>
Pablo Greco 3f2336
Date: Fri, 26 Apr 2019 08:58:14 -0700
Pablo Greco 3f2336
Subject: [PATCH] Limit internalization in LLVM 8 ThinLTO
Pablo Greco 3f2336
Pablo Greco 3f2336
---
Pablo Greco 3f2336
 src/rustllvm/PassWrapper.cpp | 5 ++++-
Pablo Greco 3f2336
 1 file changed, 4 insertions(+), 1 deletion(-)
Pablo Greco 3f2336
Pablo Greco 3f2336
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp
Pablo Greco 3f2336
index 319c66a21f17..0ebef82d3768 100644
Pablo Greco 3f2336
--- a/src/rustllvm/PassWrapper.cpp
Pablo Greco 3f2336
+++ b/src/rustllvm/PassWrapper.cpp
Pablo Greco 3f2336
@@ -873,8 +873,11 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
Pablo Greco 3f2336
     return PrevailingType::Unknown;
Pablo Greco 3f2336
   };
Pablo Greco 3f2336
 #if LLVM_VERSION_GE(8, 0)
Pablo Greco 3f2336
+  // We don't have a complete picture in our use of ThinLTO, just our immediate
Pablo Greco 3f2336
+  // crate, so we need `ImportEnabled = false` to limit internalization.
Pablo Greco 3f2336
+  // Otherwise, we sometimes lose `static` values -- see #60184.
Pablo Greco 3f2336
   computeDeadSymbolsWithConstProp(Ret->Index, Ret->GUIDPreservedSymbols,
Pablo Greco 3f2336
-                                  deadIsPrevailing, /* ImportEnabled = */ true);
Pablo Greco 3f2336
+                                  deadIsPrevailing, /* ImportEnabled = */ false);
Pablo Greco 3f2336
 #else
Pablo Greco 3f2336
   computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols, deadIsPrevailing);
Pablo Greco 3f2336
 #endif
Pablo Greco 3f2336
-- 
Pablo Greco 3f2336
2.20.1
Pablo Greco 3f2336