Package ghidra.app.util.bin.format.elf
Class ElfRelocationTable
- java.lang.Object
-
- ghidra.app.util.bin.format.elf.ElfRelocationTable
-
- All Implemented Interfaces:
ByteArrayConverter,ElfFileSection,StructConverter
public class ElfRelocationTable extends java.lang.Object implements ElfFileSection, ByteArrayConverter
A container class to hold ELF relocations.
-
-
Constructor Summary
Constructors Constructor Description ElfRelocationTable()DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetAddressOffset()Preferred memory address offset where data should be loaded.ElfSymbolTablegetAssociatedSymbolTable()Returns the associated symbol table.intgetEntrySize()Size of each structured entry in byteslonggetFileOffset()Offset within file where section bytes are specifiedlonggetLength()Length of file section in bytesElfRelocation[]getRelocations()Returns the relocations defined in this table.ElfSectionHeadergetSectionToBeRelocated()Returns the section where the relocations will be applied.ElfSectionHeadergetTableSectionHeader()Get section header which corresponds to this table, or null if only associated with a dynamic table entrybooleanhasAddendRelocations()byte[]toBytes(DataConverter dc)Returns a byte array representing this implementor of this interface.DataTypetoDataType()Returns a structure datatype representing the contents of the implementor of this interface.
-
-
-
Method Detail
-
hasAddendRelocations
public boolean hasAddendRelocations()
- Returns:
- true if has addend relocations, otherwise addend extraction from relocation target may be required
-
getSectionToBeRelocated
public ElfSectionHeader getSectionToBeRelocated()
Returns the section where the relocations will be applied. For example, this method will return ".plt" for ".rel.plt"- Returns:
- the section where the relocations will be applied or null for dynamic relocation table not associated with a section.
-
getRelocations
public ElfRelocation[] getRelocations()
Returns the relocations defined in this table.- Returns:
- the relocations defined in this table
-
getAssociatedSymbolTable
public ElfSymbolTable getAssociatedSymbolTable()
Returns the associated symbol table. A relocation object contains a symbol index. This index is into this symbol table.- Returns:
- the associated symbol table
-
toBytes
public byte[] toBytes(DataConverter dc)
Description copied from interface:ByteArrayConverterReturns a byte array representing this implementor of this interface.- Specified by:
toBytesin interfaceByteArrayConverter- Parameters:
dc- the data converter to use- Returns:
- a byte array representing this object
- See Also:
ByteArrayConverter.toBytes(ghidra.util.DataConverter)
-
getLength
public long getLength()
Description copied from interface:ElfFileSectionLength of file section in bytes- Specified by:
getLengthin interfaceElfFileSection- Returns:
- length of file section in bytes
-
getAddressOffset
public long getAddressOffset()
Description copied from interface:ElfFileSectionPreferred memory address offset where data should be loaded. The returned offset will already have the prelink adjustment applied, although will not reflect any change in the image base.- Specified by:
getAddressOffsetin interfaceElfFileSection- Returns:
- default memory address offset where data should be loaded
-
getTableSectionHeader
public ElfSectionHeader getTableSectionHeader()
Get section header which corresponds to this table, or null if only associated with a dynamic table entry- Returns:
- relocation table section header or null
-
getFileOffset
public long getFileOffset()
Description copied from interface:ElfFileSectionOffset within file where section bytes are specified- Specified by:
getFileOffsetin interfaceElfFileSection- Returns:
- offset within file where section bytes are specified
-
getEntrySize
public int getEntrySize()
Description copied from interface:ElfFileSectionSize of each structured entry in bytes- Specified by:
getEntrySizein interfaceElfFileSection- Returns:
- entry size or -1 if variable
-
toDataType
public DataType toDataType()
Description copied from interface:StructConverterReturns a structure datatype representing the contents of the implementor of this interface.For example, given:
class A { int foo; double bar; }The return value should be a structure data type with two data type components; an INT and a DOUBLE. The structure should contain field names and, if possible, field comments.
- Specified by:
toDataTypein interfaceStructConverter- Returns:
- returns a structure datatype representing the implementor of this interface
- See Also:
StructConverter.toDataType()
-
-