From 68515dfcb9fda1e008c2e30d294bdd65ba9a6253 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 19 Jan 2016 22:03:05 +0000 Subject: [PATCH] linux-perf: Fix FTBFS with gcc 6 (used on hppa, sparc64) --- debian/changelog | 6 ++ ...f-add-missing-braces-to-if-statement.patch | 30 ++++++++ ...ingly-indented-assignment-whitespace.patch | 26 +++++++ ...remove-wrong-semicolon-in-while-loop.patch | 26 +++++++ ...nused-variables-x86_-32-64-_regoffse.patch | 75 +++++++++++++++++++ debian/patches/series | 4 + 6 files changed, 167 insertions(+) create mode 100644 debian/patches/perf-add-missing-braces-to-if-statement.patch create mode 100644 debian/patches/perf-fix-misleadingly-indented-assignment-whitespace.patch create mode 100644 debian/patches/perf-remove-wrong-semicolon-in-while-loop.patch create mode 100644 debian/patches/perf-tools-fix-unused-variables-x86_-32-64-_regoffse.patch diff --git a/debian/changelog b/debian/changelog index 009da019f..b375ed2cd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +linux-tools (4.4-1~exp2) experimental; urgency=medium + + * linux-perf: Fix FTBFS with gcc 6 (used on hppa, sparc64) + + -- Ben Hutchings Tue, 19 Jan 2016 22:11:13 +0000 + linux-tools (4.4-1~exp1) experimental; urgency=medium * New upstream release diff --git a/debian/patches/perf-add-missing-braces-to-if-statement.patch b/debian/patches/perf-add-missing-braces-to-if-statement.patch new file mode 100644 index 000000000..e56236650 --- /dev/null +++ b/debian/patches/perf-add-missing-braces-to-if-statement.patch @@ -0,0 +1,30 @@ +From: Markus Trippelsdorf +Subject: Add missing braces to if statement +Date: Mon, 14 Dec 2015 16:44:03 +0100 +Origin: http://article.gmane.org/gmane.linux.kernel/2108038 + +Add missing braces to if statement. + +The issue was pointed out by gcc-6's -Wmisleading-indentation. + +Acked-by: Ingo Molnar +Signed-off-by: Markus Trippelsdorf +--- +diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c +index d4d7cc27252f..718bd46d47fa 100644 +--- a/tools/perf/ui/browsers/annotate.c ++++ b/tools/perf/ui/browsers/annotate.c +@@ -755,11 +755,11 @@ static int annotate_browser__run(struct annotate_browser *browser, + nd = browser->curr_hot; + break; + case K_UNTAB: +- if (nd != NULL) ++ if (nd != NULL) { + nd = rb_next(nd); + if (nd == NULL) + nd = rb_first(&browser->entries); +- else ++ } else + nd = browser->curr_hot; + break; + case K_F1: diff --git a/debian/patches/perf-fix-misleadingly-indented-assignment-whitespace.patch b/debian/patches/perf-fix-misleadingly-indented-assignment-whitespace.patch new file mode 100644 index 000000000..a9bf0895f --- /dev/null +++ b/debian/patches/perf-fix-misleadingly-indented-assignment-whitespace.patch @@ -0,0 +1,26 @@ +From: Markus Trippelsdorf +Subject: Fix misleadingly indented assignment (whitespace) +Date: Mon, 14 Dec 2015 16:44:40 +0100 +Origin: http://article.gmane.org/gmane.linux.kernel/2108042 + +Fix misleadingly indented assignment. +This is just a simple whitespace fix. + +The issue was pointed out by gcc-6's -Wmisleading-indentation. + +Acked-by: Ingo Molnar +Signed-off-by: Markus Trippelsdorf +--- +diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c +index e4b173dec4b9..c900b664ab8f 100644 +--- a/tools/perf/util/pmu.c ++++ b/tools/perf/util/pmu.c +@@ -153,7 +153,7 @@ static int perf_pmu__parse_unit(struct perf_pmu_alias *alias, char *dir, char *n + if (fd == -1) + return -1; + +- sret = read(fd, alias->unit, UNIT_MAX_LEN); ++ sret = read(fd, alias->unit, UNIT_MAX_LEN); + if (sret < 0) + goto error; + diff --git a/debian/patches/perf-remove-wrong-semicolon-in-while-loop.patch b/debian/patches/perf-remove-wrong-semicolon-in-while-loop.patch new file mode 100644 index 000000000..9a8c03722 --- /dev/null +++ b/debian/patches/perf-remove-wrong-semicolon-in-while-loop.patch @@ -0,0 +1,26 @@ +From: Markus Trippelsdorf +Subject: Remove wrong semicolon in while loop +Date: Mon, 14 Dec 2015 16:43:35 +0100 +Origin: http://article.gmane.org/gmane.linux.kernel/2108037 + +The while loop was spinning. Fix by removing a semicolon. + +The issue was pointed out by gcc-6's -Wmisleading-indentation. + +Reviewed-by: Matt Fleming +Acked-by: Ingo Molnar +Signed-off-by: Markus Trippelsdorf +--- +diff --git a/tools/perf/arch/x86/tests/intel-cqm.c b/tools/perf/arch/x86/tests/intel-cqm.c +index d28c1b6a3b54..fa5d17af88b7 100644 +--- a/tools/perf/arch/x86/tests/intel-cqm.c ++++ b/tools/perf/arch/x86/tests/intel-cqm.c +@@ -17,7 +17,7 @@ static pid_t spawn(void) + if (pid) + return pid; + +- while(1); ++ while(1) + sleep(5); + return 0; + } diff --git a/debian/patches/perf-tools-fix-unused-variables-x86_-32-64-_regoffse.patch b/debian/patches/perf-tools-fix-unused-variables-x86_-32-64-_regoffse.patch new file mode 100644 index 000000000..96141eefb --- /dev/null +++ b/debian/patches/perf-tools-fix-unused-variables-x86_-32-64-_regoffse.patch @@ -0,0 +1,75 @@ +From: Ben Hutchings +Date: Tue, 19 Jan 2016 21:12:41 +0000 +Subject: perf tools: Fix unused variables: x86_{32,64}_regoffset_table +Forwarded: http://mid.gmane.org/20160119213306.GE2637@decadent.org.uk + +gcc 5 doesn't seem to care about these, but gcc 6 does and that +results in a build failure. + +Fixes: bbbe6bf6037d ("perf tools: Introduce regs_query_register_offset() ...") +Signed-off-by: Ben Hutchings +--- + tools/perf/arch/x86/util/dwarf-regs.c | 38 ++++++++++++++++------------------- + 1 file changed, 17 insertions(+), 21 deletions(-) + +diff --git a/tools/perf/arch/x86/util/dwarf-regs.c b/tools/perf/arch/x86/util/dwarf-regs.c +index 9223c16..fe1e516 100644 +--- a/tools/perf/arch/x86/util/dwarf-regs.c ++++ b/tools/perf/arch/x86/util/dwarf-regs.c +@@ -55,26 +55,10 @@ struct pt_regs_offset { + + #define REG_OFFSET_END {.name = NULL, .offset = 0} + ++/* TODO: switching by dwarf address size */ + #ifdef __x86_64__ +-# define REG_OFFSET_NAME_64(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)} +-# define REG_OFFSET_NAME_32(n, r) {.name = n, .offset = -1} +-#else +-# define REG_OFFSET_NAME_64(n, r) {.name = n, .offset = -1} +-# define REG_OFFSET_NAME_32(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)} +-#endif +- +-static const struct pt_regs_offset x86_32_regoffset_table[] = { +- REG_OFFSET_NAME_32("%ax", eax), +- REG_OFFSET_NAME_32("%cx", ecx), +- REG_OFFSET_NAME_32("%dx", edx), +- REG_OFFSET_NAME_32("%bx", ebx), +- REG_OFFSET_NAME_32("$stack", esp), /* Stack address instead of %sp */ +- REG_OFFSET_NAME_32("%bp", ebp), +- REG_OFFSET_NAME_32("%si", esi), +- REG_OFFSET_NAME_32("%di", edi), +- REG_OFFSET_END, +-}; + ++#define REG_OFFSET_NAME_64(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)} + static const struct pt_regs_offset x86_64_regoffset_table[] = { + REG_OFFSET_NAME_64("%ax", rax), + REG_OFFSET_NAME_64("%dx", rdx), +@@ -94,12 +78,24 @@ static const struct pt_regs_offset x86_64_regoffset_table[] = { + REG_OFFSET_NAME_64("%r15", r15), + REG_OFFSET_END, + }; +- +-/* TODO: switching by dwarf address size */ +-#ifdef __x86_64__ + #define regoffset_table x86_64_regoffset_table ++ + #else ++ ++#define REG_OFFSET_NAME_32(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)} ++static const struct pt_regs_offset x86_32_regoffset_table[] = { ++ REG_OFFSET_NAME_32("%ax", eax), ++ REG_OFFSET_NAME_32("%cx", ecx), ++ REG_OFFSET_NAME_32("%dx", edx), ++ REG_OFFSET_NAME_32("%bx", ebx), ++ REG_OFFSET_NAME_32("$stack", esp), /* Stack address instead of %sp */ ++ REG_OFFSET_NAME_32("%bp", ebp), ++ REG_OFFSET_NAME_32("%si", esi), ++ REG_OFFSET_NAME_32("%di", edi), ++ REG_OFFSET_END, ++}; + #define regoffset_table x86_32_regoffset_table ++ + #endif + + /* Minus 1 for the ending REG_OFFSET_END */ diff --git a/debian/patches/series b/debian/patches/series index d2ab6e491..004a5caba 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -16,3 +16,7 @@ revert-perf-build-fix-libunwind-feature-detection-on.patch alpha-uapi-add-support-for-__sane_userspace_types__.patch nvme-stop-installing-kernel-only-linux-nvme.h-as-uap.patch perf-tools-fix-reading-of-build-id-from-vdso.patch +perf-fix-misleadingly-indented-assignment-whitespace.patch +perf-add-missing-braces-to-if-statement.patch +perf-tools-fix-unused-variables-x86_-32-64-_regoffse.patch +perf-remove-wrong-semicolon-in-while-loop.patch