[2.6 patch] Use -ffreestanding?

From: Adrian Bunk
Date: Tue Nov 09 2004 - 20:49:40 EST


On Tue, Nov 09, 2004 at 06:01:07AM +0100, Andi Kleen wrote:
> > Why doesn't the kernel use -ffreestanding which should prevent all such
> > problems?
>
> Because we want most of these optimizations. Also with -ffreestanding

Do we really want the compiler to silently replace in-kernel functions
with built-ins?

You can still do an explicit
#define strlen __builtin_strlen
if you want to use a gcc built-in function.

> you would need to supply the out of line string functions anyways
> because gcc wouldn't inline them.

At least with gcc 3.4.2 on i386 adding -ffreestanding and your
(i386-specific) IN_STRING_C hack removed compiles fine.

> -Andi


I'm open for examples why this actually doesn't work, but after my
(limited) testin I'd suggest the patch below for inclusion in the next
-mm.


Signed-off-by: Adrian Bunk <bunk@xxxxxxxxx>

--- linux-2.6.10-rc1-mm4-full-ffreestanding/Makefile.old 2004-11-09 22:27:06.000000000 +0100
+++ linux-2.6.10-rc1-mm4-full-ffreestanding/Makefile 2004-11-09 22:27:47.000000000 +0100
@@ -349,7 +349,8 @@
CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)

CFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs \
- -fno-strict-aliasing -fno-common
+ -fno-strict-aliasing -fno-common \
+ -ffreestanding
AFLAGS := -D__ASSEMBLY__

export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION LOCALVERSION KERNELRELEASE \



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/