Class MachoRelocationHandler
- java.lang.Object
-
- ghidra.app.util.bin.format.macho.relocation.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 Summary
Constructors Constructor Description MachoRelocationHandler()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleancanRelocate(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 headerabstract booleanisPairedRelocation(RelocationInfo relocation)Checks to see if the given relocation is a "paired" relocation.static longread(MachoRelocation relocation)Reads bytes at the given address.abstract voidrelocate(MachoRelocation relocation)Performs a relocationstatic voidwrite(MachoRelocation relocation, long value)Writes bytes at the given address.
-
-
-
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
-
relocate
public abstract void relocate(MachoRelocation relocation) throws MemoryAccessException, NotFoundException
Performs a relocation- Parameters:
relocation- The relocation to perform- Throws:
MemoryAccessException- If there is a problem accessing memory during the relocationNotFoundException- If this handler didn't find a way to perform the relocation
-
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 writevalue- The value to write- Throws:
MemoryAccessException- If there is a problem accessing memory during the write
-
-