@@ -3063,6 +3063,7 @@ impl Step for CodegenCranelift {
3063
3063
// FIXME handle vendoring for source tarballs before removing the --skip-test below
3064
3064
let download_dir = builder. out . join ( "cg_clif_download" ) ;
3065
3065
3066
+ // FIXME: Uncomment the `prepare` command below once vendoring is implemented.
3066
3067
/*
3067
3068
let mut prepare_cargo = build_cargo();
3068
3069
prepare_cargo.arg("--").arg("prepare").arg("--download-dir").arg(&download_dir);
@@ -3094,3 +3095,123 @@ impl Step for CodegenCranelift {
3094
3095
builder. run_cmd ( BootstrapCommand :: from ( & mut cmd) . fail_fast ( ) ) ;
3095
3096
}
3096
3097
}
3098
+
3099
+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
3100
+ pub struct CodegenGCC {
3101
+ compiler : Compiler ,
3102
+ target : TargetSelection ,
3103
+ }
3104
+
3105
+ impl Step for CodegenGCC {
3106
+ type Output = ( ) ;
3107
+ const DEFAULT : bool = true ;
3108
+ const ONLY_HOSTS : bool = true ;
3109
+
3110
+ fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
3111
+ run. paths ( & [ "compiler/rustc_codegen_gcc" ] )
3112
+ }
3113
+
3114
+ fn make_run ( run : RunConfig < ' _ > ) {
3115
+ let builder = run. builder ;
3116
+ let host = run. build_triple ( ) ;
3117
+ let compiler = run. builder . compiler_for ( run. builder . top_stage , host, host) ;
3118
+
3119
+ if builder. doc_tests == DocTests :: Only {
3120
+ return ;
3121
+ }
3122
+
3123
+ let triple = run. target . triple ;
3124
+ let target_supported =
3125
+ if triple. contains ( "linux" ) { triple. contains ( "x86_64" ) } else { false } ;
3126
+ if !target_supported {
3127
+ builder. info ( "target not supported by rustc_codegen_gcc. skipping" ) ;
3128
+ return ;
3129
+ }
3130
+
3131
+ if builder. remote_tested ( run. target ) {
3132
+ builder. info ( "remote testing is not supported by rustc_codegen_gcc. skipping" ) ;
3133
+ return ;
3134
+ }
3135
+
3136
+ if !builder. config . rust_codegen_backends . contains ( & INTERNER . intern_str ( "gcc" ) ) {
3137
+ builder. info ( "gcc not in rust.codegen-backends. skipping" ) ;
3138
+ return ;
3139
+ }
3140
+
3141
+ builder. ensure ( CodegenGCC { compiler, target : run. target } ) ;
3142
+ }
3143
+
3144
+ fn run ( self , builder : & Builder < ' _ > ) {
3145
+ let compiler = self . compiler ;
3146
+ let target = self . target ;
3147
+
3148
+ builder. ensure ( compile:: Std :: new_with_extra_rust_args (
3149
+ compiler,
3150
+ target,
3151
+ & [ "-Csymbol-mangling-version=v0" , "-Cpanic=abort" ] ,
3152
+ ) ) ;
3153
+
3154
+ // If we're not doing a full bootstrap but we're testing a stage2
3155
+ // version of libstd, then what we're actually testing is the libstd
3156
+ // produced in stage1. Reflect that here by updating the compiler that
3157
+ // we're working with automatically.
3158
+ let compiler = builder. compiler_for ( compiler. stage , compiler. host , target) ;
3159
+
3160
+ let build_cargo = || {
3161
+ let mut cargo = builder. cargo (
3162
+ compiler,
3163
+ Mode :: Codegen , // Must be codegen to ensure dlopen on compiled dylibs works
3164
+ SourceType :: InTree ,
3165
+ target,
3166
+ "run" ,
3167
+ ) ;
3168
+ cargo. current_dir ( & builder. src . join ( "compiler/rustc_codegen_gcc" ) ) ;
3169
+ cargo
3170
+ . arg ( "--manifest-path" )
3171
+ . arg ( builder. src . join ( "compiler/rustc_codegen_gcc/build_system/Cargo.toml" ) ) ;
3172
+ compile:: rustc_cargo_env ( builder, & mut cargo, target, compiler. stage ) ;
3173
+
3174
+ // Avoid incremental cache issues when changing rustc
3175
+ cargo. env ( "CARGO_BUILD_INCREMENTAL" , "false" ) ;
3176
+ cargo. rustflag ( "-Cpanic=abort" ) ;
3177
+
3178
+ cargo
3179
+ } ;
3180
+
3181
+ builder. info ( & format ! (
3182
+ "{} GCC stage{} ({} -> {})" ,
3183
+ Kind :: Test . description( ) ,
3184
+ compiler. stage,
3185
+ & compiler. host,
3186
+ target
3187
+ ) ) ;
3188
+ let _time = helpers:: timeit ( & builder) ;
3189
+
3190
+ // FIXME: Uncomment the `prepare` command below once vendoring is implemented.
3191
+ /*
3192
+ let mut prepare_cargo = build_cargo();
3193
+ prepare_cargo.arg("--").arg("prepare");
3194
+ #[allow(deprecated)]
3195
+ builder.config.try_run(&mut prepare_cargo.into()).unwrap();
3196
+ */
3197
+
3198
+ let mut cargo = build_cargo ( ) ;
3199
+
3200
+ cargo
3201
+ . arg ( "--" )
3202
+ . arg ( "test" )
3203
+ . arg ( "--use-system-gcc" )
3204
+ . arg ( "--use-backend" )
3205
+ . arg ( "gcc" )
3206
+ . arg ( "--out-dir" )
3207
+ . arg ( builder. stage_out ( compiler, Mode :: ToolRustc ) . join ( "cg_gcc" ) )
3208
+ . arg ( "--release" )
3209
+ . arg ( "--no-default-features" )
3210
+ . arg ( "--mini-tests" )
3211
+ . arg ( "--std-tests" ) ;
3212
+ cargo. args ( builder. config . test_args ( ) ) ;
3213
+
3214
+ let mut cmd: Command = cargo. into ( ) ;
3215
+ builder. run_cmd ( BootstrapCommand :: from ( & mut cmd) . fail_fast ( ) ) ;
3216
+ }
3217
+ }
0 commit comments