Skip to content

Commit a6b8097

Browse files
authored
Rollup merge of #59911 - pnkfelix:revert-pr-59401-to-fix-emit-stack-sizes-gc-sections-ld-gold-bug, r=alexcrichton
Revert "compile crates under test w/ -Zemit-stack-sizes" Revert PR #59401 to fix issue #59652 (a stable-to-beta regression). This is result of squashing two revert commits: Revert "compile all crates under test w/ -Zemit-stack-sizes" This reverts commit 7d365cf. Revert "bootstrap: build compiler-builtins with -Z emit-stack-sizes" This reverts commit 8b8488c. ---- (My intention is that someone can re-add this code again later, either after the `ld.gold` issue itself is fixed, or with safe-guards to check whether `ld.gold` is in use and then issuing warnings about the problems here when they arise.)
2 parents 426ab8e + 633fc9e commit a6b8097

File tree

2 files changed

+0
-31
lines changed

2 files changed

+0
-31
lines changed

src/bootstrap/bin/rustc.rs

-27
Original file line numberDiff line numberDiff line change
@@ -187,33 +187,6 @@ fn main() {
187187
cmd.arg("-C").arg(format!("debug-assertions={}", debug_assertions));
188188
}
189189

190-
// Build all crates in the `std` facade with `-Z emit-stack-sizes` to add stack usage
191-
// information.
192-
//
193-
// When you use this `-Z` flag with Cargo you get stack usage information on all crates
194-
// compiled from source, and when you are using LTO you also get information on pre-compiled
195-
// crates like `core` and `std`, even if they were not compiled with `-Z emit-stack-sizes`.
196-
// However, there's an exception: `compiler_builtins`. This crate is special and doesn't
197-
// participate in LTO because it's always linked as a separate object file. For this reason
198-
// it's impossible to get stack usage information about `compiler-builtins` using
199-
// `RUSTFLAGS` + Cargo, or `cargo rustc`.
200-
//
201-
// To make the stack usage information of all crates under the `std` facade available to
202-
// Cargo based stack usage analysis tools, in both LTO and non-LTO mode, we compile them
203-
// with the `-Z emit-stack-sizes` flag. The `RUSTC_EMIT_STACK_SIZES` var helps us apply this
204-
// flag only to the crates in the `std` facade. The `-Z` flag is known to currently work
205-
// with targets that produce ELF files so we limit its use flag to those targets.
206-
//
207-
// NOTE(japaric) if this ever causes problem with an LLVM upgrade or any PR feel free to
208-
// remove it or comment it out
209-
if env::var_os("RUSTC_EMIT_STACK_SIZES").is_some()
210-
&& (target.contains("-linux-")
211-
|| target.contains("-none-eabi")
212-
|| target.ends_with("-none-elf"))
213-
{
214-
cmd.arg("-Zemit-stack-sizes");
215-
}
216-
217190
if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") {
218191
cmd.arg("-C").arg(format!("codegen-units={}", s));
219192
}

src/bootstrap/compile.rs

-4
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ impl Step for Std {
9797
let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage));
9898
builder.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage,
9999
&compiler.host, target));
100-
// compile with `-Z emit-stack-sizes`; see bootstrap/src/rustc.rs for more details
101-
cargo.env("RUSTC_EMIT_STACK_SIZES", "1");
102100
run_cargo(builder,
103101
&mut cargo,
104102
&libstd_stamp(builder, compiler, target),
@@ -397,8 +395,6 @@ impl Step for Test {
397395
let _folder = builder.fold_output(|| format!("stage{}-test", compiler.stage));
398396
builder.info(&format!("Building stage{} test artifacts ({} -> {})", compiler.stage,
399397
&compiler.host, target));
400-
// compile with `-Z emit-stack-sizes`; see bootstrap/src/rustc.rs for more details
401-
cargo.env("RUSTC_EMIT_STACK_SIZES", "1");
402398
run_cargo(builder,
403399
&mut cargo,
404400
&libtest_stamp(builder, compiler, target),

0 commit comments

Comments
 (0)