Class MachoRelocation
- java.lang.Object
 - 
- ghidra.app.util.bin.format.macho.relocation.MachoRelocation
 
 
- 
public class MachoRelocation extends java.lang.ObjectA representation of a single Mach-O relocation that theMachoRelocationHandlerwill use to perform the relocation. In Mach-O, some relocations may be "paired," so an instance of this class may contain 2RelocationInfos. 
- 
- 
Constructor Summary
Constructors Constructor Description MachoRelocation(Program program, MachHeader machoHeader, Address relocationAddress, RelocationInfo relocationInfo)Creates a new unpairedMachoRelocationobjectMachoRelocation(Program program, MachHeader machoHeader, Address relocationAddress, RelocationInfo relocationInfo, RelocationInfo relocationInfoExtra)Creates a new pairedMachoRelocationobject 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProgramgetProgram()Gets theProgramassociated with this relocationAddressgetRelocationAddress()Gets theAddressthe relocation takes place atRelocationInfogetRelocationInfo()Gets the lower-levelRelocationInfothat describes the relocationRelocationInfogetRelocationInfoExtra()Gets the lower-levelRelocationInfothat describes the second part of the paired relocation.AddressgetTargetAddress()Gets theAddressof the relocation targetAddressgetTargetAddressExtra()Gets theAddressof the extra relocation targetjava.lang.StringgetTargetDescription()Gets a short description of the target of the relocationbooleanrequiresRelocation()Checks to see if this relocation requires work to be done on it.java.lang.StringtoString() 
 - 
 
- 
- 
Constructor Detail
- 
MachoRelocation
public MachoRelocation(Program program, MachHeader machoHeader, Address relocationAddress, RelocationInfo relocationInfo)
Creates a new unpairedMachoRelocationobject- Parameters:
 program- The programmachoHeader- The Mach-O headerrelocationAddress- TheAddressthe relocation takes place atrelocationInfo- The lower-levelRelocationInfothat describes the relocation
 
- 
MachoRelocation
public MachoRelocation(Program program, MachHeader machoHeader, Address relocationAddress, RelocationInfo relocationInfo, RelocationInfo relocationInfoExtra)
Creates a new pairedMachoRelocationobject- Parameters:
 program- The programmachoHeader- The Mach-O headerrelocationAddress- TheAddressthe relocation takes place atrelocationInfo- The lower-levelRelocationInfothat describes the first part of the relocationrelocationInfoExtra- The lower-levelRelocationInfothat describes the second part of the relocation
 
 - 
 
- 
Method Detail
- 
getProgram
public Program getProgram()
Gets theProgramassociated with this relocation- Returns:
 - The 
Programassociated with this relocation 
 
- 
getRelocationAddress
public Address getRelocationAddress()
Gets theAddressthe relocation takes place at- Returns:
 - The 
Addressthe relocation takes place at 
 
- 
getRelocationInfo
public RelocationInfo getRelocationInfo()
Gets the lower-levelRelocationInfothat describes the relocation- Returns:
 - The lower-level 
RelocationInfothat describes the relocation 
 
- 
getRelocationInfoExtra
public RelocationInfo getRelocationInfoExtra()
Gets the lower-levelRelocationInfothat describes the second part of the paired relocation. This could be null if the relocation is not paired.- Returns:
 - The lower-level 
RelocationInfothat describes the second part of the paired relocation, or null if the relocation is not paired 
 
- 
getTargetAddress
public Address getTargetAddress() throws NotFoundException
Gets theAddressof the relocation target- Returns:
 - The 
Addressof the relocation target - Throws:
 NotFoundException- If theAddressof the relocation target could not be found
 
- 
getTargetAddressExtra
public Address getTargetAddressExtra() throws NotFoundException
Gets theAddressof the extra relocation target- Returns:
 - The 
Addressof the extra relocation target - Throws:
 NotFoundException- If theAddressof 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 ourloaderdoes 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
public java.lang.String getTargetDescription()
Gets a short description of the target of the relocation- Returns:
 - A short description of the target of the relocation
 
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -