Skip to content

Commit a0f8dff

Browse files
committed
Use CrateDepKind::Explicit for the profiler runtime
It is unconditionally included.
1 parent 7d57c6f commit a0f8dff

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2792,11 +2792,9 @@ fn add_upstream_rust_crates(
27922792
// We must always link crates `compiler_builtins` and `profiler_builtins` statically.
27932793
// Even if they were already included into a dylib
27942794
// (e.g. `libstd` when `-C prefer-dynamic` is used).
2795-
// FIXME: `dependency_formats` can report `profiler_builtins` as `NotLinked` for some
2796-
// reason, it shouldn't do that because `profiler_builtins` should indeed be linked.
27972795
let linkage = data[cnum];
27982796
let link_static_crate = linkage == Linkage::Static
2799-
|| (linkage == Linkage::IncludedFromDylib || linkage == Linkage::NotLinked)
2797+
|| linkage == Linkage::IncludedFromDylib
28002798
&& (codegen_results.crate_info.compiler_builtins == Some(cnum)
28012799
|| codegen_results.crate_info.profiler_runtime == Some(cnum));
28022800

compiler/rustc_metadata/src/creader.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,8 @@ impl CStore {
985985
};
986986
info!("panic runtime not found -- loading {}", name);
987987

988+
// This has to be implicit as both panic_unwind and panic_abort may be present in the crate
989+
// graph at the same time. One of them will later be activated in dependency_formats.
988990
let Some(cnum) =
989991
self.resolve_crate(tcx, name, DUMMY_SP, CrateDepKind::Implicit, CrateOrigin::Injected)
990992
else {
@@ -1016,7 +1018,7 @@ impl CStore {
10161018

10171019
let name = Symbol::intern(&tcx.sess.opts.unstable_opts.profiler_runtime);
10181020
let Some(cnum) =
1019-
self.resolve_crate(tcx, name, DUMMY_SP, CrateDepKind::Implicit, CrateOrigin::Injected)
1021+
self.resolve_crate(tcx, name, DUMMY_SP, CrateDepKind::Explicit, CrateOrigin::Injected)
10201022
else {
10211023
return;
10221024
};

0 commit comments

Comments
 (0)