@@ -2954,53 +2954,49 @@ fn add_static_crate(
2954
2954
let name = & name[ 3 ..name. len ( ) - 5 ] ; // chop off lib/.rlib
2955
2955
let bundled_lib_file_names = bundled_lib_file_names. clone ( ) ;
2956
2956
2957
- sess. prof . generic_activity_with_arg ( "link_altering_rlib" , name) . run ( || {
2958
- let canonical_name = name. replace ( '-' , "_" ) ;
2959
- let upstream_rust_objects_already_included =
2960
- are_upstream_rust_objects_already_included ( sess) ;
2961
- let is_builtins =
2962
- sess. target . no_builtins || !codegen_results. crate_info . is_no_builtins . contains ( & cnum) ;
2963
-
2964
- let mut archive = archive_builder_builder. new_archive_builder ( sess) ;
2965
- if let Err ( error) = archive. add_archive (
2966
- cratepath,
2967
- Box :: new ( move |f| {
2968
- if f == METADATA_FILENAME {
2969
- return true ;
2970
- }
2957
+ let canonical_name = name. replace ( '-' , "_" ) ;
2958
+ let upstream_rust_objects_already_included = are_upstream_rust_objects_already_included ( sess) ;
2959
+ let is_builtins =
2960
+ sess. target . no_builtins || !codegen_results. crate_info . is_no_builtins . contains ( & cnum) ;
2961
+
2962
+ let mut archive = archive_builder_builder. new_archive_builder ( sess) ;
2963
+ if let Err ( error) = archive. add_archive (
2964
+ cratepath,
2965
+ Box :: new ( move |f| {
2966
+ if f == METADATA_FILENAME {
2967
+ return true ;
2968
+ }
2971
2969
2972
- let canonical = f. replace ( '-' , "_" ) ;
2970
+ let canonical = f. replace ( '-' , "_" ) ;
2973
2971
2974
- let is_rust_object =
2975
- canonical. starts_with ( & canonical_name) && looks_like_rust_object_file ( f) ;
2972
+ let is_rust_object =
2973
+ canonical. starts_with ( & canonical_name) && looks_like_rust_object_file ( f) ;
2976
2974
2977
- // If we're performing LTO and this is a rust-generated object
2978
- // file, then we don't need the object file as it's part of the
2979
- // LTO module. Note that `#![no_builtins]` is excluded from LTO,
2980
- // though, so we let that object file slide.
2981
- if upstream_rust_objects_already_included && is_rust_object && is_builtins {
2982
- return true ;
2983
- }
2975
+ // If we're performing LTO and this is a rust-generated object
2976
+ // file, then we don't need the object file as it's part of the
2977
+ // LTO module. Note that `#![no_builtins]` is excluded from LTO,
2978
+ // though, so we let that object file slide.
2979
+ if upstream_rust_objects_already_included && is_rust_object && is_builtins {
2980
+ return true ;
2981
+ }
2984
2982
2985
- // We skip native libraries because:
2986
- // 1. This native libraries won't be used from the generated rlib,
2987
- // so we can throw them away to avoid the copying work.
2988
- // 2. We can't allow it to be a single remaining entry in archive
2989
- // as some linkers may complain on that.
2990
- if bundled_lib_file_names. contains ( & Symbol :: intern ( f) ) {
2991
- return true ;
2992
- }
2983
+ // We skip native libraries because:
2984
+ // 1. This native libraries won't be used from the generated rlib,
2985
+ // so we can throw them away to avoid the copying work.
2986
+ // 2. We can't allow it to be a single remaining entry in archive
2987
+ // as some linkers may complain on that.
2988
+ if bundled_lib_file_names. contains ( & Symbol :: intern ( f) ) {
2989
+ return true ;
2990
+ }
2993
2991
2994
- false
2995
- } ) ,
2996
- ) {
2997
- sess. dcx ( )
2998
- . emit_fatal ( errors:: RlibArchiveBuildFailure { path : cratepath. clone ( ) , error } ) ;
2999
- }
3000
- if archive. build ( & dst) {
3001
- link_upstream ( & dst) ;
3002
- }
3003
- } ) ;
2992
+ false
2993
+ } ) ,
2994
+ ) {
2995
+ sess. dcx ( ) . emit_fatal ( errors:: RlibArchiveBuildFailure { path : cratepath. clone ( ) , error } ) ;
2996
+ }
2997
+ if archive. build ( & dst) {
2998
+ link_upstream ( & dst) ;
2999
+ }
3004
3000
}
3005
3001
3006
3002
// Same thing as above, but for dynamic crates instead of static crates.
0 commit comments