Package ghidra.program.model.reloc

# Class Relocation

java.lang.Object
ghidra.program.model.reloc.Relocation

public class Relocation extends Object
A class to store the information needed for a single program relocation.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `Relocation.Status`
  Relocation status.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Relocation(Address addr, Relocation.Status status, int type, long[] values, byte[] bytes, String symbolName)`
  Constructs a new relocation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Address`
  `getAddress()`
  Returns the address where the relocation is required.
  `byte[]`
  `getBytes()`
  Returns the original instruction bytes affected by applied relocation.
  `int`
  `getLength()`
  Returns the number of original instruction bytes affected by applied relocation.
  `Relocation.Status`
  `getStatus()`
  Return the relocation's application status within the program.
  `String`
  `getSymbolName()`
  The name of the symbol being relocated or `null` if there is no symbol name.
  `int`
  `getType()`
  Returns the type of the relocation to perform.
  `long[]`
  `getValues()`
  Returns the value needed when performing the relocation.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Relocation

    public Relocation(Address addr, Relocation.Status status, int type, long[] values, byte[] bytes, String symbolName)
    Constructs a new relocation.
    Parameters:
      `addr` - the address where the relocation is required
      `status` - relocation status
      `type` - the type of relocation to perform
      `values` - the values needed when performing the relocation. Definition of values is specific to loader used and relocation type.
      `bytes` - original instruction bytes affected by relocation
      `symbolName` - the name of the symbol being relocated

- ## Method Details

  - ### getAddress

    public Address getAddress()
    Returns the address where the relocation is required.
    Returns:
      the address where the relocation is required

  - ### getStatus

    public Relocation.Status getStatus()
    Return the relocation's application status within the program.
    Returns:
      relocation's application status within the program.

  - ### getType

    public int getType()
    Returns the type of the relocation to perform.
    Returns:
      the type of the relocation to perform

  - ### getValues

    public long[] getValues()
    Returns the value needed when performing the relocation.
    Returns:
      the value needed when performing the relocation

  - ### getBytes

    public byte[] getBytes()
    Returns the original instruction bytes affected by applied relocation.
    Returns:
      original instruction bytes affected by relocation if it was successfully applied (i.e., `Relocation.Status.APPLIED`, `Relocation.Status.APPLIED_OTHER`), otherwise null may be returned.

  - ### getLength

    public int getLength()
    Returns the number of original instruction bytes affected by applied relocation.
    Returns:
      number of original instruction bytes affected by relocation if it was successfully applied (i.e., `Relocation.Status.APPLIED`, `Relocation.Status.APPLIED_OTHER`), otherwise null may be returned.

  - ### getSymbolName

    public String getSymbolName()
    The name of the symbol being relocated or `null` if there is no symbol name.
    Returns:
      the name of the symbol being relocated or `null` if there is no symbol name.