From dd94dc3599dfc11fa703470525473864495c596d Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Tue, 21 May 2019 12:11:23 +0200 Subject: [PATCH] Emit error when trying to use PGO in conjunction with unwinding on Windows. --- src/librustc/session/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 4d47491661e86..71a9d17be8919 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -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