An object file segment comprises one or more sections, though this fact is transparent to the program header. Whether the file segment holds one or many sections also is immaterial to program loading. Nonetheless, various data must be present for program execution, dynamic linking, and so on. ``Text segment'' illustrates segment contents in general terms. The order and membership of sections within a segment may vary; moreover, processor-specific constraints may alter the examples below.
Text segments contain read-only instructions and data, typically including the following sections described earlier in this chapter. Other sections may also reside in loadable segments; these examples are not meant to give complete and exclusive segment contents.
Data segments contain writable data and instructions, typically including the following sections.
A PT_DYNAMIC program header element points at the
for more information. The
.plt sections also hold information related to
position-independent code and dynamic linking. Although
.plt appears in a text segment in the
previous table, it may reside in a text or a data segment,
depending on the processor.
As described in
in the first part of
this chapter, the
.bss section has the type
SHT_NOBITS. Although it occupies no space in the
file, it contributes to the segment's memory image.
Normally, these uninitialized data reside at the end of the
segment, thereby making
p_memsz larger than
p_filesz in the associated program header