ELF program headers
ELF program headers are what describe segments within a binary and are necessary for program loading. Segments are understood by the kernel during load time and describe the memory layout of an executable on disk and how it should translate to memory. The program header table can be accessed by referencing the offset found in the initial ELF header member called e_phoff
(program header table offset), as shown in the ElfN_Ehdr
structure in display 1.7
.
There are five common program header types that we will discuss here. Program headers describe the segments of an executable file (shared libraries included) and what type of segment it is (that is, what type of data or code it is reserved for). First, let's take a look at the Elf32_Phdr
structure that makes up a program header entry in the program header table of a 32-bit ELF executable.
Note
We sometimes refer to program headers as Phdrs throughout the rest of this book.
Here's the Elf32_Phdr
struct:
typedef struct { uint32_t...