[Solved] Linking problems
Posted: Sat Jun 17, 2017 8:45 am
I am trying to implement a kernel heap, and in doing so I have noticed that something seems 'messed up' with my linking. Here is my link.ld:
The issue is that when I print the values of code, data, bss and end in my kernel they don't match. According to my kernel:
To me end seems abnormally high and they don't seem aligned even though I align them in the linker script
I am using grub-mkrescue to make an ISO file which I am running with QEMU, so maybe that is causing some trouble. My ld command is:
ld -T link.ld -m elf_i386 -o kernel/kernel.elf boot/grubboot.o ${OBJC} ${OBJA}
Any thoughts?
Code: Select all
ENTRY(start)
SECTIONS
{
. = 0x100000;
.text :
{
code = .; _code = .; __code = .;
*(.text)
. = ALIGN(4096);
}
.data :
{
data = .; _data = .; __data = .;
*(.data)
*(.rodata)
. = ALIGN(4096);
}
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .; _end = .; __end = .;
}
Code: Select all
code: 0x1badboo2
data: 0x00105ca0
bss: 0x00000000
end: 0x3a434347
I am using grub-mkrescue to make an ISO file which I am running with QEMU, so maybe that is causing some trouble. My ld command is:
ld -T link.ld -m elf_i386 -o kernel/kernel.elf boot/grubboot.o ${OBJC} ${OBJA}
Any thoughts?