Use CrateDepKind::Explicit for the profiler runtime

It is unconditionally included.
This commit is contained in:
bjorn3 2025-11-27 14:43:06 +00:00
parent 7d57c6fc8e
commit a0f8dffeee
2 changed files with 4 additions and 4 deletions

View file

@ -2792,11 +2792,9 @@ fn add_upstream_rust_crates(
// We must always link crates `compiler_builtins` and `profiler_builtins` statically.
// Even if they were already included into a dylib
// (e.g. `libstd` when `-C prefer-dynamic` is used).
// FIXME: `dependency_formats` can report `profiler_builtins` as `NotLinked` for some
// reason, it shouldn't do that because `profiler_builtins` should indeed be linked.
let linkage = data[cnum];
let link_static_crate = linkage == Linkage::Static
|| (linkage == Linkage::IncludedFromDylib || linkage == Linkage::NotLinked)
|| linkage == Linkage::IncludedFromDylib
&& (codegen_results.crate_info.compiler_builtins == Some(cnum)
|| codegen_results.crate_info.profiler_runtime == Some(cnum));

View file

@ -985,6 +985,8 @@ impl CStore {
};
info!("panic runtime not found -- loading {}", name);
// This has to be implicit as both panic_unwind and panic_abort may be present in the crate
// graph at the same time. One of them will later be activated in dependency_formats.
let Some(cnum) =
self.resolve_crate(tcx, name, DUMMY_SP, CrateDepKind::Implicit, CrateOrigin::Injected)
else {
@ -1016,7 +1018,7 @@ impl CStore {
let name = Symbol::intern(&tcx.sess.opts.unstable_opts.profiler_runtime);
let Some(cnum) =
self.resolve_crate(tcx, name, DUMMY_SP, CrateDepKind::Implicit, CrateOrigin::Injected)
self.resolve_crate(tcx, name, DUMMY_SP, CrateDepKind::Explicit, CrateOrigin::Injected)
else {
return;
};