MCPcopy Create free account
hub / github.com/encounter/objdiff / find_reloc_arg

Method find_reloc_arg

objdiff-core/src/arch/ppc/mod.rs:89–109  ·  view source on GitHub ↗
(
        &self,
        ins: &powerpc::ParsedIns,
        resolved: Option<ResolvedRelocation>,
    )

Source from the content-addressed store, hash-verified

87 }
88
89 fn find_reloc_arg(
90 &self,
91 ins: &powerpc::ParsedIns,
92 resolved: Option<ResolvedRelocation>,
93 ) -> Option<usize> {
94 match resolved?.relocation.flags {
95 RelocationFlags::Elf(elf::R_PPC_EMB_SDA21) => Some(1),
96 RelocationFlags::Elf(elf::R_PPC_REL24 | elf::R_PPC_REL14)
97 | RelocationFlags::Coff(pe::IMAGE_REL_PPC_REL24 | pe::IMAGE_REL_PPC_REL14) => {
98 ins.args.iter().rposition(is_relative_arg)
99 }
100 RelocationFlags::Elf(
101 elf::R_PPC_ADDR16_HI | elf::R_PPC_ADDR16_HA | elf::R_PPC_ADDR16_LO,
102 )
103 | RelocationFlags::Coff(pe::IMAGE_REL_PPC_REFHI | pe::IMAGE_REL_PPC_REFLO) => {
104 ins.args.iter().rposition(is_rel_abs_arg)
105 }
106 RelocationFlags::Elf(elf::R_PPC64_TOC16) => ins.args.iter().rposition(is_offset_arg),
107 _ => None,
108 }
109 }
110}
111
112impl Arch for ArchPpc {

Callers 1

display_instructionMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected