rpms/kernel/F-10 add-fwrapv-to-cflags.patch, NONE, 1.1.2.1 kernel.spec, 1.1206.2.54, 1.1206.2.55

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


Author: kyle

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

Modified Files:
      Tag: private-fedora-10-2_6_27
	kernel.spec 
Added Files:
      Tag: private-fedora-10-2_6_27
	add-fwrapv-to-cflags.patch 
Log Message:
* Fri Mar 20 2009 Kyle McMartin <kyle at redhat.com> 2.6.27.20-170.2.55
- 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-10/kernel.spec,v
retrieving revision 1.1206.2.54
retrieving revision 1.1206.2.55
diff -u -r1.1206.2.54 -r1.1206.2.55
--- kernel.spec	19 Mar 2009 03:44:50 -0000	1.1206.2.54
+++ kernel.spec	20 Mar 2009 17:04:08 -0000	1.1206.2.55
@@ -781,6 +781,8 @@
 # Fix up the v4l2 video_open function
 Patch3140: linux-2.6.27-fix-video_open.patch
 
+Patch3200: add-fwrapv-to-cflags.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1408,6 +1410,8 @@
 
 ApplyPatch linux-2.6.27-fix-video_open.patch
 
+ApplyPatch add-fwrapv-to-cflags.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -1983,6 +1987,9 @@
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Fri Mar 20 2009 Kyle McMartin <kyle at redhat.com> 2.6.27.20-170.2.55
+- 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-170.2.54
 - Add Dell Vostro to i8042 nomux quirk list (#490250)
 




More information about the fedora-extras-commits mailing list