rustc: Get rustc compiling with LLVM 3.{3,4} again
The travis builds have been breaking recently because LLVM 3.5 upstream is changing. This looks like it's likely to continue, so it would be more useful for us if we could lock ourselves to a system LLVM version that is not changing. This commit has the support to bring our C++ glue to LLVM back in line with what was possible back in LLVM 3.{3,4}. I don't think we're going to be able to reasonably protect against regressions in the future, but this kind of code is a good sign that we can continue to use the system LLVM for simple-ish things. Codegen for ARM won't work and it won't have some of the perf improvements we have, but using the system LLVM should work well enough for development.
This commit is contained in:
parent
86177dbbcf
commit
1ac5e84e91
3 changed files with 78 additions and 8 deletions
|
@ -166,7 +166,11 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target,
|
|||
PassManager *PM = unwrap<PassManager>(PMR);
|
||||
|
||||
std::string ErrorInfo;
|
||||
#if LLVM_VERSION_MINOR >= 4
|
||||
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_None);
|
||||
#else
|
||||
raw_fd_ostream OS(path, ErrorInfo, raw_fd_ostream::F_Binary);
|
||||
#endif
|
||||
if (ErrorInfo != "") {
|
||||
LLVMRustError = ErrorInfo.c_str();
|
||||
return false;
|
||||
|
@ -184,9 +188,21 @@ LLVMRustPrintModule(LLVMPassManagerRef PMR,
|
|||
const char* path) {
|
||||
PassManager *PM = unwrap<PassManager>(PMR);
|
||||
std::string ErrorInfo;
|
||||
|
||||
#if LLVM_VERSION_MINOR >= 4
|
||||
raw_fd_ostream OS(path, ErrorInfo, sys::fs::F_None);
|
||||
#else
|
||||
raw_fd_ostream OS(path, ErrorInfo, raw_fd_ostream::F_Binary);
|
||||
#endif
|
||||
|
||||
formatted_raw_ostream FOS(OS);
|
||||
|
||||
#if LLVM_VERSION_MINOR >= 5
|
||||
PM->add(createPrintModulePass(FOS));
|
||||
#else
|
||||
PM->add(createPrintModulePass(&FOS));
|
||||
#endif
|
||||
|
||||
PM->run(*unwrap(M));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue