COP 3402 meeting -*- Outline -*- * Executable Files ** Sections of Executable Files ------------------------------------------ SECTIONS OF EXECUTABLE FILES (header: info about each section) Text Section: Data Section: Relocation Section: (debugging sections: symbol table section: global labels debugging section: file + line info ------------------------------------------ ... executable instructions (binary format) ... data in binary format ... identifies locations needing adjustment when program is moved in memory See https://refspecs.linuxfoundation.org/elf/elf.pdf for details ------------------------------------------ EXECUTABLE ELF FILE LAYOUT |------------------------| [ General info ] (header [ Program name ] section) [ Start address of text ] [ Length of text section ] [ Start address of data ] [ Length of data section ] [ Start address of reloc.] [ Length of reloc. sect. ] |------------------------| | | | | | Text Section | | | | | |------------------------| | | | | | Data Section | | | | | |------------------------| | | | | | Relocation Section | | | | | |------------------------| ------------------------------------------ (The above is somewhat simplified from reality) ** Relocation ------------------------------------------ RELOCATION OF EXECUTABLE FILES Assemblers generate code assuming starting address is 0 Relocation data identifies parts of instructions that need offset added if the starting address is changed to 0 + offset ------------------------------------------