Multiboot or elf header error
Posted: Sat Oct 19, 2013 6:22 pm
I like to figure stuff out on my own usually, but this is a simple issue that has me stumped. I am using a multiboot load sequence booting an elf module. Testing is done on both bochs through grub and "-kernel" through qemu. Multiboot header is setup as straightforward as possible, flags are 0x03, bytes 12-32 are 0(meaning it is definitely reading section info from elf file). When my assembly contains only 2 sections (code + bss), everything works great. I guess I have no way to confirm that it is recognizing the bss section correctly, but the code section is definitely loaded at the correct address and the appropriate entry point is called. The issue I am now having is by tying to add another section to be loaded.
readelf -S says:
[ 0] <no-name> PROGBITS 00100000 001000 001000 00 AX 0 0 0
[ 1] <no-name> PROGBITS 00101000 002000 00000c 00 A 0 0 0
[ 2] <no-name> NOBITS 00102000 00200c 00086c 00 WA 0 0 0
I can confirm through bochs and qemu that 0x101000 - 0x10100b does not contain the data from 0x2000-0x200b in the file. The file is exactly 0x200c in size. Am I missing something in the multiboot spec where it only supports a single elf section? Missing something from ELF spec? Do I have my header setup incorrectly? I am suspect of the linker, since that is what I am currently developing and testing! The headers look fine from everything I can tell. If it matters, this is on x86 in protected mode. If anyone has an idea of where I should be looking, it would be much appreciated, thanks!
readelf -S says:
[ 0] <no-name> PROGBITS 00100000 001000 001000 00 AX 0 0 0
[ 1] <no-name> PROGBITS 00101000 002000 00000c 00 A 0 0 0
[ 2] <no-name> NOBITS 00102000 00200c 00086c 00 WA 0 0 0
I can confirm through bochs and qemu that 0x101000 - 0x10100b does not contain the data from 0x2000-0x200b in the file. The file is exactly 0x200c in size. Am I missing something in the multiboot spec where it only supports a single elf section? Missing something from ELF spec? Do I have my header setup incorrectly? I am suspect of the linker, since that is what I am currently developing and testing! The headers look fine from everything I can tell. If it matters, this is on x86 in protected mode. If anyone has an idea of where I should be looking, it would be much appreciated, thanks!