[klibc] -fno-strict-overflow in klibc?

H. Peter Anvin hpa at zytor.com
Wed May 26 14:24:23 PDT 2010


On 05/26/2010 01:02 PM, Mike Waychison wrote:
> Sam Ravnborg wrote:
>> On Wed, May 26, 2010 at 11:57:31AM -0700, Mike Waychison wrote:
>>> Toying around with new compilers and old kernels, we noticed that the  
>>> upstream kernel over that last year or so added -fno-strict-overflow to  
>>> CFLAGS so that newer compilers would allow overflow detection on pointer  
>>> arithmetic (and integer arithmetic) to continue working.
>>>
>>> Should we be setting this flag for klibc as well?
>>
>> Obvious question.
>> How many new warnings does it trigger now?
>>
>> If zero then yes.
>> If one or more then no until they are fixed, or at least most are fixed.
> 
> Well, I'm not 100% certain we should expect warnings.   For instance, 
> compiling older kernels that didn't have this option set in CFLAGS 
> resulted in code getting eliminated as 'dead code' without a warning 
> emitted.
> 

I think -fno-strict-overflow for the kernel is because it has pointers
both in positive and negative space on architectures (like x86-64) where
that normally would be impossible.  This is not applicable to klibc,
which is, of course, all userspace.  However, -fwrapv (a slightly weaker
version, which only applies to integers) is probably justified.

	-hpa



More information about the klibc mailing list