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

Function new_arch

objdiff-core/src/arch/mod.rs:503–527  ·  view source on GitHub ↗
(object: &object::File, diff_side: DiffSide)

Source from the content-addressed store, hash-verified

501}
502
503pub fn new_arch(object: &object::File, diff_side: DiffSide) -> Result<Box<dyn Arch>> {
504 use object::Object as _;
505 // Avoid unused warnings on non-mips builds
506 let _ = diff_side;
507
508 Ok(match object.architecture() {
509 #[cfg(feature = "ppc")]
510 object::Architecture::PowerPc | object::Architecture::PowerPc64 => {
511 Box::new(ppc::ArchPpc::new(object)?)
512 }
513 #[cfg(feature = "mips")]
514 object::Architecture::Mips => Box::new(mips::ArchMips::new(object, diff_side)?),
515 #[cfg(feature = "x86")]
516 object::Architecture::I386 | object::Architecture::X86_64 => {
517 Box::new(x86::ArchX86::new(object)?)
518 }
519 #[cfg(feature = "arm")]
520 object::Architecture::Arm => Box::new(arm::ArchArm::new(object)?),
521 #[cfg(feature = "arm64")]
522 object::Architecture::Aarch64 => Box::new(arm64::ArchArm64::new(object)?),
523 #[cfg(feature = "superh")]
524 object::Architecture::SuperH => Box::new(superh::ArchSuperH::new(object)?),
525 arch => bail!("Unsupported architecture: {arch:?}"),
526 })
527}
528
529#[derive(Debug, Default)]
530pub struct ArchDummy {}

Callers 1

parseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected