Subject: Re: `-ffreestanding'
To: matthew green <mrg@eterna.com.au>
From: Richard Earnshaw <rearnsha@arm.com>
List: tech-kern
Date: 07/16/2001 11:15:56
> 
>    > i'm going to add this flag to LKM building, as well as the kernels for
>    > ports i can test.  it disables internal `printf' prototype mismatch,
>    > as well as `main' warnings that -Wno-main does not get rid of.
>    > 
>    
>    Sadly this will also disable all builtin functions (in particular things 
>    like builtin memcpy) unless we take steps to prevent this by adding 
>    -fbuiltin *after* -ffreestanding.
> 
> 
> unfortunately, we *don't* want the builtin `printf' because it's wrong.
> these builtins should really have their own -fswitches each.  :-(

Printf isn't a builtin (at least, not in that sense).  So adding -fbuiltin 
will not re-enable the format warning checker.


Another alternative is to have a header file (say k-builtin.h) which 
#defines the things we want builtin to their __builtin_foo equivalents.  
This would then provide the functionality we require.

Eg

#define memcpy(x,y,z) __builtin_memcpy(x,y,z)

R.