Languages/C/Sections

From UIT
Revision as of 10:39, 20 November 2013 by Pim (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Program sections, or what are .text, .data, .bss?

When a program is compiled, the compiler splits the resulting code into different sections (sometimes called segments). Every section corresponds to a particular use, for instance storing variables or executable code.

This document is mainly focused on the ELF (Executable and Linkable Format) file format used by Linux and the gcc<code> toolchain, but most of this document is valid for most executable file formats.

Universal sections

Section Description
.text Executable (machine) code
.data Initialized data
.bss Data initialized to zero
Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox