From 4b01191368b064f8d5f652ced719fec84fac3fac Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 10 Jun 2011 09:39:33 +0200 Subject: [PATCH] patch for perf with gcc-4.6 --- kernel-2.6.spec | 4 +- linux-2.6-10004-gcc-4.6-perf.patch | 65 ++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 linux-2.6-10004-gcc-4.6-perf.patch diff --git a/kernel-2.6.spec b/kernel-2.6.spec index d4165926c..9ae44f4d5 100644 --- a/kernel-2.6.spec +++ b/kernel-2.6.spec @@ -685,7 +685,8 @@ Patch20: linux-2.6-680-htb-hysteresis-tso.patch Patch10000: linux-2.6-10000-gcc-4.5.patch Patch10001: linux-2.6-10001-gcc-4.6-warnoff.patch Patch10002: linux-2.6-10002-gcc-4.6-sense_buffer.patch -Patch11000: linux-2.6-10003-gcc-4.6-vdso.patch +Patch10003: linux-2.6-10003-gcc-4.6-vdso.patch +Patch10004: linux-2.6-10004-gcc-4.6-perf.patch # empty final patch file to facilitate testing of kernel patches Patch999999: linux-kernel-test.patch @@ -1002,6 +1003,7 @@ ApplyPatch linux-2.6-10000-gcc-4.5.patch ApplyPatch linux-2.6-10001-gcc-4.6-warnoff.patch ApplyPatch linux-2.6-10002-gcc-4.6-sense_buffer.patch ApplyPatch linux-2.6-10003-gcc-4.6-vdso.patch +ApplyPatch linux-2.6-10004-gcc-4.6-perf.patch #### Planet-Lab #### ApplyOptionalPatch linux-kernel-test.patch diff --git a/linux-2.6-10004-gcc-4.6-perf.patch b/linux-2.6-10004-gcc-4.6-perf.patch new file mode 100644 index 000000000..2a0d8be52 --- /dev/null +++ b/linux-2.6-10004-gcc-4.6-perf.patch @@ -0,0 +1,65 @@ +From Darren Hart <> +Subject [PATCH] perf: fix gcc4.6 build failure with unused-but-set warning +Date Thu, 2 Jun 2011 13:47:48 -0700 +I ran into the following build failure with gcc 4.6: + + bench/sched-pipe.c: In function 'bench_sched_pipe': + bench/sched-pipe.c:58:6: error: variable 'ret' set but not used + [-Werror=unused-but-set-variable] + cc1: all warnings being treated as errors + +As the main kernel Makefile has added -Wno-unused-but-set-variable +and sched-pipe.c claims: + + /* + * why does "ret" exist? + * discarding returned value of read(), write() + * causes error in building environment for perf + */ +This patch creates a new perf/Makefile variable, LESS_WARNINGS and +adds -Wno-unused-but-set-variable. The new variable helps distinguish +between the added warnings in EXTRA_WARNINGS versus those we want to +remove, including the existing -Wno-system-headers which I moved to +LESS_WARNINGS. + +Signed-off-by: Darren Hart +Cc: Ingo Molnar +Cc: Bruce Ashfield +--- + tools/perf/Makefile | 10 ++++++++-- + 1 files changed, 8 insertions(+), 2 deletions(-) +diff --git a/tools/perf/Makefile b/tools/perf/Makefile +index 032ba63..fdb35dc 100644 +--- a/tools/perf/Makefile ++++ b/tools/perf/Makefile +@@ -74,7 +74,6 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls + EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3 + EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default + EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum +-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers + EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef + EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings + EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast +@@ -85,6 +84,13 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition + EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes + EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement + ++# ++# Disable warnings that cause build problems or needlessly polute output: ++# ++ ++LESS_WARNINGS := -Wno-system-headers ++LESS_WARNINGS := $(LESS_WARNINGS) -Wno-unused-but-set-variable ++ + ifeq ("$(origin DEBUG)", "command line") + PERF_DEBUG = $(DEBUG) + endif +@@ -92,7 +98,7 @@ ifndef PERF_DEBUG + CFLAGS_OPTIMIZE = -O6 + endif + +-CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) ++CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(LESS_WARNINGS) $(EXTRA_CFLAGS) + EXTLIBS = -lpthread -lrt -lelf -lm + ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 + ALL_LDFLAGS = $(LDFLAGS) -- 2.43.0