| 518 | } |
| 519 | |
| 520 | fn 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)] |
| 563 | pub struct ExtabSymbolRef { |