Move almost all logic out of Module

This commit is contained in:
bjorn3
2020-09-30 16:50:24 +02:00
parent 588a4be0b3
commit 80f4ecf9b5
4 changed files with 106 additions and 87 deletions

View File

@@ -8,8 +8,8 @@ use cranelift_codegen::entity::SecondaryMap;
use cranelift_codegen::isa::TargetIsa;
use cranelift_codegen::{self, ir};
use cranelift_module::{
Backend, DataContext, DataDescription, DataId, FuncId, FuncOrDataId, Init, Linkage,
ModuleDeclarations, ModuleError, ModuleResult,
Backend, DataContext, DataDescription, DataId, FuncId, Init, Linkage, ModuleDeclarations,
ModuleError, ModuleResult,
};
use object::write::{
Object, Relocation, SectionId, StandardSection, Symbol, SymbolId, SymbolSection,
@@ -410,11 +410,7 @@ impl Backend for ObjectBackend {
Ok(())
}
fn finish(
mut self,
_names: HashMap<String, FuncOrDataId>,
declarations: ModuleDeclarations,
) -> ObjectProduct {
fn finish(mut self, declarations: ModuleDeclarations) -> ObjectProduct {
let symbol_relocs = mem::take(&mut self.relocs);
for symbol in symbol_relocs {
for &RelocRecord {