Skip to content

Commit

Permalink
Move error on -Cinstrument-coverage earlier and elaborate that it is …
Browse files Browse the repository at this point in the history
…LLVM specific

cc #1494
  • Loading branch information
bjorn3 committed Jun 4, 2024
1 parent 8f1d41e commit eb449c1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,19 @@ impl CodegenBackend for CraneliftCodegenBackend {
}

fn init(&self, sess: &Session) {
use rustc_session::config::Lto;
use rustc_session::config::{InstrumentCoverage, Lto};
match sess.lto() {
Lto::No | Lto::ThinLocal => {}
Lto::Thin | Lto::Fat => {
sess.dcx().warn("LTO is not supported. You may get a linker error.")
}
}

if sess.opts.cg.instrument_coverage() != InstrumentCoverage::No {
sess.dcx()
.fatal("`-Cinstrument-coverage` is LLVM specific and not supported by Cranelift");
}

let mut config = self.config.borrow_mut();
if config.is_none() {
let new_config = BackendConfig::from_opts(&sess.opts.cg.llvm_args)
Expand Down

0 comments on commit eb449c1

Please sign in to comment.