Loading an ELF file, padding at the end of the .text section
Posted: Thu Aug 18, 2011 5:40 pm
According to page 2-8 of the ELF specification, there's supposed to be padding at the end of the text section and beginning of the data section. From what I understand, the memory after the end of .text but before the next page is supposed to be filled with a copy of the first bit of .data, and the memory from that page break to the start of .data is filled with the last bit of .text. E.g., if .text ends at 0x00401234, memory 0x00401235-0x00402000 is filled with the first 3532 bytes of .data. Then, if .data starts at 0x00402345, 0x00402000-0x00402345 is filled with the last 857 bytes of the text section. Correct?
If that is correct, what should happen if the .data section were to start right at a page break, such as 0x00402000? Should there be data padding at the end of the text section, and no text padding before the data section?
Here's the specification I'm looking at, in there are others with different page numbers: http://www.skyfree.org/linux/references/ELF_Format.pdf.
Thanks in advance,
Luns
If that is correct, what should happen if the .data section were to start right at a page break, such as 0x00402000? Should there be data padding at the end of the text section, and no text padding before the data section?
Here's the specification I'm looking at, in there are others with different page numbers: http://www.skyfree.org/linux/references/ELF_Format.pdf.
Thanks in advance,
Luns