I
Executable and Linkable Format (ELF)
Contents
Preface
1
OBJECT FILES
Introduction 1-1
ELF Header 1-3
Sections 1-8
String Table 1-16
Symbol Table 1-17
Relocation 1-21
2
PROGRAM LOADING AND DYNAMIC LINKING
Introduction 2-1
Program Header 2-2
Program Loading 2-7
Dynamic Linking 2-10
3
C LIBRARY
C Library 3-1
I
Index
Index I-1
Tool Interface Standards (TIS) Portable Formats Specification, Version 1.1 i
ELF: Executable and Linkable Format
ii Portable Formats Specification, Version 1.1 Tool Interface Standards (TIS)
Figures and Tables
Figure 1-1: Object File Format 1-1
Figure 1-2: 32-Bit Data Types 1-2
Figure 1-3: ELF Header 1-3
Figure 1-4: e _ i d e n t [ ] Identification Indexes 1-5
Figure 1-5: Data Encoding E L F D A T A 2 L S B 1-6
Figure 1-6: Data Encoding E L F D A T A 2 M S B 1-6
Figure 1-7: 32-bit Intel Architecture Identification, e _ i d e n t 1-7
Figure 1-8: Special Section Indexes 1-8
Figure 1-9: Section Header 1-9
Figure 1-10: Section Types, s h _ t y p e 1-10
Figure 1-11: Section Header Table Entry: Index 0 1-11
Figure 1-12: Section Attribute Flags, s h _ f l a g s 1-12
Figure 1-13: s h _ l i n k and s h _ i n f o Interpretation 1-13
Figure 1-14: Special Sections 1-13
Figure 1-15: String Table Indexes 1-16
Figure 1-16: Symbol Table Entry 1-17
Figure 1-17: Symbol Binding, E L F 3 2 _ S T _ B I N D 1-18
Figure 1-18: Symbol Types, E L F 3 2 _ S T _ T Y P E 1-19
Figure 1-19: Symbol Table Entry: Index 0 1-20
Figure 1-20: Relocation Entries 1-21
Figure 1-21: Relocatable Fields 1-22
Figure 1-22: Relocation Types 1-23
Figure 2-1: Program Header 2-2
Figure 2-2: Segment Types, p _ t y p e 2-3
Figure 2-3: Note Information 2-4
Figure 2-4: Example Note Segment 2-5
Figure 2-5: Executable File 2-7
Figure 2-6: Program Header Segments 2-7
Figure 2-7: Process Image Segments 2-8
Figure 2-8: Example Shared Object Segment Addresses 2-9
Figure 2-9: Dynamic Structure 2-12
Figure 2-10: Dynamic Array Tags, d _ t a g 2-12
Figure 2-11: Global Offset Table 2-17
Figure 2-12: Absolute Procedure Linkage Table 2-17
Figure 2-13: Position-Independent Procedure Linkage Table 2-18
Figure 2-14: Symbol Hash Table 2-19
Figure 2-15: Hashing Function 2-20
Figure 3-1: l i b c Contents, Names without Synonyms 3-1
Figure 3-2: l i b c Contents, Names with Synonyms 3-1
Figure 3-3: l i b c Contents, Global External Data Symbols 3-2
Tool Interface Standards (TIS) Portable Formats Specification, Version 1.1 iii
Preface
ELF: Executable and Linking Format
The Executable and Linking Format was originally developed and published by UNIX System Labora-
tories (USL) as part of the Application Binary Interface (ABI). The Tool Interface Standards committee
(TIS) has selected the evolving ELF standard as a portable object file format that works on 32-bit Intel
Architecture environments for a variety of operating systems.
The ELF standard is intended to streamline software development by providing developers with a set of
binary interface definitions that extend across multiple operating environments. This should reduce the
number of different interface implementations, thereby reducing the need for recoding and recompiling
code.
About This Document
This document is intended for developers who are creating object or executable files on various 32-bit
environment operating systems. It is divided into the following three parts:
Part 1, ‘‘Object Files’’ describes the ELF object file format for the three main types of object files.
Part 2, ‘‘Program Loading and Dynamic Linking’’ describes the object file information and system
actions that create running programs.
Part 3, ‘‘C Library’’ lists the symbols contained in l i b s y s, the standard ANSI C and l i b c routines,
and the global data symbols required by the l i b c routines.
NOTE
References to X86 architecture have been changed to Intel Architecture.
Tool Interface Standards (TIS) Portable Formats Specification, Version 1.1 1