@@ -140,48 +140,55 @@ pub fn std_cargo(build: &Builder,
140
140
compiler : & Compiler ,
141
141
target : Interned < String > ,
142
142
cargo : & mut Command ) {
143
- let mut features = build. std_features ( ) ;
144
-
145
143
if let Some ( target) = env:: var_os ( "MACOSX_STD_DEPLOYMENT_TARGET" ) {
146
144
cargo. env ( "MACOSX_DEPLOYMENT_TARGET" , target) ;
147
145
}
148
146
149
- // When doing a local rebuild we tell cargo that we're stage1 rather than
150
- // stage0. This works fine if the local rust and being-built rust have the
151
- // same view of what the default allocator is, but fails otherwise. Since
152
- // we don't have a way to express an allocator preference yet, work
153
- // around the issue in the case of a local rebuild with jemalloc disabled.
154
- if compiler. stage == 0 && build. local_rebuild && !build. config . use_jemalloc {
155
- features. push_str ( " force_alloc_system" ) ;
156
- }
147
+ if build. no_std ( target) == Some ( true ) {
148
+ // for no-std targets we only compile core and compiler-builtins
149
+ cargo. arg ( "--features" ) . arg ( "c mem" )
150
+ . arg ( "--manifest-path" )
151
+ . arg ( build. src . join ( "src/rustc/compiler_builtins_shim/Cargo.toml" ) ) ;
152
+ } else {
153
+ let mut features = build. std_features ( ) ;
154
+
155
+ // When doing a local rebuild we tell cargo that we're stage1 rather than
156
+ // stage0. This works fine if the local rust and being-built rust have the
157
+ // same view of what the default allocator is, but fails otherwise. Since
158
+ // we don't have a way to express an allocator preference yet, work
159
+ // around the issue in the case of a local rebuild with jemalloc disabled.
160
+ if compiler. stage == 0 && build. local_rebuild && !build. config . use_jemalloc {
161
+ features. push_str ( " force_alloc_system" ) ;
162
+ }
157
163
158
- if compiler. stage != 0 && build. config . sanitizers {
159
- // This variable is used by the sanitizer runtime crates, e.g.
160
- // rustc_lsan, to build the sanitizer runtime from C code
161
- // When this variable is missing, those crates won't compile the C code,
162
- // so we don't set this variable during stage0 where llvm-config is
163
- // missing
164
- // We also only build the runtimes when --enable-sanitizers (or its
165
- // config.toml equivalent) is used
166
- let llvm_config = build. ensure ( native:: Llvm {
167
- target : build. config . build ,
168
- emscripten : false ,
169
- } ) ;
170
- cargo. env ( "LLVM_CONFIG" , llvm_config) ;
171
- }
164
+ if compiler. stage != 0 && build. config . sanitizers {
165
+ // This variable is used by the sanitizer runtime crates, e.g.
166
+ // rustc_lsan, to build the sanitizer runtime from C code
167
+ // When this variable is missing, those crates won't compile the C code,
168
+ // so we don't set this variable during stage0 where llvm-config is
169
+ // missing
170
+ // We also only build the runtimes when --enable-sanitizers (or its
171
+ // config.toml equivalent) is used
172
+ let llvm_config = build. ensure ( native:: Llvm {
173
+ target : build. config . build ,
174
+ emscripten : false ,
175
+ } ) ;
176
+ cargo. env ( "LLVM_CONFIG" , llvm_config) ;
177
+ }
172
178
173
- cargo. arg ( "--features" ) . arg ( features)
174
- . arg ( "--manifest-path" )
175
- . arg ( build. src . join ( "src/libstd/Cargo.toml" ) ) ;
179
+ cargo. arg ( "--features" ) . arg ( features)
180
+ . arg ( "--manifest-path" )
181
+ . arg ( build. src . join ( "src/libstd/Cargo.toml" ) ) ;
176
182
177
- if let Some ( target) = build. config . target_config . get ( & target) {
178
- if let Some ( ref jemalloc) = target. jemalloc {
179
- cargo. env ( "JEMALLOC_OVERRIDE" , jemalloc) ;
183
+ if let Some ( target) = build. config . target_config . get ( & target) {
184
+ if let Some ( ref jemalloc) = target. jemalloc {
185
+ cargo. env ( "JEMALLOC_OVERRIDE" , jemalloc) ;
186
+ }
180
187
}
181
- }
182
- if target . contains ( "musl" ) {
183
- if let Some ( p ) = build . musl_root ( target ) {
184
- cargo . env ( "MUSL_ROOT" , p ) ;
188
+ if target . contains ( "musl" ) {
189
+ if let Some ( p ) = build . musl_root ( target ) {
190
+ cargo . env ( "MUSL_ROOT" , p ) ;
191
+ }
185
192
}
186
193
}
187
194
}
0 commit comments