|
11 | 11 | use back::bytecode::{DecodedBytecode, RLIB_BYTECODE_EXTENSION};
|
12 | 12 | use back::symbol_export;
|
13 | 13 | use back::write::{ModuleConfig, with_llvm_pmb, CodegenContext};
|
14 |
| -use back::write; |
| 14 | +use back::write::{self, DiagnosticHandlers}; |
15 | 15 | use errors::{FatalError, Handler};
|
16 | 16 | use llvm::archive_ro::ArchiveRO;
|
17 | 17 | use llvm::{True, False};
|
@@ -234,9 +234,17 @@ fn fat_lto(cgcx: &CodegenContext,
|
234 | 234 | let module = modules.remove(costliest_module);
|
235 | 235 | let mut serialized_bitcode = Vec::new();
|
236 | 236 | {
|
237 |
| - let llmod = module.llvm().expect("can't lto pre-codegened modules").llmod(); |
| 237 | + let (llcx, llmod) = { |
| 238 | + let llvm = module.llvm().expect("can't lto pre-codegened modules"); |
| 239 | + (&llvm.llcx, llvm.llmod()) |
| 240 | + }; |
238 | 241 | info!("using {:?} as a base module", module.llmod_id);
|
239 | 242 |
|
| 243 | + // The linking steps below may produce errors and diagnostics within LLVM |
| 244 | + // which we'd like to handle and print, so set up our diagnostic handlers |
| 245 | + // (which get unregistered when they go out of scope below). |
| 246 | + let _handler = DiagnosticHandlers::new(cgcx, diag_handler, llcx); |
| 247 | + |
240 | 248 | // For all other modules we codegened we'll need to link them into our own
|
241 | 249 | // bitcode. All modules were codegened in their own LLVM context, however,
|
242 | 250 | // and we want to move everything to the same LLVM context. Currently the
|
|
0 commit comments