Class ElfDynamic

java.lang.Object
ghidra.app.util.bin.format.elf.ElfDynamic

public class ElfDynamic extends Object
A class to represent the Elf32_Dyn data structure.

 typedef  int32_t  Elf32_Sword;
 typedef uint32_t  Elf32_Word;
 typedef uint32_t  Elf32_Addr;
 
  typedef struct {
      Elf32_Sword     d_tag;
      union {
          Elf32_Word  d_val;
          Elf32_Addr  d_ptr;
      } d_un;
  } Elf32_Dyn;
 
 typedef   int64_t  Elf64_Sxword;
 typedef  uint64_t  Elf64_Xword;
 typedef  uint64_t  Elf64_Addr;
 
 typedef struct {
     Elf64_Sxword          d_tag;     //Dynamic entry type
     union {
         Elf64_Xword d_val;     //Integer value
         Elf64_Addr  d_ptr;     //Address value
     } d_un;
 } Elf64_Dyn;
 
 
  • Constructor Details

    • ElfDynamic

      public ElfDynamic(BinaryReader reader, ElfHeader elf) throws IOException
      Construct an ELF dynamic table entry
      Parameters:
      reader - to read dynamic entry at current position (reader is not retained, position moves to next entry)
      elf - ELF header
      Throws:
      IOException - if an IO error occurs during parse
    • ElfDynamic

      public ElfDynamic(int tag, long value, ElfHeader elf)
      Constructs a new ELF dynamic with the specified tag and value.
      Parameters:
      tag - the tag (or type) of this dynamic
      value - the value (or pointer) of this dynamic
      elf - the elf header
    • ElfDynamic

      public ElfDynamic(ElfDynamicType tag, long value, ElfHeader elf)
      Constructs a new ELF dynamic with the specified (enum) tag and value.
      Parameters:
      tag - the (enum) tag (or type) of this dynamic
      value - the value (or pointer) of this dynamic
      elf - the elf header
  • Method Details

    • getTag

      public int getTag()
      Returns the value that controls the interpretation of the the d_val and/or d_ptr.
      Returns:
      the tag (or type) of this dynamic
    • getTagType

      public ElfDynamicType getTagType()
      Returns the enum value that controls the interpretation of the the d_val and/or d_ptr (or null if unknown).
      Returns:
      the enum tag (or type) of this dynamic or null if unknown
    • getValue

      public long getValue()
      Returns the object whose integer values represent various interpretations. For example, if d_tag == DT_SYMTAB, then d_val holds the address of the symbol table. But, if d_tag == DT_SYMENT, then d_val holds the size of each symbol entry.
      Returns:
      the Elf32_Word object represent integer values with various interpretations
    • getTagAsString

      public String getTagAsString()
      A convenience method for getting a string representing the d_tag value. For example, if d_tag == DT_SYMTAB, then this method returns "DT_SYMTAB".
      Returns:
      a string representing the d_tag value
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • sizeof

      public int sizeof()
      Returns:
      the size in bytes of this object.