Class MachoRelocation
java.lang.Object
ghidra.app.util.bin.format.macho.relocation.MachoRelocation
A representation of a single Mach-O relocation that the
MachoRelocationHandler
will use
to perform the relocation. In Mach-O, some relocations may be "paired," so an instance of this
class may contain 2 RelocationInfo
s.-
Constructor Summary
ConstructorDescriptionMachoRelocation
(Program program, MachHeader machoHeader, Address relocationAddress, RelocationInfo relocationInfo) Creates a new unpairedMachoRelocation
objectMachoRelocation
(Program program, MachHeader machoHeader, Address relocationAddress, RelocationInfo relocationInfo, RelocationInfo relocationInfoExtra) Creates a new pairedMachoRelocation
object -
Method Summary
Modifier and TypeMethodDescriptionGets theProgram
associated with this relocationGets theAddress
the relocation takes place atGets the lower-levelRelocationInfo
that describes the relocationGets the lower-levelRelocationInfo
that describes the second part of the paired relocation.Gets theAddress
of the relocation targetGets theAddress
of the extra relocation targetGets a short description of the target of the relocationboolean
Checks to see if this relocation requires work to be done on it.toString()
-
Constructor Details
-
MachoRelocation
public MachoRelocation(Program program, MachHeader machoHeader, Address relocationAddress, RelocationInfo relocationInfo) Creates a new unpairedMachoRelocation
object- Parameters:
program
- The programmachoHeader
- The Mach-O headerrelocationAddress
- TheAddress
the relocation takes place atrelocationInfo
- The lower-levelRelocationInfo
that describes the relocation
-
MachoRelocation
public MachoRelocation(Program program, MachHeader machoHeader, Address relocationAddress, RelocationInfo relocationInfo, RelocationInfo relocationInfoExtra) Creates a new pairedMachoRelocation
object- Parameters:
program
- The programmachoHeader
- The Mach-O headerrelocationAddress
- TheAddress
the relocation takes place atrelocationInfo
- The lower-levelRelocationInfo
that describes the first part of the relocationrelocationInfoExtra
- The lower-levelRelocationInfo
that describes the second part of the relocation
-
-
Method Details
-
getProgram
Gets theProgram
associated with this relocation- Returns:
- The
Program
associated with this relocation
-
getRelocationAddress
Gets theAddress
the relocation takes place at- Returns:
- The
Address
the relocation takes place at
-
getRelocationInfo
Gets the lower-levelRelocationInfo
that describes the relocation- Returns:
- The lower-level
RelocationInfo
that describes the relocation
-
getRelocationInfoExtra
Gets the lower-levelRelocationInfo
that describes the second part of the paired relocation. This could be null if the relocation is not paired.- Returns:
- The lower-level
RelocationInfo
that describes the second part of the paired relocation, or null if the relocation is not paired
-
getTargetAddress
Gets theAddress
of the relocation target- Returns:
- The
Address
of the relocation target - Throws:
RelocationException
- If theAddress
of the relocation target could not be found
-
getTargetAddressExtra
Gets theAddress
of the extra relocation target- Returns:
- The
Address
of the extra relocation target - Throws:
RelocationException
- If theAddress
of the extra relocation target could not be found (of if there wasn't an extra relocation target).
-
requiresRelocation
public boolean requiresRelocation()Checks to see if this relocation requires work to be done on it. Since ourloader
does not allow non-default image bases, it is unnecessary to perform relocations under certain conditions.- Returns:
- True if relocation steps are needed; otherwise, false
-
getTargetDescription
Gets a short description of the target of the relocation- Returns:
- A short description of the target of the relocation
-
toString
-