6.2.1. ELF headers

ELF header

The ELF Header contains information about the ELF file. For example, it identifies the file as an ELF file, states the hardware architecture the ELF file is built for (for example, EM_ARM, which stands for "ELF Machine: ARM"), and gives the locations of the section and program header tables.

Program header

The program header table contains entries for one or more program headers. Program headers describe a continuous range of bytes in the ELF file. The program header includes information on the segment type, properties, and address information.

A program header does not just describe executable code or data. That is true only for a program header of type PT_LOAD. Also, not every section in the image has an associated program header. An image loader or operating system normally reads the program header to locate the required information to prepare an ELF file for execution.

An important type of program header for dynamic linking has a type PT_DYNAMIC, that describes the location of the dynamic section.

Section header

The section header table is a table that describes each of the sections in the ELF file. Each section in the ELF file has an entry in the section header table. A section header table entry contains the section name, section type, flags (for example, read/write), execution address, file offset, and other information.

For ELF images, the section header table is optional. A dynamic loader that works directly on ELF files should not rely on information derived from section headers. As an example the dynamic linker can locate the dynamic section by using the PT_DYNAMIC program header, or by looking for the dynamic section in the section header table. The former works if the section header table is removed, the latter does not.

Copyright © 2010 ARM. All rights reserved.ARM DAI 0242A