@@ -1185,13 +1185,15 @@ impl Step for Rustc {
11851185 {
11861186 // jemalloc_sys and rustc_public_bridge are not linked into librustc_driver.so,
11871187 // so we need to distribute them as rlib to be able to use them.
1188- filename. ends_with ( ".rlib" )
1189- } else {
1190- // Distribute the rest of the rustc crates as rmeta files only to reduce
1191- // the tarball sizes by about 50%. The object files are linked into
1192- // librustc_driver.so, so it is still possible to link against them.
1193- filename. ends_with ( ".rmeta" )
1188+ if filename. ends_with ( ".rlib" ) {
1189+ return true ;
1190+ }
11941191 }
1192+
1193+ // Distribute the rest of the rustc crates as rmeta files only to reduce
1194+ // the tarball sizes by about 50%. The object files are linked into
1195+ // librustc_driver.so, so it is still possible to link against them.
1196+ filename. ends_with ( ".rmeta" )
11951197 } ) ) ,
11961198 ) ;
11971199
@@ -1732,7 +1734,7 @@ impl Step for GccCodegenBackend {
17321734
17331735 let _guard =
17341736 builder. msg ( Kind :: Build , "codegen backend gcc" , Mode :: Codegen , build_compiler, host) ;
1735- let files = run_cargo ( builder, cargo, vec ! [ ] , & stamp, vec ! [ ] , ArtifactKeepMode :: OnlyRlib ) ;
1737+ let files = run_cargo ( builder, cargo, vec ! [ ] , & stamp, vec ! [ ] , ArtifactKeepMode :: OnlyDylib ) ;
17361738
17371739 GccCodegenBackendOutput {
17381740 stamp : write_codegen_backend_stamp ( stamp, files, builder. config . dry_run ( ) ) ,
@@ -1808,7 +1810,7 @@ impl Step for CraneliftCodegenBackend {
18081810 build_compiler,
18091811 target,
18101812 ) ;
1811- let files = run_cargo ( builder, cargo, vec ! [ ] , & stamp, vec ! [ ] , ArtifactKeepMode :: OnlyRlib ) ;
1813+ let files = run_cargo ( builder, cargo, vec ! [ ] , & stamp, vec ! [ ] , ArtifactKeepMode :: OnlyDylib ) ;
18121814 write_codegen_backend_stamp ( stamp, files, builder. config . dry_run ( ) )
18131815 }
18141816
@@ -2642,6 +2644,8 @@ pub fn add_to_sysroot(
26422644/// build stamp, and thus be included in dist archives and copied into sysroots by default.
26432645/// Note that some kinds of artifacts are copied automatically (e.g. native libraries).
26442646pub enum ArtifactKeepMode {
2647+ /// Only keep .so files, ignore .rlib and .rmeta files
2648+ OnlyDylib ,
26452649 /// Only keep .rlib files, ignore .rmeta files
26462650 OnlyRlib ,
26472651 /// Only keep .rmeta files, ignore .rlib files
@@ -2704,6 +2708,7 @@ pub fn run_cargo(
27042708 true
27052709 } else {
27062710 match & artifact_keep_mode {
2711+ ArtifactKeepMode :: OnlyDylib => false ,
27072712 ArtifactKeepMode :: OnlyRlib => filename. ends_with ( ".rlib" ) ,
27082713 ArtifactKeepMode :: OnlyRmeta => filename. ends_with ( ".rmeta" ) ,
27092714 ArtifactKeepMode :: BothRlibAndRmeta => {
0 commit comments