Description
Code
I tried this code:
fn main() {}
With this section in Cargo.toml
:
[profile.release]
panic = 'abort'
lto = true
And also disabled msvcrt.lib. Unfortunately rust does not have a good way to do this so I used a build script to add a libs directory that contains an empty msvcrt.lib:
use std::{env, path::Path};
fn main() {
// Disable msvcrt.lib
let dir = env::var_os("CARGO_MANIFEST_DIR").unwrap();
let dir = Path::new(&dir).join("libs");
println!("cargo:rustc-link-search=native={}", dir.display());
}
For a full example see: https://github.com/ChrisDenton/panic-abort
I expected to see this happen: When running cargo build --release
, the symbol __CxxFrameHandler3
is not referenced at all. Because with panic=abort
there should be no panic code.
Instead, this happened: __CxxFrameHandler3
is referenced. This causes the following linker error because I disabled msvcrt.lib:
error LNK2001: unresolved external symbol __CxxFrameHandler3
Version it worked on
It most recently worked on: 1.59
rustc +1.59 --version --verbose
rustc 1.59.0 (9d1b2106e 2022-02-23)
binary: rustc
commit-hash: 9d1b2106e23b1abd32fce1f17267604a5102f57a
commit-date: 2022-02-23
host: x86_64-pc-windows-msvc
release: 1.59.0
LLVM version: 13.0.0
Version with regression
rustc +1.60 --version --verbose
:
rustc 1.60.0 (7737e0b5c 2022-04-04)
binary: rustc
commit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c
commit-date: 2022-04-04
host: x86_64-pc-windows-msvc
release: 1.60.0
LLVM version: 14.0.0
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged