Bootloader functional; problem linking C kernel
Posted: Mon Mar 10, 2003 8:57 pm
OK,
I've gotten to the stage where I've loaded my kernel off the floppy drive. When the kernel was in assembler, it worked fine; now I'm trying to get C working. I'm in protected mode and the stack is set up and everything. Protected mode code works in assembly, selectors work. I created the custom linker script as recommended.
The problem is when I try to link my kernel to an assembly stub that will jump into the main kernel
function. It says that it has an unresolved symbol:
_GLOBAL_OFFSET_TABLE_
LD then dies. I'm calling LD like this:
ld -T kernel.lnk stub.o kernel.o -o kernel.bin
in nasm, I'm just creating the image by:
%include 'boot.asm'
incbin 'kernel.bin'
Then dding it out to the floppy
I've tried faking that symbol, to no avail. Can someone tell me what the problem is? Please don't tell me to use a.out or coff, I'm writing the OS in BeOS, in which LD only supports elf. I believe I'm using gcc version 2.9.2
I've gotten to the stage where I've loaded my kernel off the floppy drive. When the kernel was in assembler, it worked fine; now I'm trying to get C working. I'm in protected mode and the stack is set up and everything. Protected mode code works in assembly, selectors work. I created the custom linker script as recommended.
The problem is when I try to link my kernel to an assembly stub that will jump into the main kernel
function. It says that it has an unresolved symbol:
_GLOBAL_OFFSET_TABLE_
LD then dies. I'm calling LD like this:
ld -T kernel.lnk stub.o kernel.o -o kernel.bin
in nasm, I'm just creating the image by:
%include 'boot.asm'
incbin 'kernel.bin'
Then dding it out to the floppy
I've tried faking that symbol, to no avail. Can someone tell me what the problem is? Please don't tell me to use a.out or coff, I'm writing the OS in BeOS, in which LD only supports elf. I believe I'm using gcc version 2.9.2