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

Function display_reloc

objdiff-core/src/arch/ppc/mod.rs:520–560  ·  view source on GitHub ↗
(
    resolved: ResolvedRelocation,
    cb: &mut dyn FnMut(InstructionPart) -> Result<()>,
)

Source from the content-addressed store, hash-verified

518}
519
520fn display_reloc(
521 resolved: ResolvedRelocation,
522 cb: &mut dyn FnMut(InstructionPart) -> Result<()>,
523) -> Result<()> {
524 match resolved.relocation.flags {
525 RelocationFlags::Elf(elf::R_PPC_ADDR16_LO)
526 | RelocationFlags::Coff(pe::IMAGE_REL_PPC_REFLO) => {
527 cb(InstructionPart::reloc())?;
528 cb(InstructionPart::basic("@l"))?;
529 }
530 RelocationFlags::Elf(elf::R_PPC_ADDR16_HI)
531 | RelocationFlags::Coff(pe::IMAGE_REL_PPC_REFHI) => {
532 cb(InstructionPart::reloc())?;
533 cb(InstructionPart::basic("@h"))?;
534 }
535 RelocationFlags::Elf(elf::R_PPC_ADDR16_HA) => {
536 cb(InstructionPart::reloc())?;
537 cb(InstructionPart::basic("@ha"))?;
538 }
539 RelocationFlags::Elf(elf::R_PPC_EMB_SDA21) => {
540 cb(InstructionPart::reloc())?;
541 cb(InstructionPart::basic("@sda21"))?;
542 }
543 RelocationFlags::Elf(
544 elf::R_PPC_ADDR32 | elf::R_PPC_UADDR32 | elf::R_PPC_REL24 | elf::R_PPC_REL14,
545 )
546 | RelocationFlags::Coff(
547 pe::IMAGE_REL_PPC_ADDR32 | pe::IMAGE_REL_PPC_REL24 | pe::IMAGE_REL_PPC_REL14,
548 ) => {
549 cb(InstructionPart::reloc())?;
550 }
551 RelocationFlags::Elf(elf::R_PPC_NONE) => {
552 // Fake pool relocation.
553 cb(InstructionPart::basic("<"))?;
554 cb(InstructionPart::reloc())?;
555 cb(InstructionPart::basic(">"))?;
556 }
557 _ => cb(InstructionPart::reloc())?,
558 };
559 Ok(())
560}
561
562#[derive(Debug, Clone)]
563pub struct ExtabSymbolRef {

Callers 1

display_instructionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected