Page 1 of 1

brans kernel development tutorial

Posted: Fri Oct 17, 2008 10:28 am
by sweetgum
I'm on this page over here. http://osdever.net/bkerndev/Docs/printing.htm
and my issue is that when I try to link
ld -T link.ld -o kernel.bin start.o main.o scrn.o

i get the error message undefined reference to '_main'

the error exists from adding "extern _main" just under "stublet:"

anyone have any advice?

Re: brans kernel development tutorial

Posted: Fri Oct 17, 2008 11:00 am
by Velko
Try:

Code: Select all

extern main
call main
Sometimes GCC puts underscores, sometimes it doesn't. It depends on compiler settings.

Re: brans kernel development tutorial

Posted: Fri Oct 17, 2008 3:53 pm
by Combuster
Leading underscores are dated. If you have to use them in 9 out of 10 cases you'd better get a more suited compiler to avoid several other issues. As far as I've seen, Linux' gcc doesn't use them, and neither does a crosscompiler.

Re: brans kernel development tutorial

Posted: Fri Oct 17, 2008 5:15 pm
by CodeCat
Something I've wondered though: Are leading underscores compiler, platform or object format specific?

Re: brans kernel development tutorial

Posted: Sat Oct 18, 2008 6:19 am
by Craze Frog
Neither. They are ABI specific. Usually that means platform specific, but not always. And since different compilers might support different ABIs, that means it could be compiler specific, but the compiler writer always followed some ABI specification (or created his own).