File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -212,7 +212,8 @@ fn build_clif_sysroot_for_triple(
212212 }
213213
214214 // Build sysroot
215- let mut rustflags = vec ! [ "-Zforce-unstable-if-unmarked" . to_owned( ) ] ;
215+ let mut rustflags =
216+ vec ! [ "-Zforce-unstable-if-unmarked" . to_owned( ) , "-Cembed-bitcode=yes" . to_owned( ) ] ;
216217 if !panic_unwind_support {
217218 rustflags. push ( "-Cpanic=abort" . to_owned ( ) ) ;
218219 }
@@ -237,8 +238,6 @@ fn build_clif_sysroot_for_triple(
237238 rustflags. push ( "--remap-path-prefix" . to_owned ( ) ) ;
238239 rustflags. push ( format ! ( "library/={}/library" , prefix. to_str( ) . unwrap( ) ) ) ;
239240 }
240- rustflags. push ( "-Clto=thin" . to_owned ( ) ) ;
241- rustflags. push ( "-Zdylib-lto" . to_owned ( ) ) ;
242241 rustflags. push ( "-Cembed-bitcode=yes" . to_owned ( ) ) ;
243242 compiler. rustflags . extend ( rustflags) ;
244243 let mut build_cmd = STANDARD_LIBRARY . build ( & compiler, dirs) ;
@@ -256,7 +255,6 @@ fn build_clif_sysroot_for_triple(
256255 if env:: var_os ( "CARGO_BUILD_INCREMENTAL" ) . is_none ( ) {
257256 build_cmd. env ( "CARGO_BUILD_INCREMENTAL" , "true" ) ;
258257 }
259- build_cmd. env ( "CARGO_PROFILE_RELEASE_LTO" , "thin" ) ;
260258 spawn_and_wait ( build_cmd) ;
261259
262260 for entry in fs:: read_dir ( build_dir. join ( "build" ) )
Original file line number Diff line number Diff line change @@ -144,6 +144,10 @@ impl CodegenBackend for CraneliftCodegenBackend {
144144 }
145145 }
146146
147+ fn thin_lto_supported ( & self ) -> bool {
148+ false
149+ }
150+
147151 fn target_config ( & self , sess : & Session ) -> TargetConfig {
148152 // FIXME return the actually used target features. this is necessary for #[cfg(target_feature)]
149153 let target_features = match sess. target . arch {
@@ -218,18 +222,19 @@ impl CodegenBackend for CraneliftCodegenBackend {
218222 #[ cfg( not( feature = "jit" ) ) ]
219223 tcx. dcx ( ) . fatal ( "jit support was disabled when compiling rustc_codegen_cranelift" ) ;
220224 } else {
225+ if tcx. sess . opts . cg . linker_plugin_lto . enabled ( ) {
226+ #[ cfg( feature = "lto" ) ]
227+ return driver:: lto:: run_lto ( tcx) ;
228+
229+ #[ cfg( not( feature = "lto" ) ) ]
230+ tcx. dcx ( ) . fatal ( "LTO support was disabled when compiling rustc_codegen_cranelift" ) ;
231+ }
232+
221233 match tcx. sess . lto ( ) {
222234 Lto :: No | Lto :: ThinLocal => {
223235 Box :: new ( rustc_codegen_ssa:: base:: codegen_crate ( driver:: aot:: AotDriver , tcx) )
224236 }
225237 Lto :: Thin | Lto :: Fat => {
226- if tcx. is_compiler_builtins ( LOCAL_CRATE ) {
227- return Box :: new ( rustc_codegen_ssa:: base:: codegen_crate (
228- driver:: aot:: AotDriver ,
229- tcx,
230- ) ) ;
231- }
232-
233238 #[ cfg( feature = "lto" ) ]
234239 return driver:: lto:: run_lto ( tcx) ;
235240
You can’t perform that action at this time.
0 commit comments