c and asm
Posted: Sat Nov 14, 2009 11:42 am
I've been writing my OS in asm but since I've been working with c/c++ for 4 years I wanted to try using asm and c together. When I compile my c program it compiles fine and so does my asm program but when I go to link them with the .ld file I get a couple of errors.
c.c
asm.asm
linker.ld
I've tried all of the tutorials on the wiki but none of them worked.
when I try to link them, I get:
ld: warning: cannot find entry symbol loader; defaulting to 00000000
c\asm.o: In function `loader':
c\asm.asm:(.text+0xd): undefined reference to `_kmain'
c.c
Code: Select all
extern void _kmain();
void _kmain()
{
}
Code: Select all
global loader
extern _kmain
loader:
mov ah, 00
mov al, 12h
int 10h
call _kmain
end:
jmp $
times 510 - ($ - $$) db 0
dw 0xAA55
Code: Select all
ENTRY (loader)
when I try to link them, I get:
ld: warning: cannot find entry symbol loader; defaulting to 00000000
c\asm.o: In function `loader':
c\asm.asm:(.text+0xd): undefined reference to `_kmain'