Microsoft compilers output files organized like so:
Headers Code Section (the headers designate this section as Execute+Read) Function 0 Instructions Optional: NOP or INT3 padding Optional: Case mapping table (and optional padding to the next pointer-sized boundary) Optional: Case block pointers (and optional padding to the next 16 byte boundary) Function 1 Instructions ...ETC... Initialized Data Section(s) (the headers designate these section(s) as Read+Write or just Read) Data! Import Section (readonly after the loader finishes with it) Data! Export Section (readonly after the loader finishes with it) Data! Relocation Section (discarded after the loader finishes with it) Data! Resource Section (readonly) Data! (etc...)Other compilers (or binary compressors such as UPX) are free to rearrange anything besides the main header that they want to.