PE File Sections
The sections of a PE contain the actual data needed to make the file executable.
In contrast, the headers contain metadata about the PE file as well as the different sections. In the PE file format, the sections follow the headers and occupy the rest of the file.
Each section of a PE file has its own header (Section Header) that is stored in the Section Table. Sections often have names that give an indication of their purpose.
Common sections include:
- .text: The .text section contains the executable code of the PE.
- .data: Initialized data, i.e. the variables that get initialized in the code.
- .rdata: Read-only initialized data. Constant variables (prefixed with
const
) live here. - .idata: The import tables. Used by the Loader to determine which DLL files to load, as well as the functions being used from each DLL.
- .reloc: Contains the image relocation information needed to load the program into memory without errors.
- .rsrc: Contains resources used by the program. These include images, icons, bitmaps, or embedded binaries.
Table of PE File Sections
The following table shows the reserved sections of
Section | Description |
---|---|
.bss | Uninitialized data |
.cormeta | Indicates that the file contains managed code (object only) |
.data | Initialized data |
.debug$F | FPO debug information (object only and obsolete) |
.debug$P | Precompiled debug types (object only) |
.debug$S | Debug symbols (object only) |
.debug$T | Debug types (object only) |
.drective | Linker options |
.edata | Export tables |
.idata | Import tables |
.idlsym | Includes registered SEH to support IDL attributes (image only) |
.pdata | Exception information |
.rdata | Read-only initialized data |
.reloc | Image relocation information |
.rsrc | Resource directory |
.sbss | GP-relative uninitialized data |
.sdata | GP-relative initialized data |
.srdata | GP-relative read-only data |
.sxdata | Registered exception handler data (x86/object only) |
.text | Executable code |
.tls | Thread-local storage (object only) |
.tls$ | Thread-local storage (object only) |
.vsdata | GP-relative initialized data (for ARM, SH4, and Thumb architectures only) |
.xdata | Exception information |