@@ -510,8 +510,7 @@ fn link_staticlib<'a>(
510510 & codegen_results. crate_info ,
511511 Some ( CrateType :: Staticlib ) ,
512512 & mut |cnum, path| {
513- let lto = are_upstream_rust_objects_already_included ( sess)
514- && !ignored_for_lto ( sess, & codegen_results. crate_info , cnum) ;
513+ let lto = are_upstream_rust_objects_already_included ( sess) ;
515514
516515 let native_libs = codegen_results. crate_info . native_libraries [ & cnum] . iter ( ) ;
517516 let relevant = native_libs. clone ( ) . filter ( |lib| relevant_lib ( sess, & lib) ) ;
@@ -1250,24 +1249,6 @@ fn link_sanitizer_runtime(sess: &Session, linker: &mut dyn Linker, name: &str) {
12501249 }
12511250}
12521251
1253- /// Returns a boolean indicating whether the specified crate should be ignored
1254- /// during LTO.
1255- ///
1256- /// Crates ignored during LTO are not lumped together in the "massive object
1257- /// file" that we create and are linked in their normal rlib states. See
1258- /// comments below for what crates do not participate in LTO.
1259- ///
1260- /// It's unusual for a crate to not participate in LTO. Typically only
1261- /// compiler-specific and unstable crates have a reason to not participate in
1262- /// LTO.
1263- pub fn ignored_for_lto ( sess : & Session , info : & CrateInfo , cnum : CrateNum ) -> bool {
1264- // If our target enables builtin function lowering in LLVM then the
1265- // crates providing these functions don't participate in LTO (e.g.
1266- // no_builtins or compiler builtins crates).
1267- !sess. target . no_builtins
1268- && ( info. compiler_builtins == Some ( cnum) || info. is_no_builtins . contains ( & cnum) )
1269- }
1270-
12711252/// This functions tries to determine the appropriate linker (and corresponding LinkerFlavor) to use
12721253pub fn linker_and_flavor ( sess : & Session ) -> ( PathBuf , LinkerFlavor ) {
12731254 fn infer_from (
@@ -2733,10 +2714,6 @@ fn rehome_sysroot_lib_dir<'a>(sess: &'a Session, lib_dir: &Path) -> PathBuf {
27332714// symbols). We must continue to include the rest of the rlib, however, as
27342715// it may contain static native libraries which must be linked in.
27352716//
2736- // (*) Crates marked with `#![no_builtins]` don't participate in LTO and
2737- // their bytecode wasn't included. The object files in those libraries must
2738- // still be passed to the linker.
2739- //
27402717// Note, however, that if we're not doing LTO we can just pass the rlib
27412718// blindly to the linker (fast) because it's fine if it's not actually
27422719// included as we're at the end of the dependency chain.
@@ -2762,9 +2739,7 @@ fn add_static_crate<'a>(
27622739 cmd. link_rlib ( & rlib_path) ;
27632740 } ;
27642741
2765- if !are_upstream_rust_objects_already_included ( sess)
2766- || ignored_for_lto ( sess, & codegen_results. crate_info , cnum)
2767- {
2742+ if !are_upstream_rust_objects_already_included ( sess) {
27682743 link_upstream ( cratepath) ;
27692744 return ;
27702745 }
@@ -2778,8 +2753,6 @@ fn add_static_crate<'a>(
27782753 let canonical_name = name. replace ( '-' , "_" ) ;
27792754 let upstream_rust_objects_already_included =
27802755 are_upstream_rust_objects_already_included ( sess) ;
2781- let is_builtins =
2782- sess. target . no_builtins || !codegen_results. crate_info . is_no_builtins . contains ( & cnum) ;
27832756
27842757 let mut archive = archive_builder_builder. new_archive_builder ( sess) ;
27852758 if let Err ( error) = archive. add_archive (
@@ -2796,9 +2769,8 @@ fn add_static_crate<'a>(
27962769
27972770 // If we're performing LTO and this is a rust-generated object
27982771 // file, then we don't need the object file as it's part of the
2799- // LTO module. Note that `#![no_builtins]` is excluded from LTO,
2800- // though, so we let that object file slide.
2801- if upstream_rust_objects_already_included && is_rust_object && is_builtins {
2772+ // LTO module.
2773+ if upstream_rust_objects_already_included && is_rust_object {
28022774 return true ;
28032775 }
28042776
0 commit comments