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?
brans kernel development tutorial
Re: brans kernel development tutorial
Try:
Sometimes GCC puts underscores, sometimes it doesn't. It depends on compiler settings.
Code: Select all
extern main
call main
If something looks overcomplicated, most likely it is.
- Combuster
- 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
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
Something I've wondered though: Are leading underscores compiler, platform or object format specific?
-
- Member
- Posts: 368
- Joined: Sun Sep 23, 2007 4:52 am
Re: brans kernel development tutorial
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).