Class MachoRelocationHandler

  • All Implemented Interfaces:
    ExtensionPoint

    public abstract class MachoRelocationHandler
    extends java.lang.Object
    implements ExtensionPoint
    An abstract class used to perform Mach-O relocations. Classes should extend this class to provide relocations in a machine/processor specific way.
    See Also:
    mach-o/reloc.h
    • Constructor Detail

      • MachoRelocationHandler

        public MachoRelocationHandler()
    • Method Detail

      • canRelocate

        public abstract boolean canRelocate​(MachHeader header)
        Checks to see whether or not an instance of this Mach-O relocation handler can handle relocating the Mach-O defined by the provided file header
        Parameters:
        header - The header associated with the Mach-O to relocate
        Returns:
        True if this relocation handler can do the relocation; otherwise, false
      • isPairedRelocation

        public abstract boolean isPairedRelocation​(RelocationInfo relocation)
        Checks to see if the given relocation is a "paired" relocation. A paired relocation has a certain expectation from the relocation that follows it.
        Parameters:
        relocation - The relocation to check
        Returns:
        True if the given relocation is a "paired" relocation; otherwise, false
      • read

        public static long read​(MachoRelocation relocation)
                         throws MemoryAccessException
        Reads bytes at the given address. The size of the read is determined by the length of the relocation info.
        Parameters:
        relocation - The relocation to read
        Returns:
        The read bytes
        Throws:
        MemoryAccessException - If there is a problem accessing memory during the read
      • write

        public static void write​(MachoRelocation relocation,
                                 long value)
                          throws MemoryAccessException
        Writes bytes at the given address. The size of the write is determined by the length of the relocation info.
        Parameters:
        relocation - The relocation to write
        value - The value to write
        Throws:
        MemoryAccessException - If there is a problem accessing memory during the write