Skip to content

Commit c2358a1

Browse files
committed
linker: Link profiler_builtins even if it's marked as NotLinked
1 parent 58e4644 commit c2358a1

File tree

1 file changed

+4
-3
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+4
-3
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -2454,15 +2454,17 @@ fn add_upstream_rust_crates<'a>(
24542454
// We must always link crates `compiler_builtins` and `profiler_builtins` statically.
24552455
// Even if they were already included into a dylib
24562456
// (e.g. `libstd` when `-C prefer-dynamic` is used).
2457+
// FIXME: `dependency_formats` can report `profiler_builtins` as `NotLinked` for some
2458+
// reason, it shouldn't do that because `profiler_builtins` should indeed be linked.
24572459
let linkage = data[cnum.as_usize() - 1];
24582460
let link_static_crate = linkage == Linkage::Static
2459-
|| linkage == Linkage::IncludedFromDylib
2461+
|| (linkage == Linkage::IncludedFromDylib || linkage == Linkage::NotLinked)
24602462
&& (codegen_results.crate_info.compiler_builtins == Some(cnum)
24612463
|| codegen_results.crate_info.profiler_runtime == Some(cnum));
24622464

24632465
let mut bundled_libs = Default::default();
24642466
match linkage {
2465-
Linkage::Static | Linkage::IncludedFromDylib => {
2467+
Linkage::Static | Linkage::IncludedFromDylib | Linkage::NotLinked => {
24662468
if link_static_crate {
24672469
bundled_libs = codegen_results.crate_info.native_libraries[&cnum]
24682470
.iter()
@@ -2483,7 +2485,6 @@ fn add_upstream_rust_crates<'a>(
24832485
let src = &codegen_results.crate_info.used_crate_source[&cnum];
24842486
add_dynamic_crate(cmd, sess, &src.dylib.as_ref().unwrap().0);
24852487
}
2486-
Linkage::NotLinked => {}
24872488
}
24882489

24892490
// Static libraries are linked for a subset of linked upstream crates.

0 commit comments

Comments
 (0)