brans kernel development tutorial

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
sweetgum
Member
Member
Posts: 37
Joined: Thu Sep 18, 2008 11:17 pm

brans kernel development tutorial

Post 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?
User avatar
Velko
Member
Member
Posts: 153
Joined: Fri Oct 03, 2008 4:13 am
Location: Ogre, Latvia, EU

Re: brans kernel development tutorial

Post by Velko »

Try:

Code: Select all

extern main
call main
Sometimes GCC puts underscores, sometimes it doesn't. It depends on compiler settings.
If something looks overcomplicated, most likely it is.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: brans kernel development tutorial

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
CodeCat
Member
Member
Posts: 158
Joined: Tue Sep 23, 2008 1:45 pm
Location: Eindhoven, Netherlands

Re: brans kernel development tutorial

Post by CodeCat »

Something I've wondered though: Are leading underscores compiler, platform or object format specific?
Craze Frog
Member
Member
Posts: 368
Joined: Sun Sep 23, 2007 4:52 am

Re: brans kernel development tutorial

Post 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).
Post Reply