}
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
bool TrapUnreachable,
bool Singlethread,
bool AsmComments,
- bool EmitStackSizeSection) {
+ bool EmitStackSizeSection,
+ bool RelaxELFRelocations) {
auto OptLevel = fromRust(RustOptLevel);
auto RM = fromRust(RustReloc);
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.
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;
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
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.
// combined index
//
// This is copied from `lib/LTO/ThinLTOCodeGenerator.cpp`
-#if LLVM_VERSION_GE(7, 0)
auto deadIsPrevailing = [&](GlobalValue::GUID G) {
return PrevailingType::Unknown;
};
deadIsPrevailing, /* ImportEnabled = */ false);
#else
computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols, deadIsPrevailing);
-#endif
-#else
- computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols);
#endif
ComputeCrossModuleImport(
Ret->Index,