public final class ElfSection extends Object implements SymbolLocator
An object file's section header table lets one locate all the file's sections. The section header table is an array
of Elf32_Shdr or Elf64_Shdr structures. A section header table index is a subscript into this array. The ELF header's
e_shoff member gives the byte offset from the beginning of the file to the section header
table with each section header entry being e_shentsize bytes big.
e_shnum normally tells how many entries the section header table contains, but if the number
of sections is greater than or equal to SHN_LORESERVE (0xff00), e_shnum has the value SHN_UNDEF (0) and the actual
number of section header table entries is contained in the sh_size field of the section header at index 0 (otherwise,
the sh_size member of the initial entry contains 0).
Some section header table indexes are reserved in contexts where index size is restricted, for example, the st_shndx member of a symbol table entry and the e_shnum and e_shstrndx members of the ELF header. In such contexts, the reserved values do not represent actual sections in the object file. Also in such contexts, an escape value indicates that the actual section index is to be found elsewhere, in a larger field.
| 限定符和类型 | 字段和说明 |
|---|---|
long |
address
sh_addr.
|
long |
address_alignment
Address alignment constraints for the section.
|
static String |
DYNAMIC_STRING_TABLE_NAME
Section header name identifying the section as a dynamic string table.
|
long |
entry_size
Size of a fixed-size entry, 0 if none.
|
static int |
FLAG_ALLOC
Flag informing that section occupies memory during process execution.
|
static int |
FLAG_EXEC_INSTR
Flag informing that section contains executable machine instructions.
|
static int |
FLAG_MASK
Flag informing that all the bits in the mask are reserved for processor specific semantics.
|
static int |
FLAG_WRITE
Flag informing that this section contains data that should be writable during process execution.
|
long |
flags
Flags.
|
int |
info
Extra information determined by the section type.
|
int |
link
Section header table index link.
|
int |
name_ndx
Index into the section header string table which gives the name of the section.
|
long |
section_offset
Offset from beginning of file to first byte of the section.
|
static int |
SHT_DYNAMIC
Section holds information for dynamic linking.
|
static int |
SHT_DYNSYM
Section holds a minimum set of dynamic linking symbols.
|
static int |
SHT_FINI_ARRAY |
static int |
SHT_GNU_verdef |
static int |
SHT_GNU_verneed |
static int |
SHT_GNU_versym |
static int |
SHT_GROUP |
static int |
SHT_HASH
Section holds symbol hash table.
|
static int |
SHT_HIOS
Upper bound of the range of indexes reserved for operating system-specific semantics.
|
static int |
SHT_HIPROC
Upper bound of the range of indexes reserved for processor-specific semantics.
|
static int |
SHT_HIUSER
Upper bound of the range of indexes reserved for application programs.
|
static int |
SHT_INIT_ARRAY |
static int |
SHT_LOOS
Lower bound of the range of indexes reserved for operating system-specific semantics.
|
static int |
SHT_LOPROC
Lower bound of the range of indexes reserved for processor-specific semantics.
|
static int |
SHT_LOUSER
Lower bound of the range of indexes reserved for application programs.
|
static int |
SHT_NOBITS
Section occupies no space but resembles TYPE_PROGBITS.
|
static int |
SHT_NOTE
Section holds information that marks the file.
|
static int |
SHT_NULL
Marks the section header as inactive; it does not have an associated section.
|
static int |
SHT_PREINIT_ARRAY |
static int |
SHT_PROGBITS
Section holds information defined by the program.
|
static int |
SHT_REL
Section holds relocation entries without explicit addends.
|
static int |
SHT_RELA
Section holds relocation entries with explicit addends.
|
static int |
SHT_SHLIB
Section is reserved but has unspecified semantics.
|
static int |
SHT_STRTAB
Section holds string table information.
|
static int |
SHT_SYMTAB
Section holds symbol table information for link editing.
|
static int |
SHT_SYMTAB_SHNDX |
long |
size
Size in bytes of the section.
|
static String |
STRING_TABLE_NAME
Section header name identifying the section as a string table.
|
int |
type
Section content and semantics.
|
| 限定符和类型 | 方法和说明 |
|---|---|
ElfDynamicStructure |
getDynamicSection() |
ElfRelocation |
getELFRelocation(int index)
Returns the relocation at the specified index.
|
ElfSymbol |
getELFSymbol(int index)
Returns the symbol at the specified index.
|
ElfSymbol |
getELFSymbolByAddr(long addr) |
ElfSymbol |
getELFSymbolByName(String name) |
net.fornwall.jelf.ElfHashTable |
getHashTable()
Returns the hash table for this section or null if one does not exist.
|
ElfInitArray |
getInitArray() |
String |
getName()
Returns the name of the section or null if the section has no name.
|
int |
getNumberOfRelocations()
Returns the number of relocations in this section or 0 if none.
|
int |
getNumberOfSymbols()
Returns the number of symbols in this section or 0 if none.
|
ElfInitArray |
getPreInitArray() |
net.fornwall.jelf.ElfStringTable |
getStringTable()
Returns the string table for this section or null if one does not exist.
|
String |
toString() |
public static final int SHT_NULL
public static final int SHT_PROGBITS
public static final int SHT_SYMTAB
public static final int SHT_STRTAB
public static final int SHT_RELA
public static final int SHT_HASH
public static final int SHT_DYNAMIC
public static final int SHT_NOTE
public static final int SHT_NOBITS
public static final int SHT_REL
public static final int SHT_SHLIB
public static final int SHT_DYNSYM
public static final int SHT_INIT_ARRAY
public static final int SHT_FINI_ARRAY
public static final int SHT_PREINIT_ARRAY
public static final int SHT_GROUP
public static final int SHT_SYMTAB_SHNDX
public static final int SHT_GNU_verdef
public static final int SHT_GNU_verneed
public static final int SHT_GNU_versym
public static final int SHT_LOOS
public static final int SHT_HIOS
public static final int SHT_LOPROC
public static final int SHT_HIPROC
public static final int SHT_LOUSER
public static final int SHT_HIUSER
public static final int FLAG_WRITE
public static final int FLAG_ALLOC
public static final int FLAG_EXEC_INSTR
public static final int FLAG_MASK
public static final String STRING_TABLE_NAME
public static final String DYNAMIC_STRING_TABLE_NAME
public final int name_ndx
public final int type
public final long flags
public final long address
public final long section_offset
public final long size
public final int link
public final int info
public final long address_alignment
public final long entry_size
public ElfInitArray getInitArray() throws IOException
IOExceptionpublic ElfInitArray getPreInitArray() throws IOException
IOExceptionpublic int getNumberOfSymbols()
public ElfSymbol getELFSymbol(int index) throws IOException
getELFSymbol 在接口中 SymbolLocatorIOExceptionpublic ElfSymbol getELFSymbolByName(String name) throws IOException
getELFSymbolByName 在接口中 SymbolLocatorIOExceptionpublic ElfSymbol getELFSymbolByAddr(long addr) throws IOException
getELFSymbolByAddr 在接口中 SymbolLocatorIOExceptionpublic int getNumberOfRelocations()
public ElfRelocation getELFRelocation(int index) throws IOException
IOExceptionpublic net.fornwall.jelf.ElfStringTable getStringTable()
throws IOException
IOExceptionpublic ElfDynamicStructure getDynamicSection() throws IOException
IOExceptionpublic net.fornwall.jelf.ElfHashTable getHashTable()
throws IOException
IOExceptionpublic String getName() throws IOException
IOExceptionCopyright © 2021. All rights reserved.