mirror of
https://github.com/rust-lang/cargo
synced 2024-10-02 14:04:23 +00:00
Revert "Auto merge of #13630 - Kobzol:msvc-disable-release-strip, r=weihanglo"
This reverts commitfa619a9d16
, reversing changes made to1f6857dcfb
. See also <https://github.com/rust-lang/rust/pull/115120>
This commit is contained in:
parent
5f0294b15a
commit
4f002a5f46
|
@ -35,7 +35,6 @@
|
||||||
//! [`drain_the_queue`]: crate::core::compiler::job_queue
|
//! [`drain_the_queue`]: crate::core::compiler::job_queue
|
||||||
//! ["Cargo Target"]: https://doc.rust-lang.org/nightly/cargo/reference/cargo-targets.html
|
//! ["Cargo Target"]: https://doc.rust-lang.org/nightly/cargo/reference/cargo-targets.html
|
||||||
|
|
||||||
use cargo_platform::Cfg;
|
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -439,7 +438,6 @@ pub fn create_bcx<'a, 'gctx>(
|
||||||
&units,
|
&units,
|
||||||
&scrape_units,
|
&scrape_units,
|
||||||
host_kind_requested.then_some(explicit_host_kind),
|
host_kind_requested.then_some(explicit_host_kind),
|
||||||
&target_data,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut extra_compiler_args = HashMap::new();
|
let mut extra_compiler_args = HashMap::new();
|
||||||
|
@ -579,7 +577,6 @@ fn rebuild_unit_graph_shared(
|
||||||
roots: &[Unit],
|
roots: &[Unit],
|
||||||
scrape_units: &[Unit],
|
scrape_units: &[Unit],
|
||||||
to_host: Option<CompileKind>,
|
to_host: Option<CompileKind>,
|
||||||
target_data: &RustcTargetData<'_>,
|
|
||||||
) -> (Vec<Unit>, Vec<Unit>, UnitGraph) {
|
) -> (Vec<Unit>, Vec<Unit>, UnitGraph) {
|
||||||
let mut result = UnitGraph::new();
|
let mut result = UnitGraph::new();
|
||||||
// Map of the old unit to the new unit, used to avoid recursing into units
|
// Map of the old unit to the new unit, used to avoid recursing into units
|
||||||
|
@ -596,7 +593,6 @@ fn rebuild_unit_graph_shared(
|
||||||
root,
|
root,
|
||||||
false,
|
false,
|
||||||
to_host,
|
to_host,
|
||||||
target_data,
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
@ -623,7 +619,6 @@ fn traverse_and_share(
|
||||||
unit: &Unit,
|
unit: &Unit,
|
||||||
unit_is_for_host: bool,
|
unit_is_for_host: bool,
|
||||||
to_host: Option<CompileKind>,
|
to_host: Option<CompileKind>,
|
||||||
target_data: &RustcTargetData<'_>,
|
|
||||||
) -> Unit {
|
) -> Unit {
|
||||||
if let Some(new_unit) = memo.get(unit) {
|
if let Some(new_unit) = memo.get(unit) {
|
||||||
// Already computed, no need to recompute.
|
// Already computed, no need to recompute.
|
||||||
|
@ -641,7 +636,6 @@ fn traverse_and_share(
|
||||||
&dep.unit,
|
&dep.unit,
|
||||||
dep.unit_for.is_for_host(),
|
dep.unit_for.is_for_host(),
|
||||||
to_host,
|
to_host,
|
||||||
target_data,
|
|
||||||
);
|
);
|
||||||
new_dep_unit.hash(&mut dep_hash);
|
new_dep_unit.hash(&mut dep_hash);
|
||||||
UnitDep {
|
UnitDep {
|
||||||
|
@ -665,13 +659,8 @@ fn traverse_and_share(
|
||||||
_ => unit.kind,
|
_ => unit.kind,
|
||||||
};
|
};
|
||||||
|
|
||||||
let cfg = target_data.cfg(unit.kind);
|
|
||||||
let is_target_windows_msvc = cfg.contains(&Cfg::Name("windows".to_string()))
|
|
||||||
&& cfg.contains(&Cfg::KeyPair("target_env".to_string(), "msvc".to_string()));
|
|
||||||
let mut profile = unit.profile.clone();
|
let mut profile = unit.profile.clone();
|
||||||
// For MSVC, rustc currently treats -Cstrip=debuginfo same as -Cstrip=symbols, which causes
|
if profile.strip.is_deferred() {
|
||||||
// this optimization to also remove symbols and thus break backtraces.
|
|
||||||
if profile.strip.is_deferred() && !is_target_windows_msvc {
|
|
||||||
// If strip was not manually set, and all dependencies of this unit together
|
// If strip was not manually set, and all dependencies of this unit together
|
||||||
// with this unit have debuginfo turned off, we enable debuginfo stripping.
|
// with this unit have debuginfo turned off, we enable debuginfo stripping.
|
||||||
// This will remove pre-existing debug symbols coming from the standard library.
|
// This will remove pre-existing debug symbols coming from the standard library.
|
||||||
|
|
|
@ -634,9 +634,7 @@ fn strip_accepts_false_to_disable_strip() {
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporarily disabled on Windows due to https://github.com/rust-lang/rust/issues/122857
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
#[cfg(not(windows))]
|
|
||||||
fn strip_debuginfo_in_release() {
|
fn strip_debuginfo_in_release() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file(
|
||||||
|
@ -660,32 +658,7 @@ fn strip_debuginfo_in_release() {
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using -Cstrip=debuginfo in release mode by default is temporarily disabled on Windows due to
|
|
||||||
// https://github.com/rust-lang/rust/issues/122857
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
#[cfg(all(target_os = "windows", target_env = "msvc"))]
|
|
||||||
fn do_not_strip_debuginfo_in_release_on_windows() {
|
|
||||||
let p = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2015"
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/main.rs", "fn main() {}")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
p.cargo("build --release -v")
|
|
||||||
.with_stderr_does_not_contain("[..]strip=debuginfo[..]")
|
|
||||||
.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Temporarily disabled on Windows due to https://github.com/rust-lang/rust/issues/122857
|
|
||||||
#[cargo_test]
|
|
||||||
#[cfg(not(windows))]
|
|
||||||
fn strip_debuginfo_without_debug() {
|
fn strip_debuginfo_without_debug() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file(
|
||||||
|
|
|
@ -742,9 +742,7 @@ fn one_bin_multiple_examples() {
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporarily disabled on Windows due to https://github.com/rust-lang/rust/issues/122857
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
#[cfg(not(windows))]
|
|
||||||
fn example_with_release_flag() {
|
fn example_with_release_flag() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file(
|
||||||
|
|
Loading…
Reference in a new issue