MCPcopy Index your code
hub / github.com/encounter/objdiff / Arch

Interface Arch

objdiff-core/src/arch/mod.rs:392–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

390}
391
392pub trait Arch: Any + Debug + Send + Sync {
393 /// Finishes arch-specific initialization that must be done after sections have been combined.
394 fn post_init(&mut self, _sections: &[Section], _symbols: &[Symbol], _symbol_indices: &[usize]) {
395 }
396
397 /// Generate a list of instructions references (offset, size, opcode) from the given code.
398 ///
399 /// The opcode IDs are used to generate the initial diff. Implementations should do as little
400 /// parsing as possible here: just enough to identify the base instruction opcode, size, and
401 /// possible branch destination (for visual representation). As needed, instructions are parsed
402 /// via `process_instruction` to compare their arguments.
403 fn scan_instructions_internal(
404 &self,
405 address: u64,
406 code: &[u8],
407 section_index: usize,
408 relocations: &[Relocation],
409 diff_config: &DiffObjConfig,
410 ) -> Result<Vec<InstructionRef>>;
411
412 /// Format an instruction for display.
413 ///
414 /// Implementations should call the callback for each part of the instruction: usually the
415 /// mnemonic and arguments, plus any separators and visual formatting.
416 fn display_instruction(
417 &self,
418 resolved: ResolvedInstructionRef,
419 diff_config: &DiffObjConfig,
420 cb: &mut dyn FnMut(InstructionPart) -> Result<()>,
421 ) -> Result<()>;
422
423 /// Generate a list of fake relocations from the given code that represent pooled data accesses.
424 fn generate_pooled_relocations(
425 &self,
426 _address: u64,
427 _code: &[u8],
428 _relocations: &[Relocation],
429 _symbols: &[Symbol],
430 ) -> Vec<Relocation> {
431 Vec::new()
432 }
433
434 // Perform detailed data flow analysis
435 fn data_flow_analysis(
436 &self,
437 _obj: &Object,
438 _symbol: &Symbol,
439 _code: &[u8],
440 _relocations: &[Relocation],
441 ) -> Option<Box<dyn FlowAnalysisResult>> {
442 None
443 }
444
445 fn relocation_override(
446 &self,
447 _file: &object::File<'_>,
448 _section: &object::Section,
449 _address: u64,

Callers

nothing calls this directly

Implementers 7

arm64.rsobjdiff-core/src/arch/arm64.rs
arm.rsobjdiff-core/src/arch/arm.rs
mod.rsobjdiff-core/src/arch/mod.rs
mips.rsobjdiff-core/src/arch/mips.rs
x86.rsobjdiff-core/src/arch/x86.rs
mod.rsobjdiff-core/src/arch/superh/mod.rs
mod.rsobjdiff-core/src/arch/ppc/mod.rs

Calls

no outgoing calls

Tested by

no test coverage detected