@@ -11,15 +11,13 @@ use std::thread::JoinHandle;
11
11
use cranelift_object:: { ObjectBuilder , ObjectModule } ;
12
12
use rustc_codegen_ssa:: assert_module_sources:: CguReuse ;
13
13
use rustc_codegen_ssa:: back:: link:: ensure_removed;
14
- use rustc_codegen_ssa:: back:: metadata:: create_compressed_metadata_file;
15
14
use rustc_codegen_ssa:: base:: determine_cgu_reuse;
16
15
use rustc_codegen_ssa:: {
17
16
CodegenResults , CompiledModule , CrateInfo , ModuleKind , errors as ssa_errors,
18
17
} ;
19
18
use rustc_data_structures:: profiling:: SelfProfilerRef ;
20
19
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
21
20
use rustc_data_structures:: sync:: { IntoDynSyncSend , par_map} ;
22
- use rustc_metadata:: EncodedMetadata ;
23
21
use rustc_metadata:: fs:: copy_to_stdout;
24
22
use rustc_middle:: dep_graph:: { WorkProduct , WorkProductId } ;
25
23
use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrFlags ;
@@ -61,7 +59,6 @@ impl<HCX> HashStable<HCX> for OngoingModuleCodegen {
61
59
pub ( crate ) struct OngoingCodegen {
62
60
modules : Vec < OngoingModuleCodegen > ,
63
61
allocator_module : Option < CompiledModule > ,
64
- metadata_module : Option < CompiledModule > ,
65
62
crate_info : CrateInfo ,
66
63
concurrency_limiter : ConcurrencyLimiter ,
67
64
}
@@ -133,7 +130,6 @@ impl OngoingCodegen {
133
130
let codegen_results = CodegenResults {
134
131
modules,
135
132
allocator_module : self . allocator_module ,
136
- metadata_module : self . metadata_module ,
137
133
crate_info : self . crate_info ,
138
134
} ;
139
135
@@ -644,42 +640,6 @@ fn module_codegen(
644
640
} ) )
645
641
}
646
642
647
- fn emit_metadata_module ( tcx : TyCtxt < ' _ > , metadata : & EncodedMetadata ) -> CompiledModule {
648
- use rustc_middle:: mir:: mono:: CodegenUnitNameBuilder ;
649
-
650
- let _timer = tcx. sess . timer ( "write compressed metadata" ) ;
651
-
652
- let cgu_name_builder = & mut CodegenUnitNameBuilder :: new ( tcx) ;
653
- let metadata_cgu_name = cgu_name_builder
654
- . build_cgu_name ( LOCAL_CRATE , [ "crate" ] , Some ( "metadata" ) )
655
- . as_str ( )
656
- . to_string ( ) ;
657
-
658
- let tmp_file = tcx. output_filenames ( ( ) ) . temp_path_for_cgu (
659
- OutputType :: Metadata ,
660
- & metadata_cgu_name,
661
- tcx. sess . invocation_temp . as_deref ( ) ,
662
- ) ;
663
-
664
- let symbol_name = rustc_middle:: middle:: exported_symbols:: metadata_symbol_name ( tcx) ;
665
- let obj = create_compressed_metadata_file ( tcx. sess , metadata, & symbol_name) ;
666
-
667
- if let Err ( err) = std:: fs:: write ( & tmp_file, obj) {
668
- tcx. dcx ( ) . fatal ( format ! ( "error writing metadata object file: {}" , err) ) ;
669
- }
670
-
671
- CompiledModule {
672
- name : metadata_cgu_name,
673
- kind : ModuleKind :: Metadata ,
674
- object : Some ( tmp_file) ,
675
- dwarf_object : None ,
676
- bytecode : None ,
677
- assembly : None ,
678
- llvm_ir : None ,
679
- links_from_incr_cache : Vec :: new ( ) ,
680
- }
681
- }
682
-
683
643
fn emit_allocator_module ( tcx : TyCtxt < ' _ > ) -> Option < CompiledModule > {
684
644
let mut allocator_module = make_module ( tcx. sess , "allocator_shim" . to_string ( ) ) ;
685
645
let created_alloc_shim = crate :: allocator:: codegen ( tcx, & mut allocator_module) ;
@@ -704,7 +664,7 @@ fn emit_allocator_module(tcx: TyCtxt<'_>) -> Option<CompiledModule> {
704
664
}
705
665
}
706
666
707
- pub ( crate ) fn run_aot ( tcx : TyCtxt < ' _ > , metadata : Option < & EncodedMetadata > ) -> Box < OngoingCodegen > {
667
+ pub ( crate ) fn run_aot ( tcx : TyCtxt < ' _ > ) -> Box < OngoingCodegen > {
708
668
// FIXME handle `-Ctarget-cpu=native`
709
669
let target_cpu = match tcx. sess . opts . cg . target_cpu {
710
670
Some ( ref name) => name,
@@ -720,7 +680,6 @@ pub(crate) fn run_aot(tcx: TyCtxt<'_>, metadata: Option<&EncodedMetadata>) -> Bo
720
680
return Box :: new ( OngoingCodegen {
721
681
modules : vec ! [ ] ,
722
682
allocator_module : None ,
723
- metadata_module : None ,
724
683
crate_info : CrateInfo :: new ( tcx, target_cpu) ,
725
684
concurrency_limiter : ConcurrencyLimiter :: new ( 0 ) ,
726
685
} ) ;
@@ -780,12 +739,9 @@ pub(crate) fn run_aot(tcx: TyCtxt<'_>, metadata: Option<&EncodedMetadata>) -> Bo
780
739
781
740
let allocator_module = emit_allocator_module ( tcx) ;
782
741
783
- let metadata_module = metadata. map ( |metadata| emit_metadata_module ( tcx, metadata) ) ;
784
-
785
742
Box :: new ( OngoingCodegen {
786
743
modules,
787
744
allocator_module,
788
- metadata_module,
789
745
crate_info : CrateInfo :: new ( tcx, target_cpu) ,
790
746
concurrency_limiter : concurrency_limiter. 0 ,
791
747
} )
0 commit comments