Skip to content

Commit 9f92668

Browse files
Emit error when trying to use PGO in conjunction with unwinding on Windows.
1 parent 837b72c commit 9f92668

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
@@ -1281,6 +1281,18 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
12811281
path.display()));
12821282
}
12831283
}
1284+
1285+
// PGO does not work reliably with panic=unwind on Windows. Let's make it
1286+
// an error to combine the two for now. It always runs into an assertions
1287+
// if LLVM is built with assertions, but without assertions it sometimes
1288+
// does not crash and will probably generate a corrupted binary.
1289+
if sess.opts.debugging_opts.pgo_gen.enabled() &&
1290+
sess.target.target.options.is_like_msvc &&
1291+
sess.panic_strategy() == PanicStrategy::Unwind {
1292+
sess.err("Profile-guided optimization does not yet work in conjunction \
1293+
with `-Cpanic=unwind` on Windows when targeting MSVC. \
1294+
See https://github.com/rust-lang/rust/issues/61002 for details.");
1295+
}
12841296
}
12851297

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

0 commit comments

Comments
 (0)