-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
Consider this basic example:
fn main() {
std::thread::sleep(std::time::Duration::from_secs_f64(1.0));
}When compiled with cargo build and the following Cargo.toml:
[profile.dev]
debug = false
strip = "symbols"we see the following profile with samply record:
That is, all symbols are still there. However, when we instead build with
[profile.dev]
debug = false
strip = "debuginfo"we see the following profile:
I believe this is a bug, as the documentation for strip specifies that symbols is supposed to be a more aggressive stripping than debuginfo, which is supposed to leave backtrace information mostly intact. We see the opposite behavior.
The following lines of code are suspect:
rust/compiler/rustc_codegen_ssa/src/back/link.rs
Lines 1103 to 1118 in bf6f8a4
| if sess.target.is_like_osx { | |
| let stripcmd = "rust-objcopy"; | |
| match (strip, crate_type) { | |
| (Strip::Debuginfo, _) => { | |
| strip_symbols_with_external_utility(sess, stripcmd, out_filename, &["-S"]) | |
| } | |
| // Per the manpage, `-x` is the maximum safe strip level for dynamic libraries. (#93988) | |
| (Strip::Symbols, CrateType::Dylib | CrateType::Cdylib | CrateType::ProcMacro) => { | |
| strip_symbols_with_external_utility(sess, stripcmd, out_filename, &["-x"]) | |
| } | |
| (Strip::Symbols, _) => { | |
| strip_symbols_with_external_utility(sess, stripcmd, out_filename, &[]) | |
| } | |
| (Strip::None, _) => {} | |
| } | |
| } |
-S on rust-objcopy is documented as such:
-S Alias for --strip-all
It does not seem appropriate to be used in the Debuginfo branch, but omitted in the Symbols branch.
