Skip to content

Commit 371917a

Browse files
committed
Auto merge of #74613 - Mark-Simulacrum:revert-gimli, r=nnethercote
Revert libbacktrace -> gimli This reverts 4cbd265 028f8d7 13db3cc d7a36d8 (and technically 79673d3 but it's made empty by previous reverts). The current plan is to land this PR as a temporary change, so that we can get a better handle on the regressions introduced by it. Trying to fix/examine them in master is difficult, and we want to be better able to evaluate them without impact to other PRs being landed in the mean time. That said, it is currently *my* belief that gimli, in one form or another, will need to land sometime soon. I think it's quite likely that it may slip a week or two, but I would personally push for re-landing it then "regardless" of the regressions. We should try to focus efforts on understanding and removing as much of the performance impact as possible, as everyone pretty much agrees that it should be quite minimal (and entirely in the linker, basically). r? @nnethercote
2 parents 2bbfa02 + b747a33 commit 371917a

14 files changed

+55
-108
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,3 @@
4444
[submodule "src/tools/rust-analyzer"]
4545
path = src/tools/rust-analyzer
4646
url = https://github.com/rust-analyzer/rust-analyzer.git
47-
[submodule "src/backtrace"]
48-
path = src/backtrace
49-
url = https://github.com/rust-lang/backtrace-rs.git

Cargo.lock

+29-59
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,10 @@
11
# This file is automatically @generated by Cargo.
22
# It is not intended for manual editing.
33
[[package]]
4-
name = "addr2line"
5-
version = "0.13.0"
6-
source = "registry+https://github.com/rust-lang/crates.io-index"
7-
checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072"
8-
dependencies = [
9-
"compiler_builtins",
10-
"gimli",
11-
"rustc-std-workspace-alloc",
12-
"rustc-std-workspace-core",
13-
]
14-
15-
[[package]]
16-
name = "adler"
17-
version = "0.2.2"
4+
name = "adler32"
5+
version = "1.0.3"
186
source = "registry+https://github.com/rust-lang/crates.io-index"
19-
checksum = "ccc9a9dd069569f212bc4330af9f17c4afb5e8ce185e83dbb14f1349dda18b10"
20-
dependencies = [
21-
"compiler_builtins",
22-
"rustc-std-workspace-core",
23-
]
7+
checksum = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
248

259
[[package]]
2610
name = "aho-corasick"
@@ -141,14 +125,28 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
141125

142126
[[package]]
143127
name = "backtrace"
144-
version = "0.3.50"
128+
version = "0.3.46"
129+
source = "registry+https://github.com/rust-lang/crates.io-index"
130+
checksum = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e"
145131
dependencies = [
146-
"addr2line",
132+
"backtrace-sys",
147133
"cfg-if",
134+
"compiler_builtins",
148135
"libc",
149-
"miniz_oxide",
150-
"object",
151136
"rustc-demangle",
137+
"rustc-std-workspace-core",
138+
]
139+
140+
[[package]]
141+
name = "backtrace-sys"
142+
version = "0.1.37"
143+
source = "registry+https://github.com/rust-lang/crates.io-index"
144+
checksum = "18fbebbe1c9d1f383a9cc7e8ccdb471b91c8d024ee9c2ca5b5346121fe8b4399"
145+
dependencies = [
146+
"cc",
147+
"compiler_builtins",
148+
"libc",
149+
"rustc-std-workspace-core",
152150
]
153151

154152
[[package]]
@@ -690,9 +688,9 @@ dependencies = [
690688

691689
[[package]]
692690
name = "crc32fast"
693-
version = "1.2.0"
691+
version = "1.1.2"
694692
source = "registry+https://github.com/rust-lang/crates.io-index"
695-
checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
693+
checksum = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192"
696694
dependencies = [
697695
"cfg-if",
698696
]
@@ -1025,9 +1023,9 @@ checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
10251023

10261024
[[package]]
10271025
name = "flate2"
1028-
version = "1.0.16"
1026+
version = "1.0.12"
10291027
source = "registry+https://github.com/rust-lang/crates.io-index"
1030-
checksum = "68c90b0fc46cf89d227cc78b40e494ff81287a92dd07631e5af0d06fe3cf885e"
1028+
checksum = "ad3c5233c9a940c8719031b423d7e6c16af66e031cb0420b0896f5245bf181d3"
10311029
dependencies = [
10321030
"cfg-if",
10331031
"crc32fast",
@@ -1161,17 +1159,6 @@ dependencies = [
11611159
"wasi",
11621160
]
11631161

1164-
[[package]]
1165-
name = "gimli"
1166-
version = "0.22.0"
1167-
source = "registry+https://github.com/rust-lang/crates.io-index"
1168-
checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
1169-
dependencies = [
1170-
"compiler_builtins",
1171-
"rustc-std-workspace-alloc",
1172-
"rustc-std-workspace-core",
1173-
]
1174-
11751162
[[package]]
11761163
name = "git2"
11771164
version = "0.13.5"
@@ -1832,14 +1819,11 @@ dependencies = [
18321819

18331820
[[package]]
18341821
name = "miniz_oxide"
1835-
version = "0.4.0"
1822+
version = "0.3.5"
18361823
source = "registry+https://github.com/rust-lang/crates.io-index"
1837-
checksum = "be0f75932c1f6cfae3c04000e40114adf955636e19040f9c0a2c380702aa1c7f"
1824+
checksum = "6f3f74f726ae935c3f514300cc6773a0c9492abc5e972d42ba0c0ebb88757625"
18381825
dependencies = [
1839-
"adler",
1840-
"compiler_builtins",
1841-
"rustc-std-workspace-alloc",
1842-
"rustc-std-workspace-core",
1826+
"adler32",
18431827
]
18441828

18451829
[[package]]
@@ -1971,17 +1955,6 @@ dependencies = [
19711955
"libc",
19721956
]
19731957

1974-
[[package]]
1975-
name = "object"
1976-
version = "0.20.0"
1977-
source = "registry+https://github.com/rust-lang/crates.io-index"
1978-
checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
1979-
dependencies = [
1980-
"compiler_builtins",
1981-
"rustc-std-workspace-alloc",
1982-
"rustc-std-workspace-core",
1983-
]
1984-
19851958
[[package]]
19861959
name = "once_cell"
19871960
version = "1.1.0"
@@ -4373,8 +4346,8 @@ dependencies = [
43734346
name = "std"
43744347
version = "0.0.0"
43754348
dependencies = [
4376-
"addr2line",
43774349
"alloc",
4350+
"backtrace",
43784351
"cfg-if",
43794352
"compiler_builtins",
43804353
"core",
@@ -4383,13 +4356,10 @@ dependencies = [
43834356
"hashbrown",
43844357
"hermit-abi",
43854358
"libc",
4386-
"miniz_oxide",
4387-
"object",
43884359
"panic_abort",
43894360
"panic_unwind",
43904361
"profiler_builtins",
43914362
"rand 0.7.3",
4392-
"rustc-demangle",
43934363
"unwind",
43944364
"wasi",
43954365
]

Cargo.toml

-6
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,5 @@ rustc-std-workspace-core = { path = 'src/tools/rustc-std-workspace-core' }
8080
rustc-std-workspace-alloc = { path = 'src/tools/rustc-std-workspace-alloc' }
8181
rustc-std-workspace-std = { path = 'src/tools/rustc-std-workspace-std' }
8282

83-
# This crate's integration with libstd is a bit wonky, so we use a submodule
84-
# instead of a crates.io dependency. Make sure everything else in the repo is
85-
# also using the submodule, however, so we can avoid duplicate copies of the
86-
# source code for this crate.
87-
backtrace = { path = "src/backtrace" }
88-
8983
[patch."https://github.com/rust-lang/rust-clippy"]
9084
clippy_lints = { path = "src/tools/clippy/clippy_lints" }

rustfmt.toml

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ ignore = [
3030
"src/tools/rust-analyzer",
3131
"src/tools/rust-installer",
3232
"src/tools/rustfmt",
33-
"src/backtrace",
3433

3534
# We do not format this file as it is externally sourced and auto-generated.
3635
"src/libstd/sys/cloudabi/abi/cloudabi.rs",

src/backtrace

-1
This file was deleted.

src/bootstrap/dist.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,6 @@ impl Step for Src {
10051005
// (essentially libstd and all of its path dependencies)
10061006
let std_src_dirs = [
10071007
"src/build_helper",
1008-
"src/backtrace/src",
10091008
"src/liballoc",
10101009
"src/libcore",
10111010
"src/libpanic_abort",

src/libstd/Cargo.toml

+9-14
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,11 @@ profiler_builtins = { path = "../libprofiler_builtins", optional = true }
2424
unwind = { path = "../libunwind" }
2525
hashbrown = { version = "0.6.2", default-features = false, features = ['rustc-dep-of-std'] }
2626

27-
# Dependencies of the `backtrace` crate
28-
addr2line = { version = "0.13.0", optional = true, default-features = false }
29-
rustc-demangle = { version = "0.1.4", features = ['rustc-dep-of-std'] }
30-
miniz_oxide = { version = "0.4.0", optional = true, default-features = false }
31-
[dependencies.object]
32-
version = "0.20"
33-
optional = true
34-
default-features = false
35-
features = ['read_core', 'elf', 'macho', 'pe']
27+
[dependencies.backtrace_rs]
28+
package = "backtrace"
29+
version = "0.3.46"
30+
default-features = false # without the libstd `backtrace` feature, stub out everything
31+
features = [ "rustc-dep-of-std" ] # enable build support for integrating into libstd
3632

3733
[dev-dependencies]
3834
rand = "0.7"
@@ -51,12 +47,11 @@ wasi = { version = "0.9.0", features = ['rustc-dep-of-std'], default-features =
5147

5248
[features]
5349
backtrace = [
54-
"gimli-symbolize",
55-
'addr2line/rustc-dep-of-std',
56-
'object/rustc-dep-of-std',
57-
'miniz_oxide/rustc-dep-of-std',
50+
"backtrace_rs/dbghelp", # backtrace/symbolize on MSVC
51+
"backtrace_rs/libbacktrace", # symbolize on most platforms
52+
"backtrace_rs/libunwind", # backtrace on most platforms
53+
"backtrace_rs/dladdr", # symbolize on platforms w/o libbacktrace
5854
]
59-
gimli-symbolize = []
6055

6156
panic-unwind = ["panic_unwind"]
6257
profiler = ["profiler_builtins"]

src/libstd/backtrace.rs

+11-10
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,15 @@
9191
// `Backtrace`, but that's a relatively small price to pay relative to capturing
9292
// a backtrace or actually symbolizing it.
9393

94-
use crate::backtrace_rs::{self, BytesOrWideString};
9594
use crate::env;
9695
use crate::ffi::c_void;
9796
use crate::fmt;
9897
use crate::sync::atomic::{AtomicUsize, Ordering::SeqCst};
9998
use crate::sync::Mutex;
10099
use crate::sys_common::backtrace::{lock, output_filename};
101100
use crate::vec::Vec;
101+
use backtrace::BytesOrWideString;
102+
use backtrace_rs as backtrace;
102103

103104
/// A captured OS thread stack backtrace.
104105
///
@@ -149,7 +150,7 @@ struct BacktraceFrame {
149150
}
150151

151152
enum RawFrame {
152-
Actual(backtrace_rs::Frame),
153+
Actual(backtrace::Frame),
153154
#[cfg(test)]
154155
Fake,
155156
}
@@ -196,7 +197,7 @@ impl fmt::Debug for BacktraceSymbol {
196197
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
197198
write!(fmt, "{{ ")?;
198199

199-
if let Some(fn_name) = self.name.as_ref().map(|b| backtrace_rs::SymbolName::new(b)) {
200+
if let Some(fn_name) = self.name.as_ref().map(|b| backtrace::SymbolName::new(b)) {
200201
write!(fmt, "fn: \"{:#}\"", fn_name)?;
201202
} else {
202203
write!(fmt, "fn: <unknown>")?;
@@ -222,7 +223,7 @@ impl fmt::Debug for BytesOrWide {
222223
BytesOrWide::Bytes(w) => BytesOrWideString::Bytes(w),
223224
BytesOrWide::Wide(w) => BytesOrWideString::Wide(w),
224225
},
225-
backtrace_rs::PrintFmt::Short,
226+
backtrace::PrintFmt::Short,
226227
crate::env::current_dir().as_ref().ok(),
227228
)
228229
}
@@ -304,7 +305,7 @@ impl Backtrace {
304305
let mut frames = Vec::new();
305306
let mut actual_start = None;
306307
unsafe {
307-
backtrace_rs::trace_unsynchronized(|frame| {
308+
backtrace::trace_unsynchronized(|frame| {
308309
frames.push(BacktraceFrame {
309310
frame: RawFrame::Actual(frame.clone()),
310311
symbols: Vec::new(),
@@ -355,9 +356,9 @@ impl fmt::Display for Backtrace {
355356

356357
let full = fmt.alternate();
357358
let (frames, style) = if full {
358-
(&capture.frames[..], backtrace_rs::PrintFmt::Full)
359+
(&capture.frames[..], backtrace::PrintFmt::Full)
359360
} else {
360-
(&capture.frames[capture.actual_start..], backtrace_rs::PrintFmt::Short)
361+
(&capture.frames[capture.actual_start..], backtrace::PrintFmt::Short)
361362
};
362363

363364
// When printing paths we try to strip the cwd if it exists, otherwise
@@ -369,7 +370,7 @@ impl fmt::Display for Backtrace {
369370
output_filename(fmt, path, style, cwd.as_ref().ok())
370371
};
371372

372-
let mut f = backtrace_rs::BacktraceFmt::new(fmt, style, &mut print_path);
373+
let mut f = backtrace::BacktraceFmt::new(fmt, style, &mut print_path);
373374
f.add_context()?;
374375
for frame in frames {
375376
let mut f = f.frame();
@@ -379,7 +380,7 @@ impl fmt::Display for Backtrace {
379380
for symbol in frame.symbols.iter() {
380381
f.print_raw(
381382
frame.frame.ip(),
382-
symbol.name.as_ref().map(|b| backtrace_rs::SymbolName::new(b)),
383+
symbol.name.as_ref().map(|b| backtrace::SymbolName::new(b)),
383384
symbol.filename.as_ref().map(|b| match b {
384385
BytesOrWide::Bytes(w) => BytesOrWideString::Bytes(w),
385386
BytesOrWide::Wide(w) => BytesOrWideString::Wide(w),
@@ -414,7 +415,7 @@ impl Capture {
414415
RawFrame::Fake => unimplemented!(),
415416
};
416417
unsafe {
417-
backtrace_rs::resolve_frame_unsynchronized(frame, |symbol| {
418+
backtrace::resolve_frame_unsynchronized(frame, |symbol| {
418419
symbols.push(BacktraceSymbol {
419420
name: symbol.name().map(|m| m.as_bytes().to_vec()),
420421
filename: symbol.filename_raw().map(|b| match b {

src/libstd/build.rs

-1
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,4 @@ fn main() {
8888
println!("cargo:rustc-cfg=feature=\"restricted-std\"");
8989
}
9090
println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
91-
println!("cargo:rustc-cfg=backtrace_in_libstd");
9291
}

src/libstd/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,6 @@ mod panicking;
511511
// compiler
512512
pub mod rt;
513513

514-
#[path = "../backtrace/src/lib.rs"]
515-
#[allow(dead_code, unused_attributes)]
516-
mod backtrace_rs;
517-
518514
// Pull in the `std_detect` crate directly into libstd. The contents of
519515
// `std_detect` are in a different repository: rust-lang/stdarch.
520516
//

src/libstd/panicking.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ fn default_hook(info: &PanicInfo<'_>) {
171171
// If this is a double panic, make sure that we print a backtrace
172172
// for this panic. Otherwise only print it if logging is enabled.
173173
let backtrace_env = if panic_count::get() >= 2 {
174-
RustBacktrace::Print(crate::backtrace_rs::PrintFmt::Full)
174+
RustBacktrace::Print(backtrace_rs::PrintFmt::Full)
175175
} else {
176176
backtrace::rust_backtrace_env()
177177
};

src/libstd/sys_common/backtrace.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::backtrace_rs::{self, BacktraceFmt, BytesOrWideString, PrintFmt};
21
use crate::borrow::Cow;
32
/// Common code for printing the backtrace in the same way across the different
43
/// supported platforms.
@@ -10,6 +9,8 @@ use crate::path::{self, Path, PathBuf};
109
use crate::sync::atomic::{self, Ordering};
1110
use crate::sys::mutex::Mutex;
1211

12+
use backtrace_rs::{BacktraceFmt, BytesOrWideString, PrintFmt};
13+
1314
/// Max number of frames to print.
1415
const MAX_NB_FRAMES: usize = 100;
1516

0 commit comments

Comments
 (0)