83 if (shstrndx >= header->
e_shnum)
104 if (strTable[shstrHdr->
sh_size - 1] !=
'\0')
138 if (strTable[shdr->
sh_size - 1] !=
'\0')
186 for (
uint64_t j = 0; j < symCount; j++)
uint64_t elf64_validate(Elf64_File *elf, void *data, uint64_t size)
Validate a files content and initalize a ELF64_File structure using it.
@ ELFMAG1
Expected value for e_ident[EI_MAG1]
@ ELFMAG0
Expected value for e_ident[EI_MAG0]
@ ELFMAG3
Expected value for e_ident[EI_MAG3]
@ ELFMAG2
Expected value for e_ident[EI_MAG2]
@ SHN_XINDEX
Indicates that the actual index is too large to fit and is stored elsewhere.
@ SHN_UNDEF
Undefined section.
@ ELFCLASS64
64-bit objects, we always expect this value
@ ELFDATALSB
Little-endian encoding, we always expect this value.
@ EV_CURRENT
Current version, we always expect this value.
@ EI_MAG1
Index of magic number byte 1.
@ EI_DATA
Index of the data encoding byte.
@ EI_MAG0
Index of magic number byte 0.
@ EI_MAG3
Index of magic number byte 3.
@ EI_CLASS
Index of the file class byte.
@ EI_OSABI
Index of the OS/ABI identification byte.
@ EI_VERSION
Index of the file version byte.
@ EI_MAG2
Index of magic number byte 2.
@ PT_PHDR
Location and size of program header table.
@ PT_INTERP
Program interpreter path name.
@ PT_LOAD
Loadable segment.
@ ELFOSABI_NONE
No extensions or unspecified.
@ ELFOSABI_GNU
GNU, we always expect this value.
@ SHT_RELA
Contains relocation entries with explicit addends.
@ SHT_STRTAB
Contains a string table.
@ SHT_REL
Contains relocation entries without explicit addends.
@ SHT_SYMTAB
Contains a symbol table, only 1 per file.
@ SHT_NOBITS
Acts like SHT_PROGBITS but does not occupy any space in the file.
@ SHT_DYNSYM
Acts like SHT_SYMTAB but holds a minimal set of dynamic linking symbols, only 1 per file.
#define NULL
Pointer error value.
__UINTPTR_TYPE__ uintptr_t
Elf64_Half e_shentsize
Size in bytes of one entry in the files section header table.
Elf64_Word e_version
Object file version.
Elf64_Off e_shoff
Section header table's file offset in bytes, or 0 if there are no section headers.
Elf64_Half e_phentsize
Size in bytes of one entry in the files program header table.
unsigned char e_ident[EI_NIDENT]
Identification bytes.
Elf64_Off e_phoff
Program header tables's file offset in bytes, or 0 if there are no program headers.
Elf64_Half e_phnum
Number of entries in the program header table.
ELF File Helper structure.
uint64_t size
The size of the file in bytes.
Elf64_Shdr * dynsym
The dynamic symbol table section, or NULL if not found.
Elf64_Ehdr * header
The data in the file, pointed to the start of the ELF header.
Elf64_Shdr * symtab
The symbol table section, or NULL if not found.
Elf64_Xword p_memsz
Size of segment in memory in bytes.
Elf64_Off p_offset
Segment file offset in bytes.
Elf64_Word p_type
Segment type.
Elf64_Xword p_filesz
Size of segment in file in bytes.
ELF64 Rel Entry without addend.
ELF64 Rela Entry with addend.
Elf64_Word sh_name
Index of the section name in the string table.
Elf64_Word sh_type
Section type.
Elf64_Word sh_info
Depends on section type.
Elf64_Xword sh_size
Section size in bytes.
Elf64_Off sh_offset
Section's file offset in bytes.
ELF64 Symbol Table Entry.