Subject: upgrade to -current
To: Jaromir Dolecek <dolecek@ics.muni.cz>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: current-users
Date: 03/24/1997 00:05:00
On Mon, 24 Mar 1997 08:40:16 +0100 (MET),
Jaromir Dolecek <dolecek@ics.muni.cz> writes:

>Please what I need to succesfully build new -current kernel on 1.2
>environment ? I have downloaded & installed new make, config,
>/usr/share/mk/* But the compilation bombs on fact gcc's printf
>doesn't know anything about %:, %b; these are used in 1.2 kernel's
>source and 1.2 kernel compiles w/o problems .. Is there anything
>I'm missing ? Please point me to right place ...

wThe simple alternative is to make sure that __KPRINTF_ATTRIBUTE__ is
not defined, and to turn off all gcc warnings when compiling kernels.
That should stop gcc from checking, and complaining about, the kernel
printf format strings you mention.  

Otherwise: I think you need to get the gcc source that's in the NetBSD
tree, compile it, and use that cc (or gcc) to compile a kernel.

A normal gcc with -Wall ``knows'' what printf() formats look like, and
complains when it sees the nonstandard kernel printf() format strings.
NetBSD adds some extra _kprintf_ attributes that tell GCC to check
against the NetBSD kernel printf().

NetBSD's gcc defines __KPRINTF_ATTRIBUTE__ and has attribute
extensions that tell netbsd's GCC what the netBSD kernel printf()
arguments are. Compiling with __KPRINTF_ATTRIBUTE__ turned on enables
those attributes in <sys/cdefs.h> and <sys/param.h>  Those cause
gcc to check  printf() arguments against the kernel printf() format
strings, not the ANSI C printf() format strings.

Without those checks, and with -Wall, a default kernel configuration
is not going to compile.

I've never tried building NetBSD kernels with gcc 2.7.2.1 or 2.7.2.2;
but the gcc in the NetBSD builds such kernels just fine.  If you've
correctly applied gcc2netbsd, that suggests maybe the gcc2netbsd
script is out of date and isn't fixing up the attributes that support
kernel printf() warnings?

Perhaps someone who's using stock gcc in a cross-compilation environment
to build kernels could comment further?