Executable and Linkable Format (ELF)

Author: Unknown. Link to original: http://www.skyfree.org/linux/references/ELF_Format.pdf (English).
Tags: ELF, File Format, Linux, Unix Submitted by VlKhomenko 20.08.2012. Public material.

Translations of this material:

into Russian: Исполнимый и линкуемый формат (ELF). 0% translated in draft.
Submitted for translation by VlKhomenko 20.08.2012

Text

Contents

Preface

1 OBJECT FILES

2 PROGRAM LOADING AND DYNAMIC LINKING

3 C LIBRARY

I Index

Introduction

ELF Header

Sections

String Table

Symbol Table

Relocation

Introduction

Program Header

Program Loading

Dynamic Linking

C Library

Index

ELF: Executable and Linkable Format

Figures and Tables

Figure 1-1: Object File Format

Figure 1-2: 32-Bit Data Types

Figure 1-3: ELF Header

Figure 1-4: e_ident[ ] Identification Indexes

Figure 1-5: Data Encoding ELFDATA2LSB

Figure 1-6: Data Encoding ELFDATA2MSB

Figure 1-7: 32-bit Intel Architecture Identification, e_ident

Figure 1-8: Special Section Indexes

Figure 1-9: Section Header

Figure 1-10: Section Types, sh_type

Figure 1-11: Section Header Table Entry: Index 0

Figure 1-12: Section Attribute Flags, sh_flags

Figure 1-13: sh_link and sh_info Interpretation

Figure 1-14: Special Sections

Figure 1-15: String Table Indexes

Figure 1-16: Symbol Table Entry

Figure 1-17: Symbol Binding, ELF32_ST_BIND

Figure 1-18: Symbol Types, ELF32_ST_TYPE

Figure 1-19: Symbol Table Entry: Index 0

Figure 1-20: Relocation Entries

Figure 1-21: Relocatable Fields

Figure 1-22: Relocation Types

Figure 2-1: Program Header

Figure 2-2: Segment Types, p_type

Figure 2-3: Note Information

Figure 2-4: Example Note Segment

Figure 2-5: Executable File

Figure 2-6: Program Header Segments

Figure 2-7: Process Image Segments

Figure 2-8: Example Shared Object Segment Addresses

Figure 2-9: Dynamic Structure

Figure 2-10: Dynamic Array Tags, d_tag

Figure 2-11: Global Offset Table

Figure 2-12: Absolute Procedure Linkage Table

Figure 2-13: Position-Independent Procedure Linkage Table

Figure 2-14: Symbol Hash Table

Figure 2-15: Hashing Function

Figure 3-1: libc Contents, Names without Synonyms

Figure 3-2: libc Contents, Names with Synonyms

Elf32_Half e_shstrndx;

Encoding ELFDATA2MSB specifies 2’s complement values, with the most significant byte occupying the

Name

.symtab This section holds a symbol table, as ‘‘Symbol Table’’ in this section describes. If the file

 No name

NOTE

character.

When building an executable file that uses dynamic linking, the link editor adds a program header ele-

cutable or shared object file, the link editor catenates those sections to form a single

x otherwise.

section attributes 1: 12

Elf32_Half

lowest address.

Value

has a loadable segment that includes the symbol table, the section’s attributes will include

st_name 

There are naming conventions for ELF constants that have specified processor ranges. Names such as

ment of type PT_INTERP to an executable file, telling the system to invoke the dynamic linker as the pro-

table. Although the sections remain independent in the object file, the dynamic linker

int _xftw(int, char *, int (*)(char *, struct stat *, int), int);

section header 1: 2, 8

} Elf32_Ehdr;

Figure 1-6: Data Encoding ELFDATA2MSB

Note

the SHF_ALLOC bit; otherwise, that bit will be off.

0

DT_, PT_, for processor-specific extensions, incorporate the name of the processor:

gram interpreter.

sees a single table. When the dynamic linker creates the process image for an execut-

Calls to the ftw(BA_LIB) function are mapped to this function when applications are com-

section names 1: 15

e_ident The initial bytes mark the file as an object file and provide machine-independent data

Pages: ← previous Ctrl next