File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
compiler/rustc_codegen_ssa/src/back Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -2263,7 +2263,7 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
22632263 sess : & ' a Session ,
22642264 codegen_results : & CodegenResults ,
22652265 tmpdir : & Path ,
2266- crate_type : CrateType ,
2266+ _crate_type : CrateType ,
22672267 cnum : CrateNum ,
22682268 ) {
22692269 let src = & codegen_results. crate_info . used_crate_source [ & cnum] ;
@@ -2274,13 +2274,15 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
22742274 // whole of each object in our archive into that artifact. This is
22752275 // because a `dylib` can be reused as an intermediate artifact.
22762276 //
2277+ // NOTE(nbdd0121): Even for non-dylib, we still need to link rlibs
2278+ // in whole because so that `#[no_mangle]` and `#[used]` items from
2279+ // upstream need to be root (#47384, #50007).
2280+ //
22772281 // Note, though, that we don't want to include the whole of a
22782282 // compiler-builtins crate (e.g., compiler-rt) because it'll get
22792283 // repeatedly linked anyway.
22802284 let path = fix_windows_verbatim_for_gcc ( path) ;
2281- if crate_type == CrateType :: Dylib
2282- && codegen_results. crate_info . compiler_builtins != Some ( cnum)
2283- {
2285+ if codegen_results. crate_info . compiler_builtins != Some ( cnum) {
22842286 cmd. link_whole_rlib ( & path) ;
22852287 } else {
22862288 cmd. link_rlib ( & path) ;
You can’t perform that action at this time.
0 commit comments