about summary refs log tree commit diff
path: root/src/rustllvm/PassWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-03 18:42:43 +0000
committerbors <bors@rust-lang.org>2019-12-03 18:42:43 +0000
commit7afe6d9d1f48b998cc88fe6f01ba0082788ba4b9 (patch)
tree3aee9f9527060f3c317417af80db7c0473cea5c5 /src/rustllvm/PassWrapper.cpp
parentf577b0ef6e637ab7a6095cdfe0b51fa3faf97050 (diff)
parent8dcb5326dd3f5a67d6cd9b0e1b1cb12424a69f2d (diff)
downloadrust-7afe6d9d1f48b998cc88fe6f01ba0082788ba4b9.tar.gz
rust-7afe6d9d1f48b998cc88fe6f01ba0082788ba4b9.zip
Auto merge of #66997 - Centril:rollup-uraqpgu, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #66750 (Update the `wasi` crate for `wasm32-wasi`)
 - #66878 (Move Sessions into (new) librustc_session)
 - #66903 (parse_enum_item -> parse_enum_variant)
 - #66951 (miri: add throw_machine_stop macro)
 - #66957 (Change Linker for x86_64-fortanix-unknown-sgx target to rust-lld)
 - #66960 ([const-prop] Fix ICE calculating enum discriminant)
 - #66973 (Update the minimum external LLVM to 7)

Failed merges:

r? @ghost
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
-rw-r--r--src/rustllvm/PassWrapper.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp
index a116ed282ac..1cb123e674c 100644
--- a/src/rustllvm/PassWrapper.cpp
+++ b/src/rustllvm/PassWrapper.cpp
@@ -101,11 +101,13 @@ extern "C" LLVMPassRef LLVMRustCreateModuleAddressSanitizerPass(bool Recover) {
 }
 
 extern "C" LLVMPassRef LLVMRustCreateMemorySanitizerPass(int TrackOrigins, bool Recover) {
-#if LLVM_VERSION_GE(8, 0)
+#if LLVM_VERSION_GE(9, 0)
   const bool CompileKernel = false;
 
   return wrap(createMemorySanitizerLegacyPassPass(
       MemorySanitizerOptions{TrackOrigins, Recover, CompileKernel}));
+#elif LLVM_VERSION_GE(8, 0)
+  return wrap(createMemorySanitizerLegacyPassPass(TrackOrigins, Recover));
 #else
   return wrap(createMemorySanitizerPass(TrackOrigins, Recover));
 #endif
@@ -393,7 +395,8 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
     bool TrapUnreachable,
     bool Singlethread,
     bool AsmComments,
-    bool EmitStackSizeSection) {
+    bool EmitStackSizeSection,
+    bool RelaxELFRelocations) {
 
   auto OptLevel = fromRust(RustOptLevel);
   auto RM = fromRust(RustReloc);
@@ -418,6 +421,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
   Options.MCOptions.AsmVerbose = AsmComments;
   Options.MCOptions.PreserveAsmComments = AsmComments;
   Options.MCOptions.ABIName = ABIStr;
+  Options.RelaxELFRelocations = RelaxELFRelocations;
 
   if (TrapUnreachable) {
     // Tell LLVM to codegen `unreachable` into an explicit trap instruction.
@@ -449,9 +453,7 @@ extern "C" void LLVMRustConfigurePassManagerBuilder(
     LLVMPassManagerBuilderRef PMBR, LLVMRustCodeGenOptLevel OptLevel,
     bool MergeFunctions, bool SLPVectorize, bool LoopVectorize, bool PrepareForThinLTO,
     const char* PGOGenPath, const char* PGOUsePath) {
-#if LLVM_VERSION_GE(7, 0)
   unwrap(PMBR)->MergeFunctions = MergeFunctions;
-#endif
   unwrap(PMBR)->SLPVectorize = SLPVectorize;
   unwrap(PMBR)->OptLevel = fromRust(OptLevel);
   unwrap(PMBR)->LoopVectorize = LoopVectorize;
@@ -558,12 +560,8 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, LLVMPassManagerRef PMR,
     return LLVMRustResult::Failure;
   }
 
-#if LLVM_VERSION_GE(7, 0)
   buffer_ostream BOS(OS);
   unwrap(Target)->addPassesToEmitFile(*PM, BOS, nullptr, FileType, false);
-#else
-  unwrap(Target)->addPassesToEmitFile(*PM, OS, FileType, false);
-#endif
   PM->run(*unwrap(M));
 
   // Apparently `addPassesToEmitFile` adds a pointer to our on-the-stack output
@@ -847,9 +845,7 @@ struct LLVMRustThinLTOData {
   StringMap<FunctionImporter::ExportSetTy> ExportLists;
   StringMap<GVSummaryMapTy> ModuleToDefinedGVSummaries;
 
-#if LLVM_VERSION_GE(7, 0)
   LLVMRustThinLTOData() : Index(/* HaveGVs = */ false) {}
-#endif
 };
 
 // Just an argument to the `LLVMRustCreateThinLTOData` function below.
@@ -920,7 +916,6 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
   // combined index
   //
   // This is copied from `lib/LTO/ThinLTOCodeGenerator.cpp`
-#if LLVM_VERSION_GE(7, 0)
   auto deadIsPrevailing = [&](GlobalValue::GUID G) {
     return PrevailingType::Unknown;
   };
@@ -933,9 +928,6 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
 #else
   computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols, deadIsPrevailing);
 #endif
-#else
-  computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols);
-#endif
   ComputeCrossModuleImport(
     Ret->Index,
     Ret->ModuleToDefinedGVSummaries,