|
|
Log in / Subscribe / Register

Signed overflow optimization hazards in the kernel

Signed overflow optimization hazards in the kernel

Posted Aug 16, 2012 7:25 UTC (Thu) by hobocken (guest, #85839)
Parent article: Signed overflow optimization hazards in the kernel

»Fortunately for the Linux kernel, GCC will generate the subtraction and comparison for -O1 or less. But optimizations can migrate to lower optimization levels over time, and there may come a time when either performance or energy-efficiency considerations motivate the Linux kernel to move to higher optimization levels. If that happens, what can be done?«

I don't understand the paragraph above. The kernel is already compiled
with -O2 or -Os.
From the top level Makefile:

ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os
else
KBUILD_CFLAGS += -O2
endif


to post comments

Signed overflow optimization hazards in the kernel

Posted Aug 16, 2012 9:02 UTC (Thu) by ken (subscriber, #625) [Link] (3 responses)

Exactly I noticed that to. It's been -O2 as far as I can remember.

Signed overflow optimization hazards in the kernel

Posted Aug 16, 2012 13:19 UTC (Thu) by PaulMcKenney (✭ supporter ✭, #9624) [Link] (2 responses)

And you are absolutely right: -O2 and no sign of -fwrapv. Perhaps this is more urgent than I was thinking...

Signed overflow optimization hazards in the kernel

Posted Aug 16, 2012 13:58 UTC (Thu) by abatters (✭ supporter ✭, #6932) [Link] (1 responses)

http://marc.info/?t=124806309500001&r=1&w=2

The kernel currently uses -fno-strict-overflow because -fwrapv was buggy in some versions of gcc. Unfortunately -fno-strict-overflow is also buggy in some other versions of gcc. Depending on the version of gcc I compile with, I have to patch the makefile to use one or the other.

Signed overflow optimization hazards in the kernel

Posted Aug 16, 2012 22:49 UTC (Thu) by PaulMcKenney (✭ supporter ✭, #9624) [Link]

Whew! It goes back to being non-urgent. ;-)


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds