| 4706 | } |
| 4707 | |
| 4708 | virtual bool GetRelocationInfo(Ref<BinaryView> view, Ref<Architecture> arch, vector<BNRelocationInfo>& result) override |
| 4709 | { |
| 4710 | (void)view; (void)arch; |
| 4711 | set<uint64_t> relocTypes; |
| 4712 | for (auto& reloc : result) |
| 4713 | { |
| 4714 | switch (reloc.nativeType) |
| 4715 | { |
| 4716 | case PE_IMAGE_REL_BASED_ABSOLUTE: |
| 4717 | reloc.type = IgnoredRelocation; |
| 4718 | break; |
| 4719 | case PE_IMAGE_REL_BASED_HIGHLOW: |
| 4720 | reloc.size = 4; |
| 4721 | break; |
| 4722 | case PE_IMAGE_REL_BASED_DIR64: |
| 4723 | reloc.size = 8; |
| 4724 | break; |
| 4725 | case PE_IMAGE_REL_BASED_HIGH: |
| 4726 | reloc.size = 2; |
| 4727 | break; |
| 4728 | case PE_IMAGE_REL_BASED_LOW: |
| 4729 | reloc.size = 2; |
| 4730 | break; |
| 4731 | case PE_IMAGE_USER_DEFINED: |
| 4732 | reloc.type = StandardRelocationType; |
| 4733 | break; |
| 4734 | default: |
| 4735 | // By default, PE relocations are correct when not rebased. |
| 4736 | // Upon rebasing, support would need to be added to correctly process the relocation |
| 4737 | reloc.type = UnhandledRelocation; |
| 4738 | relocTypes.insert(reloc.nativeType); |
| 4739 | } |
| 4740 | } |
| 4741 | |
| 4742 | for (auto& reloc : relocTypes) |
| 4743 | LogWarn("Unsupported PE relocation: %s", GetRelocationString((PeRelocationType)reloc)); |
| 4744 | return false; |
| 4745 | } |
| 4746 | |
| 4747 | virtual size_t GetOperandForExternalRelocation(const uint8_t* data, uint64_t addr, size_t length, |
| 4748 | Ref<LowLevelILFunction> il, Ref<Relocation> relocation) override |
nothing calls this directly
no test coverage detected