@@ -139,16 +139,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
139139 }
140140
141141 fn init ( & self , sess : & Session ) {
142- use rustc_session:: config:: { InstrumentCoverage , Lto } ;
143- match sess. lto ( ) {
144- Lto :: No | Lto :: ThinLocal => {
145- if sess. opts . crate_name . as_deref ( ) != Some ( "___" ) {
146- sess. dcx ( ) . fatal ( "No LTO" ) ;
147- }
148- }
149- Lto :: Thin | Lto :: Fat => { }
150- }
151-
142+ use rustc_session:: config:: InstrumentCoverage ;
152143 if sess. opts . cg . instrument_coverage ( ) != InstrumentCoverage :: No {
153144 sess. dcx ( )
154145 . fatal ( "`-Cinstrument-coverage` is LLVM specific and not supported by Cranelift" ) ;
@@ -223,18 +214,16 @@ impl CodegenBackend for CraneliftCodegenBackend {
223214 match tcx. sess . lto ( ) {
224215 Lto :: No | Lto :: ThinLocal => driver:: aot:: run_aot ( tcx) ,
225216 Lto :: Thin | Lto :: Fat => {
226- if tcx. crate_name ( LOCAL_CRATE ) . as_str ( ) == "compiler_builtins" {
227- // FIXME remove special case once inline asm is supported in LTO mode
228- driver:: aot:: run_aot ( tcx)
229- } else {
230- #[ cfg( feature = "lto" ) ]
231- return driver:: lto:: run_aot ( tcx) ;
232-
233- #[ cfg( not( feature = "lto" ) ) ]
234- tcx. dcx ( ) . fatal (
235- "LTO support was disabled when compiling rustc_codegen_cranelift" ,
236- ) ;
217+ if tcx. crate_name ( LOCAL_CRATE ) == sym:: compiler_builtins {
218+ return driver:: aot:: run_aot ( tcx) ;
237219 }
220+
221+ #[ cfg( feature = "lto" ) ]
222+ return driver:: lto:: run_aot ( tcx) ;
223+
224+ #[ cfg( not( feature = "lto" ) ) ]
225+ tcx. dcx ( )
226+ . fatal ( "LTO support was disabled when compiling rustc_codegen_cranelift" ) ;
238227 }
239228 }
240229 }
0 commit comments