Loading an ELF-executable
Posted: Thu Nov 07, 2013 11:01 am
Hello,
I have implemented a simple 2-stage bootloader. My second stage bootloader is loaded at 0x500 and loads an executable ELF-file from there. This worked fine at the start, but now my kernel got bigger and I've reached the point where it overwrites my stage 2 bootloader (the code that is loading the ELF-file). When I inspect the elf binary with readelf -S, I can see the sections:
For clarity's sake: the problem is the .symtab, as it wants to be loaded at 0x0 to 0x5c0 (while my bootloader is at 0x500), but the sections .strtab, .symtab and .shstrtab are all potential problems, as they might grow into the memory > 0x500 that I need for my second stage bootloader.
The behaviour of my second stage bootloader is correct. However, I was convinced the linker should only allocate sections in the memory > 1MB. I've grabbed the linker script from here(without really understanding it in the first place, so maybe this will finally teach me that those things always backfire ).
How can I make sure the .strtab, .symtab and .shstrtab sections aren't loaded to the memory where my bootloader is?
I have implemented a simple 2-stage bootloader. My second stage bootloader is loaded at 0x500 and loads an executable ELF-file from there. This worked fine at the start, but now my kernel got bigger and I've reached the point where it overwrites my stage 2 bootloader (the code that is loading the ELF-file). When I inspect the elf binary with readelf -S, I can see the sections:
For clarity's sake: the problem is the .symtab, as it wants to be loaded at 0x0 to 0x5c0 (while my bootloader is at 0x500), but the sections .strtab, .symtab and .shstrtab are all potential problems, as they might grow into the memory > 0x500 that I need for my second stage bootloader.
The behaviour of my second stage bootloader is correct. However, I was convinced the linker should only allocate sections in the memory > 1MB. I've grabbed the linker script from here(without really understanding it in the first place, so maybe this will finally teach me that those things always backfire ).
How can I make sure the .strtab, .symtab and .shstrtab sections aren't loaded to the memory where my bootloader is?