Remove more dead relocation handling code (#3924)
Forgotten from #3905 I now realized.
This commit is contained in:
@@ -14,9 +14,8 @@
|
|||||||
//! names have format "_trampoline_N", where N is `SignatureIndex`.
|
//! names have format "_trampoline_N", where N is `SignatureIndex`.
|
||||||
|
|
||||||
use crate::debug::{DwarfSection, DwarfSectionRelocTarget};
|
use crate::debug::{DwarfSection, DwarfSectionRelocTarget};
|
||||||
use crate::{CompiledFunction, Relocation, RelocationTarget};
|
use crate::{CompiledFunction, RelocationTarget};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use cranelift_codegen::binemit::Reloc;
|
|
||||||
use cranelift_codegen::isa::{
|
use cranelift_codegen::isa::{
|
||||||
unwind::{systemv, UnwindInfo},
|
unwind::{systemv, UnwindInfo},
|
||||||
TargetIsa,
|
TargetIsa,
|
||||||
@@ -34,7 +33,6 @@ use object::{
|
|||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::mem;
|
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
use wasmtime_environ::obj;
|
use wasmtime_environ::obj;
|
||||||
use wasmtime_environ::{
|
use wasmtime_environ::{
|
||||||
@@ -105,12 +103,6 @@ pub struct ObjectBuilder<'a> {
|
|||||||
/// `object`-crate identifier for the text section.
|
/// `object`-crate identifier for the text section.
|
||||||
text_section: SectionId,
|
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
|
/// In-progress text section that we're using cranelift's `MachBuffer` to
|
||||||
/// build to resolve relocations (calls) between functions.
|
/// build to resolve relocations (calls) between functions.
|
||||||
pub text: Box<dyn TextSectionBuilder>,
|
pub text: Box<dyn TextSectionBuilder>,
|
||||||
@@ -171,7 +163,6 @@ impl<'a> ObjectBuilder<'a> {
|
|||||||
windows_unwind_info: Vec::new(),
|
windows_unwind_info: Vec::new(),
|
||||||
systemv_unwind_info_id: None,
|
systemv_unwind_info_id: None,
|
||||||
systemv_unwind_info: Vec::new(),
|
systemv_unwind_info: Vec::new(),
|
||||||
relocations: Vec::new(),
|
|
||||||
text: isa
|
text: isa
|
||||||
.text_section_builder((module.functions.len() - module.num_imported_funcs) as u32),
|
.text_section_builder((module.functions.len() - module.num_imported_funcs) as u32),
|
||||||
added_unwind_info: false,
|
added_unwind_info: false,
|
||||||
@@ -374,35 +365,6 @@ impl<'a> ObjectBuilder<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn finish(&mut self) -> Result<()> {
|
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.
|
// Finish up the text section now that we're done adding functions.
|
||||||
let text = self.text.finish();
|
let text = self.text.finish();
|
||||||
self.obj
|
self.obj
|
||||||
|
|||||||
Reference in New Issue
Block a user