Subject: Re: exit() undefined in bootloader build
To: Gary Thorpe <gat7634@hotmail.com>
From: Andrew Brown <atatat@atatdot.net>
List: tech-kern
Date: 06/01/2002 23:14:18
>2. main() must return int in ansi compliant code for hosted environments.
the kernel isn't "hosted". it *is* the host.
>3. Hosted/self-hosted cannot be determined at compile time (unless gcc has a
>flag for this), so 2 must always be true (the compiler must assume the
>program is hosted).
kernels are built with -ffreestanding on the 1.6 branch and in
-current. the gcc man page says:
-ffreestanding
Compile for a freestanding environment; this im-
plies the `-fno-builtin' option, and implies that
main has no special requirements.
which sounds like the flag you are looking for.
>4. Since self-hosted code will probably never return (but calling exit()
>makes it return!), this technicality may not matter anyway.
i *suppose* the kernel could return, but that would be to the boot
blocks, whose only response might...reboot? "never test for an error
condition you're not prepared to handle."
--
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org * "ah! i see you have the internet
twofsonet@graffiti.com (Andrew Brown) that goes *ping*!"
andrew@crossbar.com * "information is power -- share the wealth."