@@ -171,6 +171,17 @@ impl LldMode {
171171 }
172172}
173173
174+ /// Determines how will GCC be provided.
175+ #[ derive( Default , Clone ) ]
176+ pub enum GccCiMode {
177+ /// Build GCC from the local `src/gcc` submodule.
178+ #[ default]
179+ BuildLocally ,
180+ /// Try to download GCC from CI.
181+ /// If it is not available on CI, it will be built locally instead.
182+ DownloadFromCi ,
183+ }
184+
174185/// Global configuration for the entire build and/or bootstrap.
175186///
176187/// This structure is parsed from `config.toml`, and some of the fields are inferred from `git` or build-time parameters.
@@ -283,6 +294,9 @@ pub struct Config {
283294 pub llvm_ldflags : Option < String > ,
284295 pub llvm_use_libcxx : bool ,
285296
297+ // gcc codegen options
298+ pub gcc_ci_mode : GccCiMode ,
299+
286300 // rust codegen options
287301 pub rust_optimize : RustOptimize ,
288302 pub rust_codegen_units : Option < u32 > ,
@@ -998,7 +1012,9 @@ define_config! {
9981012
9991013define_config ! {
10001014 /// TOML representation of how the GCC build is configured.
1001- struct Gcc { }
1015+ struct Gcc {
1016+ download_ci_gcc: Option <bool > = "download-ci-gcc" ,
1017+ }
10021018}
10031019
10041020define_config ! {
@@ -2134,6 +2150,16 @@ impl Config {
21342150 config. llvm_from_ci = config. parse_download_ci_llvm ( None , false ) ;
21352151 }
21362152
2153+ if let Some ( gcc) = toml. gcc {
2154+ config. gcc_ci_mode = match gcc. download_ci_gcc {
2155+ Some ( value) => match value {
2156+ true => GccCiMode :: DownloadFromCi ,
2157+ false => GccCiMode :: BuildLocally ,
2158+ } ,
2159+ None => GccCiMode :: default ( ) ,
2160+ } ;
2161+ }
2162+
21372163 if let Some ( t) = toml. target {
21382164 for ( triple, cfg) in t {
21392165 let mut target = Target :: from_triple ( & triple) ;
0 commit comments