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