Chapter 9. elf32: Executable and Linkable Format 32-bit Object Files

Table of Contents

9.1. Debugging Format Support
9.2. ELF Sections
9.3. ELF Directives
9.3.1. IDENT: Add file identification
9.3.2. SIZE: Set symbol size
9.3.3. TYPE: Set symbol type
9.3.4. WEAK: Create weak symbol
9.4. ELF Extensions to the GLOBAL Directive
9.5. ELF Extensions to the COMMON Directive
9.6. elf32 Special Symbols and WRT

The Executable and Linkable Object Format is the primary object format for many operating systems including FreeBSD or GNU/Linux. It appears in three forms:

Yasm only directly supports relocatable object files. Other tools, such as the GNU Linker ld, help turn relocatable object files into the other formats. Yasm supports generation of both 32-bit and 64-bit ELF files, called elf32 and elf64. An additional format, called elfx32, is a 32-bit ELF file that supports 64-bit execution (instructions and registers) while limiting pointer sizes to 32-bit.

Yasm defaults to BITS 32 mode when outputting to the elf32 object format.

9.1. Debugging Format Support

ELF supports two debugging formats: stabs (see Chapter 20) and dwarf2 (see Chapter 19). Different debuggers understand these different formats; the newer debug format is dwarf2, so try that first.