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>
Sat, 13 Jul 2019 17:30:35 +0000 (18:30 +0100)
Gbp-Pq: Name u-0001-Limit-internalization-in-LLVM-8-ThinLTO.patch

src/rustllvm/PassWrapper.cpp

index 319c66a21f17e433d453137dd345d519fea49b29..0ebef82d3768068380689db349b4c484953e662b 100644 (file)
@@ -873,8 +873,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