[PATCH] Limit internalization in LLVM 8 ThinLTO
authorJosh Stone <jistone@redhat.com>
Fri, 26 Apr 2019 15:58:14 +0000 (08:58 -0700)
committerXimin Luo <infinity0@debian.org>
Thu, 30 May 2019 04:52:37 +0000 (05:52 +0100)
Gbp-Pq: Name u-0001-Limit-internalization-in-LLVM-8-ThinLTO.patch

src/rustllvm/PassWrapper.cpp

index 25595e14982aee0ec6f721ecc2beabcf2c4fd842..95ff95312ab3ea2814aca0f3604eb98da3b5ec1e 100644 (file)
@@ -866,8 +866,11 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
     return PrevailingType::Unknown;
   };
 #if LLVM_VERSION_GE(8, 0)
+  // We don't have a complete picture in our use of ThinLTO, just our immediate
+  // crate, so we need `ImportEnabled = false` to limit internalization.
+  // Otherwise, we sometimes lose `static` values -- see #60184.
   computeDeadSymbolsWithConstProp(Ret->Index, Ret->GUIDPreservedSymbols,
-                                  deadIsPrevailing, /* ImportEnabled = */ true);
+                                  deadIsPrevailing, /* ImportEnabled = */ false);
 #else
   computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols, deadIsPrevailing);
 #endif