Im using GCC and getting an error linking,
here are the source files -Originally Posted by ld.exe
loader.s (asm)
kernel.cppCode:global loader ; making entry point visible to linker extern kmain ; kmain is defined in kernel.o ; setting up the Multiboot header MODULEALIGN equ 1<<0 ; align loaded modules on page boundaries MEMINFO equ 1<<1 ; provide memory map FLAGS equ MODULEALIGN | MEMINFO ; this is the Multiboot 'flag' field MAGIC equ 0x1BADB002 ; 'magic number' lets bootloader find the header CHECKSUM equ -(MAGIC + FLAGS) ; checksum required section .text align 4 MultiBootHeader: dd MAGIC dd FLAGS dd CHECKSUM ; reserve initial kernel stack space STACKSIZE equ 0x4000 ; that's 16k. loader: mov esp, stack+STACKSIZE ; set up the stack push eax ; pass Multiboot magic number push ebx ; pass Multiboot info structure call kmain ; call kernel proper hlt ; halt machine should kernel return section .bss align 32 stack: resb STACKSIZE ; reserve 16k stack on a quadword boundary
my linker fileCode:void kmain(void* mbd, unsigned int magic){ // this is to stop compiler warnigns durign development mbd; magic; }
and my link sequenceCode:ENTRY (loader) SECTIONS{ . = 0x00100000; .text :{ *(.text) } .rodata ALIGN (0x1000) : { *(.rodata) } .data ALIGN (0x1000) : { *(.data) } .bss : { sbss = .; *(COMMON) *(.bss) ebss = .; } }
Code:nasm -f elf -o loader.o loader.s gcc -o kernel.o -c kernel.cpp -Wall -Wextra -Werror -nostdlib -nostartfiles -nodefaultlibs ld -T linker.ld -o kernel.bin kernel.o loader.o



LinkBack URL
About LinkBacks



