Skip to content

Commit

Permalink
Rollup merge of rust-lang#61005 - michaelwoerister:error-pgo-windows-…
Browse files Browse the repository at this point in the history
…unwind, r=zackmdavis

Emit error when trying to use PGO in conjunction with unwinding on Windows.

This PR makes `rustc` emit an error when trying use PGO in conjunction with `-Cpanic=unwind` on Windows, isn't supported by LLVM yet. The error messages points to rust-lang#61002, which documents this known limitation.
  • Loading branch information
Centril authored May 21, 2019
2 parents c778205 + dd94dc3 commit 18d728c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,18 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
sess.err("Linker plugin based LTO is not supported together with \
`-C prefer-dynamic` when targeting MSVC");
}

// PGO does not work reliably with panic=unwind on Windows. Let's make it
// an error to combine the two for now. It always runs into an assertions
// if LLVM is built with assertions, but without assertions it sometimes
// does not crash and will probably generate a corrupted binary.
if sess.opts.debugging_opts.pgo_gen.enabled() &&
sess.target.target.options.is_like_windows &&
sess.panic_strategy() == PanicStrategy::Unwind {
sess.err("Profile-guided optimization does not yet work in conjunction \
with `-Cpanic=unwind` on Windows. \
See https://github.com/rust-lang/rust/issues/61002 for details.");
}
}

/// Hash value constructed out of all the `-C metadata` arguments passed to the
Expand Down

0 comments on commit 18d728c

Please sign in to comment.