diff --git a/crates/cranelift/src/obj.rs b/crates/cranelift/src/obj.rs index 05bde6d7f7..08373bb2cf 100644 --- a/crates/cranelift/src/obj.rs +++ b/crates/cranelift/src/obj.rs @@ -14,9 +14,8 @@ //! names have format "_trampoline_N", where N is `SignatureIndex`. use crate::debug::{DwarfSection, DwarfSectionRelocTarget}; -use crate::{CompiledFunction, Relocation, RelocationTarget}; +use crate::{CompiledFunction, RelocationTarget}; use anyhow::Result; -use cranelift_codegen::binemit::Reloc; use cranelift_codegen::isa::{ unwind::{systemv, UnwindInfo}, TargetIsa, @@ -34,7 +33,6 @@ use object::{ }; use std::collections::HashMap; use std::convert::TryFrom; -use std::mem; use std::ops::Range; use wasmtime_environ::obj; use wasmtime_environ::{ @@ -105,12 +103,6 @@ pub struct ObjectBuilder<'a> { /// `object`-crate identifier for the text section. text_section: SectionId, - /// Relocations to be added once we've got all function symbols available to - /// us. The first entry is the relocation that we're applying, relative - /// within a function, and the second entry here is the offset of the - /// function that contains this relocation. - relocations: Vec<(&'a Relocation, u64)>, - /// In-progress text section that we're using cranelift's `MachBuffer` to /// build to resolve relocations (calls) between functions. pub text: Box, @@ -171,7 +163,6 @@ impl<'a> ObjectBuilder<'a> { windows_unwind_info: Vec::new(), systemv_unwind_info_id: None, systemv_unwind_info: Vec::new(), - relocations: Vec::new(), text: isa .text_section_builder((module.functions.len() - module.num_imported_funcs) as u32), added_unwind_info: false, @@ -374,35 +365,6 @@ impl<'a> ObjectBuilder<'a> { } pub fn finish(&mut self) -> Result<()> { - // Now that all function symbols are available register all final - // relocations between functions. - // - // FIXME(#3009) once the old backend is removed this loop should be - // deleted since there won't be any relocations here. - for (r, off) in mem::take(&mut self.relocations) { - let symbol = match r.reloc_target { - RelocationTarget::UserFunc(index) => self.func_symbols[index], - _ => unreachable!("should be handled in `append_func`"), - }; - let (kind, encoding, size) = match r.reloc { - Reloc::X86CallPCRel4 => { - (RelocationKind::Relative, RelocationEncoding::X86Branch, 32) - } - other => unimplemented!("Unimplemented relocation {:?}", other), - }; - self.obj.add_relocation( - self.text_section, - ObjectRelocation { - offset: off + u64::from(r.offset), - size, - kind, - encoding, - symbol, - addend: r.addend, - }, - )?; - } - // Finish up the text section now that we're done adding functions. let text = self.text.finish(); self.obj