File tree 1 file changed +6
-4
lines changed
compiler/rustc_codegen_ssa/src/back
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>>(
2263
2263
sess : & ' a Session ,
2264
2264
codegen_results : & CodegenResults ,
2265
2265
tmpdir : & Path ,
2266
- crate_type : CrateType ,
2266
+ _crate_type : CrateType ,
2267
2267
cnum : CrateNum ,
2268
2268
) {
2269
2269
let src = & codegen_results. crate_info . used_crate_source [ & cnum] ;
@@ -2274,13 +2274,15 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
2274
2274
// whole of each object in our archive into that artifact. This is
2275
2275
// because a `dylib` can be reused as an intermediate artifact.
2276
2276
//
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
+ //
2277
2281
// Note, though, that we don't want to include the whole of a
2278
2282
// compiler-builtins crate (e.g., compiler-rt) because it'll get
2279
2283
// repeatedly linked anyway.
2280
2284
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) {
2284
2286
cmd. link_whole_rlib ( & path) ;
2285
2287
} else {
2286
2288
cmd. link_rlib ( & path) ;
You can’t perform that action at this time.
0 commit comments