Skip to content

Commit d492fe0

Browse files
committed
rustc: Add some defines for LLVM 7 compat
I was testing out the tip support to see what's going on with wasm, and this was I believe the only issue encountered with LLVM 7 support so far.
1 parent 70f7d58 commit d492fe0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/rustllvm/PassWrapper.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,10 @@ struct LLVMRustThinLTOData {
836836
StringMap<FunctionImporter::ImportMapTy> ImportLists;
837837
StringMap<FunctionImporter::ExportSetTy> ExportLists;
838838
StringMap<GVSummaryMapTy> ModuleToDefinedGVSummaries;
839+
840+
#if LLVM_VERSION_GE(7, 0)
841+
LLVMRustThinLTOData() : Index(/* isPerformingAnalysis = */ false) {}
842+
#endif
839843
};
840844

841845
// Just an argument to the `LLVMRustCreateThinLTOData` function below.
@@ -918,7 +922,14 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
918922
//
919923
// This is copied from `lib/LTO/ThinLTOCodeGenerator.cpp`
920924
#if LLVM_VERSION_GE(5, 0)
925+
#if LLVM_VERSION_GE(7, 0)
926+
auto deadIsPrevailing = [&](GlobalValue::GUID G) {
927+
return PrevailingType::Unknown;
928+
};
929+
computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols, deadIsPrevailing);
930+
#else
921931
computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols);
932+
#endif
922933
ComputeCrossModuleImport(
923934
Ret->Index,
924935
Ret->ModuleToDefinedGVSummaries,

0 commit comments

Comments
 (0)