[PATCH] fake pre-processor macros when building on non-FreeBSD system

Robert Millan rmh at debian.org
Tue Jul 12 22:33:02 UTC 2011


2011/7/12 Nathan Whitehorn <nwhitehorn at freebsd.org>:
> On 07/12/11 16:06, Robert Millan wrote:
>> Why would one need to build a cross-compiler in order to compile
>> userland-agnostic code for the same CPU architecture?  This would be
>> like requiring a cross-compiler in order to build things like GRUB or
>> SeaBIOS.
>
> For one, it might have a different ABI, which isn't actually that different
> an issue than the one you find yourself facing.

ABI can mean many things in this context.  It could mean libc ABI, it
could mean internal kernel interfaces, or even C calling conventions.

When it comes to libc and syscall ABI, it doesn't really matter which
one we provide, because -nostdinc -nostdlib completely discards it, as
the kernel doesn't use any libc headers or link with libc in any way.

When it comes to internal kernel interfaces, a few of them can be
selected in the FreeBSD kernel tree: the FreeBSD one, the NetBSD one,
the OpenBSD one, even the Linux interface. However, only one of them
(FreeBSD interface) is implemented. If you select e.g. NetBSD
interface you get build errors such as "sys/device.h not found".
Those errors happen because the NetBSD interface was selected for
building the kernel of FreeBSD, NOT because we're building on FreeBSD.
They would happen all the same if we attempted this on any other
platform, including NetBSD.

-- 
Robert Millan


More information about the freebsd-hackers mailing list