@@ -161,16 +161,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
161
161
}
162
162
163
163
fn init ( & self , sess : & Session ) {
164
- use rustc_session:: config:: { InstrumentCoverage , Lto } ;
165
- match sess. lto ( ) {
166
- Lto :: No | Lto :: ThinLocal => {
167
- if sess. opts . crate_name . as_deref ( ) != Some ( "___" ) {
168
- sess. dcx ( ) . fatal ( "No LTO" ) ;
169
- }
170
- }
171
- Lto :: Thin | Lto :: Fat => { }
172
- }
173
-
164
+ use rustc_session:: config:: InstrumentCoverage ;
174
165
if sess. opts . cg . instrument_coverage ( ) != InstrumentCoverage :: No {
175
166
sess. dcx ( )
176
167
. fatal ( "`-Cinstrument-coverage` is LLVM specific and not supported by Cranelift" ) ;
@@ -252,18 +243,16 @@ impl CodegenBackend for CraneliftCodegenBackend {
252
243
match tcx. sess . lto ( ) {
253
244
Lto :: No | Lto :: ThinLocal => driver:: aot:: run_aot ( tcx) ,
254
245
Lto :: Thin | Lto :: Fat => {
255
- if tcx. crate_name ( LOCAL_CRATE ) . as_str ( ) == "compiler_builtins" {
256
- // FIXME remove special case once inline asm is supported in LTO mode
257
- driver:: aot:: run_aot ( tcx)
258
- } else {
259
- #[ cfg( feature = "lto" ) ]
260
- return driver:: lto:: run_aot ( tcx) ;
261
-
262
- #[ cfg( not( feature = "lto" ) ) ]
263
- tcx. dcx ( ) . fatal (
264
- "LTO support was disabled when compiling rustc_codegen_cranelift" ,
265
- ) ;
246
+ if tcx. crate_name ( LOCAL_CRATE ) == sym:: compiler_builtins {
247
+ return driver:: aot:: run_aot ( tcx) ;
266
248
}
249
+
250
+ #[ cfg( feature = "lto" ) ]
251
+ return driver:: lto:: run_aot ( tcx) ;
252
+
253
+ #[ cfg( not( feature = "lto" ) ) ]
254
+ tcx. dcx ( )
255
+ . fatal ( "LTO support was disabled when compiling rustc_codegen_cranelift" ) ;
267
256
}
268
257
}
269
258
}
0 commit comments