@@ -20,7 +20,7 @@ use tracing::{instrument, span};
20
20
21
21
use crate :: core:: build_steps:: gcc:: { Gcc , add_cg_gcc_cargo_flags} ;
22
22
use 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} ;
24
24
use crate :: core:: builder;
25
25
use crate :: core:: builder:: {
26
26
Builder , Cargo , Kind , RunConfig , ShouldRun , Step , StepMetadata , crate_description,
@@ -2348,6 +2348,19 @@ impl Step for Assemble {
2348
2348
dist:: maybe_install_llvm_runtime ( builder, target_compiler. host , & sysroot) ;
2349
2349
dist:: maybe_install_llvm_target ( builder, target_compiler. host , & sysroot) ;
2350
2350
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
+
2351
2364
// Link the compiler binary itself into place
2352
2365
let out_dir = builder. cargo_out ( build_compiler, Mode :: Rustc , host) ;
2353
2366
let rustc = out_dir. join ( exe ( "rustc-main" , host) ) ;
0 commit comments