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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ElfRelocationTable.TableFormat
-
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 long
getAddressOffset()
Preferred memory address offset where data should be loaded.ElfSymbolTable
getAssociatedSymbolTable()
Returns the associated symbol table.int
getEntrySize()
Size of each structured entry in byteslong
getFileOffset()
Offset within file where section bytes are specifiedlong
getLength()
Length of file section in bytesint
getRelocationCount()
Get number of relocation entries contained within this tableElfRelocation[]
getRelocations()
Returns the relocations defined in this table.ElfSectionHeader
getSectionToBeRelocated()
Returns the section where the relocations will be applied.ElfSectionHeader
getTableSectionHeader()
Get section header which corresponds to this table, or null if only associated with a dynamic table entryboolean
hasAddendRelocations()
boolean
isRelrTable()
byte[]
toBytes(DataConverter dc)
Returns a byte array representing this implementor of this interface.DataType
toDataType()
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
-
getRelocationCount
public int getRelocationCount()
Get number of relocation entries contained within this table- Returns:
- relocation entry count
-
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:ByteArrayConverter
Returns a byte array representing this implementor of this interface.- Specified by:
toBytes
in interfaceByteArrayConverter
- Parameters:
dc
- the data converter to use- Returns:
- a byte array representing this object
-
getLength
public long getLength()
Description copied from interface:ElfFileSection
Length of file section in bytes- Specified by:
getLength
in interfaceElfFileSection
- Returns:
- length of file section in bytes
-
getAddressOffset
public long getAddressOffset()
Description copied from interface:ElfFileSection
Preferred 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:
getAddressOffset
in 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
-
isRelrTable
public boolean isRelrTable()
-
getFileOffset
public long getFileOffset()
Description copied from interface:ElfFileSection
Offset within file where section bytes are specified- Specified by:
getFileOffset
in interfaceElfFileSection
- Returns:
- offset within file where section bytes are specified
-
getEntrySize
public int getEntrySize()
Description copied from interface:ElfFileSection
Size of each structured entry in bytes- Specified by:
getEntrySize
in interfaceElfFileSection
- Returns:
- entry size or -1 if variable
-
toDataType
public DataType toDataType()
Description copied from interface:StructConverter
Returns 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:
toDataType
in interfaceStructConverter
- Returns:
- returns a structure datatype representing the implementor of this interface
- See Also:
StructureDataType
-
-