rpms/kernel/F-9 add-fwrapv-to-cflags.patch, NONE, 1.1.2.1 kernel.spec, 1.891.2.39, 1.891.2.40

Kyle McMartin kyle at fedoraproject.org
Fri Mar 20 17:04:29 UTC 2009


Author: kyle

Update of /cvs/pkgs/rpms/kernel/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12855

Modified Files:
      Tag: private-fedora-9-2_6_27-branch
	kernel.spec 
Added Files:
      Tag: private-fedora-9-2_6_27-branch
	add-fwrapv-to-cflags.patch 
Log Message:
* Fri Mar 20 2009 Kyle McMartin <kyle at redhat.com> 2.6.27.20-78.2.40
- add-fwrapv-to-cflags.patch: avoid gcc optimizing away wrapping arithmetic.


add-fwrapv-to-cflags.patch:

--- NEW FILE add-fwrapv-to-cflags.patch ---
Add '-fwrapv' to gcc CFLAGS

This makes sure that gcc doesn't try to optimize away wrapping
arithmetic, which the kernel occasionally uses for overflow testing, ie
things like

    if (ptr + offset < ptr)

which technically is undefined for non-unsigned types. See

    http://bugzilla.kernel.org/show_bug.cgi?id=12597

for details.

Not all versions of gcc support it, so we need to make it conditional
(it looks like it was introduced in gcc-3.4).

Reminded-by: Alan Cox <alan at lxorguk.ukuu.org.uk>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>

--- linux-2.6.27.noarch.orig/Makefile
+++ linux-2.6.27.noarch/Makefile
@@ -555,6 +555,9 @@ KBUILD_CFLAGS += $(call cc-option,-Wdecl
 # disable pointer signed / unsigned warnings in gcc 4.0
 KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 
+# disable invalid "can't wrap" optimzations for signed / pointers
+KBUILD_CFLAGS += $(call cc-option,-fwrapv)
+
 # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
 # But warn user when we do so
 warn-assign = \


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/kernel.spec,v
retrieving revision 1.891.2.39
retrieving revision 1.891.2.40
diff -u -r1.891.2.39 -r1.891.2.40
--- kernel.spec	19 Mar 2009 01:42:24 -0000	1.891.2.39
+++ kernel.spec	20 Mar 2009 17:03:57 -0000	1.891.2.40
@@ -756,6 +756,8 @@
 # Add better support for DMI-based autoloading
 Patch3110: linux-2.6-dmi-autoload.patch
 
+Patch3200: add-fwrapv-to-cflags.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1353,6 +1355,8 @@
 # get rid of imacfb and make efifb work everywhere it was used
 ApplyPatch linux-2.6-merge-efifb-imacfb.patch
 
+ApplyPatch add-fwrapv-to-cflags.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -1956,6 +1960,9 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Fri Mar 20 2009 Kyle McMartin <kyle at redhat.com> 2.6.27.20-78.2.40
+- add-fwrapv-to-cflags.patch: avoid gcc optimizing away wrapping arithmetic.
+
 * Wed Mar 18 2009 Chuck Ebbert <cebbert at redhat.com>  2.6.27.20-78.2.39
 - ALSA fixes headed for -stable:
     linux-2.6.27-alsa-fix-vunmap-and-free-order.patch




More information about the fedora-extras-commits mailing list