Re: duplicate -ffreestanding in kernel build
On Sat, 15 Jun 2002, Terry Lambert wrote: Bruce Evans wrote: printf( const string); - pusts( const string); That is an incredibly *fugly* optimization. It assumes that I use libc, unless I have -ffreestanding, and it assumes my implementation of printf vs. puts. This is a routine optimization. It assumes that you use a C compiler (printf and even libc might not exist, since they might be builtins). A non-routine optimization might involve building hardware to run the application and emitting the 1 bit instruction to turn the hardware on. It's routine to assume that I'm going to use libc?!? No. It is routine to assume that users use a library that meets the compiler's requirements (the compiler gets to decide, not the users; it is only constrained by the relevant standards and historical (mal)practice). Bruce To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: duplicate -ffreestanding in kernel build
Bruce Evans wrote: It's routine to assume that I'm going to use libc?!? No. It is routine to assume that users use a library that meets the compiler's requirements (the compiler gets to decide, not the users; it is only constrained by the relevant standards and historical (mal)practice). Where is this crap, and how to turn it off, spelled out, other than the source code? I didn't see it in the .info; maybe I'm just looking in the wrong place? -- Terry To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: duplicate -ffreestanding in kernel build
Bruce Evans wrote: 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. What exactly does this do, besides implying -fno-builtin? The documentation says and implies main has no special requirements... Neither the kernel nor modules have a main, so the only thing that's relevent here is the -fno-builtin, right? -- Terry To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: duplicate -ffreestanding in kernel build
Terry Lambert wrote: What exactly does this do, besides implying -fno-builtin? The documentation says and implies main has no special requirements... Neither the kernel nor modules have a main, so the only thing that's relevent here is the -fno-builtin, right? IIRC, -ffreestanding prevented GCC3 from being stupid optimizations like changing occurences of printf(constant string\n) to puts(constant string), which failed for kernel builds since we don't have puts() in the kernel... Maxime To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: duplicate -ffreestanding in kernel build
Maxime Henrion wrote: Terry Lambert wrote: What exactly does this do, besides implying -fno-builtin? The documentation says and implies main has no special requirements... Neither the kernel nor modules have a main, so the only thing that's relevent here is the -fno-builtin, right? IIRC, -ffreestanding prevented GCC3 from being stupid optimizations like changing occurences of printf(constant string\n) to puts(constant string), which failed for kernel builds since we don't have puts() in the kernel... That is an incredibly *fugly* optimization. It assumes that I use libc, unless I have -ffreestanding, and it assumes my implementation of printf vs. puts. It sounds like -ffreestanding -fbuiltin should be the default for everything but the kernel, which should not have -fbuiltin... -- Terry To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: duplicate -ffreestanding in kernel build
On Sat, 15 Jun 2002 12:49:29 -0700, Maxime Henrion [EMAIL PROTECTED] said: IIRC, -ffreestanding prevented GCC3 from being stupid optimizations like `-ffreestanding' tells the compiler that it is to operate as a free-standing implementation (in the words of the C standard); i.e., that there is no Standard C Library, and the compiler may not assume that a function which has the same name as a Standard Library function has the same semantics. -GAWollman To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: duplicate -ffreestanding in kernel build
From: [EMAIL PROTECTED] (Terry Lambert) Date: Sat 15 Jun, 2002 Subject: Re: duplicate -ffreestanding in kernel build That is an incredibly *fugly* optimization. It assumes that I use libc, unless I have -ffreestanding, and it assumes my implementation of printf vs. puts. It means you can't futz with the implementation of the standard library in a standard way. :-) Cheers, Mark. -- Mark Valentine, Thuvia Labs [EMAIL PROTECTED] http://www.thuvia.co.uk Tigers will do ANYTHING for a tuna fish sandwich. Mark Valentine uses We're kind of stupid that way. *munch* *munch*and endorses FreeBSD -- http://www.calvinandhobbes.com http://www.freebsd.org To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: duplicate -ffreestanding in kernel build
On Sat, 15 Jun 2002, Terry Lambert wrote: Maxime Henrion wrote: Terry Lambert wrote: What exactly does this do, besides implying -fno-builtin? The documentation says and implies main has no special requirements... Neither the kernel nor modules have a main, so the only thing that's relevent here is the -fno-builtin, right? IIRC, -ffreestanding prevented GCC3 from being stupid optimizations like ^^ smart changing occurences of printf(constant string\n) to puts(constant string), which failed for kernel builds since we don't have puts() in the kernel... That is an incredibly *fugly* optimization. It assumes that I use libc, unless I have -ffreestanding, and it assumes my implementation of printf vs. puts. This is a routine optimization. It assumes that you use a C compiler (printf and even libc might not exist, since they might be builtins). A non-routine optimization might involve building hardware to run the application and emitting the 1 bit instruction to turn the hardware on. Bruce To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: duplicate -ffreestanding in kernel build
Bruce Evans wrote: printf( const string); - pusts( const string); That is an incredibly *fugly* optimization. It assumes that I use libc, unless I have -ffreestanding, and it assumes my implementation of printf vs. puts. This is a routine optimization. It assumes that you use a C compiler (printf and even libc might not exist, since they might be builtins). A non-routine optimization might involve building hardware to run the application and emitting the 1 bit instruction to turn the hardware on. It's routine to assume that I'm going to use libc?!? I understand the -fnobuiltins thing... particularly if the compiler generates code that makes a function call, instead of generating the code inline, and saving the call/return (kind of makes you want -fnobuiltins by default, though, since I'm smarter than the compiler writers is a common base assumption). I *really* don't understand them making assumptions about the instrumentation that I may or may not have put between myself and the libc implementations of functions, though. Historically, for code portability, I used to carry around my own printf(), and I didn't even have a puts(); this optimization would *really* break things. -- Terry To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: duplicate -ffreestanding in kernel build
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 - 1.12 +++ kern.pre.mk 13 May 2002 06:12:03 - @@ -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 - 1.26 +++ bsd.kern.mk 24 May 2002 15:01:28 - @@ -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 [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
duplicate -ffreestanding in kernel build
Hi all, 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. 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. Also, I wonder if it should be conditional on GCC3 being defined since we were adding it inconditionally there. Any thoughts? Thanks, Maxime To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message