The linker script that I use for my kernel is
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(start)
SECTIONS
{
.text 0x1000 :
{
*(.text)
}
.data :
{
*(.data)
}
.bss :
{
*(.bss)
}
end = .; _end = .; __end = .;
}
Then I can use the address of the end-variable in my C-code to determine where the kernel ends. However, my kernel has a size of 0x1570 bytes. It's loaded into memory at address 0x1000. Hence, the end variable should have the address 0x2570, right? But it hasn't, the value of end, when I print it, is 0x31D8. Now I dont like when things don't add up, so what is the problem? If I put the end-variable before the .bss section instead, it seems correct, the address of end is 0x2570.