Date: Sat, 15 Jun 2002 19:35:52 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Maxime Henrion <mux@FreeBSD.ORG> Cc: current@FreeBSD.ORG Subject: Re: duplicate -ffreestanding in kernel build Message-ID: <20020615191003.I747-100000@gamplex.bde.org> In-Reply-To: <20020614155452.GM85244@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 14 Jun 2002, Maxime Henrion wrote: > I recently noticed that we are adding the -ffreestanding flag twice for > kernel builds. It's added once if GCC3 is defined in > /usr/share/mk/bsd.kern.mk and another time inconditionally in > /sys/conf/kern.pre.mk. As a result, I have -ffreestanding once on my > x86 box still running with GCC 2.95 and I have it twice on my sparc box > running GCC 3. This is a bug in bsd.kern.mk. -ffreestanding never belonged there, since it is also needed for modules and perhaps for boot programs and libstand. Module makefiles still include <bsd.kern.mk>, but Makefiles for boot programs have regressed. Your x86 box must be out of date. x86 has gcc-3 and adds -ffreestanding unconditionally, so -ffreestanding is added twice for all arches. I have been using the following fix since this bug was committed. %%% Index: kern.pre.mk =================================================================== RCS file: /home/ncvs/src/sys/conf/kern.pre.mk,v retrieving revision 1.12 diff -u -2 -r1.12 kern.pre.mk --- kern.pre.mk 12 May 2002 15:51:38 -0000 1.12 +++ kern.pre.mk 13 May 2002 06:12:03 -0000 @@ -39,5 +36,10 @@ .endif -COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -ffreestanding -include opt_global.h +# XXX _KERNEL is bogusly placed. It should be in bsd.kern.mk so that it +# affects both kernels and modules. Perhaps many more things should be +# there. +COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -include opt_global.h +# XXX aargh, no -fno-common is bogusly placed placed too. It is not even +# in COPTs like all other options. CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} -fno-common %%% > One of these should be removed, but I'm not sure which > one yet. Keeping it in kern.pre.mk has the advantage that it will work > even if someone is using a staled bsd.kern.mk. bsd.kern.mk is misplaced. It should be in sys/conf and renamed to not emphasize "kern". It still needs to be separate from kern.pre.mk to keep general "sys" things separe from pure kernel things. > Also, I wonder if it > should be conditional on GCC3 being defined since we were adding it > inconditionally there. We "fixed" this. -fformat-extension is now broken (turned off) unconditionally. I have been using the following fix since the need for this bug went away: %%% Index: bsd.kern.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.kern.mk,v retrieving revision 1.26 diff -u -2 -r1.26 bsd.kern.mk --- bsd.kern.mk 24 May 2002 01:02:45 -0000 1.26 +++ bsd.kern.mk 24 May 2002 15:01:28 -0000 @@ -7,9 +7,7 @@ # most of the remaining warnings. Warnings introduced with -Wall will # also pop up, but are easier to fix. -# -# XXX FIXME - revert to -fformat-extensions when we've re-added it CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \ - -Wno-format -ansi + -fformat-extensions -ansi # # The following flags are next up for working on: %%% Anyway, it was a mistake to use -ffreestanding for gcc-3. It was equally applicable to all versions of gcc that support it. gcc-2 just happened not to need it. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020615191003.I747-100000>