Source: /cirosantilli/elf-hello-world/section-vs-segment

= Section vs segment

We will get into more detail later, but it is good to have it in mind now:

* section: exists before linking, in object files.

  One ore more sections will be put inside a single segment by the linker.

  Major information sections contain for the linker: is this section:
  * raw data to be loaded into memory, e.g. `.data`, `.text`, etc.
  * or metadata about other sections, that will be used by the linker, but disappear at runtime e.g. `.symtab`, `.srttab`, `.rela.text`
* segment: exists after linking, in the executable file.

  Contains information about how each segment should be loaded into memory by the OS, notably location and permissions.

See also:
* https://stackoverflow.com/questions/14361248/whats-the-difference-of-section-and-segment-in-elf-file-format
* https://stackoverflow.com/questions/23379880/difference-between-program-header-and-section-header-in-elf