@@ -20,7 +20,7 @@ use tracing::{instrument, span};
2020
2121use crate :: core:: build_steps:: gcc:: { Gcc , add_cg_gcc_cargo_flags} ;
2222use crate :: core:: build_steps:: tool:: { RustcPrivateCompilers , SourceType , copy_lld_artifacts} ;
23- use crate :: core:: build_steps:: { dist, llvm} ;
23+ use crate :: core:: build_steps:: { dist, gcc , llvm} ;
2424use crate :: core:: builder;
2525use crate :: core:: builder:: {
2626 Builder , Cargo , Kind , RunConfig , ShouldRun , Step , StepMetadata , crate_description,
@@ -2348,6 +2348,19 @@ impl Step for Assemble {
23482348 dist:: maybe_install_llvm_runtime ( builder, target_compiler. host , & sysroot) ;
23492349 dist:: maybe_install_llvm_target ( builder, target_compiler. host , & sysroot) ;
23502350
2351+ if builder. config . gcc_enabled ( target_compiler. host ) {
2352+ let gcc:: GccOutput { mut libgccjit } =
2353+ builder. ensure ( gcc:: Gcc { target : target_compiler. host } ) ;
2354+ let dst_libdir = sysroot. join ( "lib" ) ;
2355+ builder. install ( & libgccjit, & dst_libdir, FileType :: NativeLibrary ) ;
2356+ if let Some ( file_name) = libgccjit. file_name ( ) {
2357+ let mut file_name = file_name. to_os_string ( ) ;
2358+ file_name. push ( ".0" ) ;
2359+ libgccjit. set_file_name ( file_name) ;
2360+ builder. install ( & libgccjit, & dst_libdir, FileType :: NativeLibrary ) ;
2361+ }
2362+ }
2363+
23512364 // Link the compiler binary itself into place
23522365 let out_dir = builder. cargo_out ( build_compiler, Mode :: Rustc , host) ;
23532366 let rustc = out_dir. join ( exe ( "rustc-main" , host) ) ;
0 commit comments