Skip to content

Commit dd94dc3

Browse files
Emit error when trying to use PGO in conjunction with unwinding on Windows.
1 parent 46ad3e1 commit dd94dc3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/librustc/session/mod.rs

+12
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,18 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
12721272
sess.err("Linker plugin based LTO is not supported together with \
12731273
`-C prefer-dynamic` when targeting MSVC");
12741274
}
1275+
1276+
// PGO does not work reliably with panic=unwind on Windows. Let's make it
1277+
// an error to combine the two for now. It always runs into an assertions
1278+
// if LLVM is built with assertions, but without assertions it sometimes
1279+
// does not crash and will probably generate a corrupted binary.
1280+
if sess.opts.debugging_opts.pgo_gen.enabled() &&
1281+
sess.target.target.options.is_like_windows &&
1282+
sess.panic_strategy() == PanicStrategy::Unwind {
1283+
sess.err("Profile-guided optimization does not yet work in conjunction \
1284+
with `-Cpanic=unwind` on Windows. \
1285+
See https://github.com/rust-lang/rust/issues/61002 for details.");
1286+
}
12751287
}
12761288

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

0 commit comments

Comments
 (0)