binutils default script
Posted: Sat Mar 08, 2014 5:05 pm
Hello.
I have recently built a cross-compiler from Llinux to my OS, with the canonical name i686-pc-glider.
It produces executables for my OS almost perfectly. The loading address is as it should be (0x00601000). However, there are 2 program headers, and the second one seems to not be aligned properly:
The problem is, it sais in the "align" column that the alignment is 0x1000, however, VirtAddr is 0x00603138, which is not aligned on a page boundary - if that's not the case, then how am I supposed to map the pages with the right flags etc? Or am I just misunderstanding the ELF specification? Is it that VirtAddr-Offset is the actual start of the page?? I'm confused.
If I am actually loading the executable correctly, but the linker is produceing broken executables, how do I modify the source code of ld to make sure that the second program header's VirtAddr is aligned on a page boundary?
Thank you.
I have recently built a cross-compiler from Llinux to my OS, with the canonical name i686-pc-glider.
It produces executables for my OS almost perfectly. The loading address is as it should be (0x00601000). However, there are 2 program headers, and the second one seems to not be aligned properly:
Code: Select all
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x00601000 0x00601000 0x01138 0x01138 R E 0x1000
LOAD 0x001138 0x00603138 0x00603138 0x00018 0x0003c RW 0x1000
If I am actually loading the executable correctly, but the linker is produceing broken executables, how do I modify the source code of ld to make sure that the second program header's VirtAddr is aligned on a page boundary?
Thank you.