!6 Fix build with gcc-10

From: @angela7
Reviewed-by: @small_leek,@small_leek
Signed-off-by: @small_leek,@small_leek
This commit is contained in:
openeuler-ci-bot 2021-07-30 07:47:17 +00:00 committed by Gitee
commit b923268cbe
2 changed files with 94 additions and 1 deletions

View File

@ -0,0 +1,89 @@
From 0ea3f5c42ffad95ef55c8b269649a1135e5d02f9 Mon Sep 17 00:00:00 2001
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date: Fri, 17 Apr 2020 21:39:14 +0100
Subject: [PATCH] trace-cmd: Fix build with gcc-10
The build fails while building with gcc-10 with the error:
multiple definition of `common_type_field'
Rename the field in trace-hist.c and trace-mem.c to satisfy gcc-10.
Link: http://lore.kernel.org/linux-trace-devel/20200417203914.26358-1-sudipm.mukherjee@gmail.com
Bug-Link: https://bugs.debian.org/957879
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
trace-hist.c | 8 ++++----
trace-mem.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/trace-hist.c b/trace-hist.c
index 2a2e780..42cf154 100644
--- a/trace-hist.c
+++ b/trace-hist.c
@@ -41,7 +41,7 @@ static int kernel_stack_type;
static int long_size;
-struct format_field *common_type_field;
+struct format_field *common_type_hist;
struct format_field *common_pid_field;
struct format_field *sched_wakeup_comm_field;
struct format_field *sched_wakeup_new_comm_field;
@@ -582,7 +582,7 @@ process_record(struct pevent *pevent, struct pevent_record *record)
unsigned long long val;
int type;
- pevent_read_number_field(common_type_field, record->data, &val);
+ pevent_read_number_field(common_type_hist, record->data, &val);
type = val;
if (type == function_type)
@@ -970,8 +970,8 @@ static void do_trace_hist(struct tracecmd_input *handle)
long_size = tracecmd_long_size(handle);
- common_type_field = pevent_find_common_field(event, "common_type");
- if (!common_type_field)
+ common_type_hist = pevent_find_common_field(event, "common_type");
+ if (!common_type_hist)
die("Can't find a 'type' field?");
common_pid_field = pevent_find_common_field(event, "common_pid");
diff --git a/trace-mem.c b/trace-mem.c
index a949b15..30f39ef 100644
--- a/trace-mem.c
+++ b/trace-mem.c
@@ -44,7 +44,7 @@ static int kmem_cache_alloc_type;
static int kmem_cache_alloc_node_type;
static int kmem_cache_free_type;
-struct format_field *common_type_field;
+struct format_field *common_type_mem;
struct format_field *kmalloc_callsite_field;
struct format_field *kmalloc_bytes_req_field;
@@ -383,7 +383,7 @@ process_record(struct pevent *pevent, struct pevent_record *record)
unsigned long long val;
int type;
- pevent_read_number_field(common_type_field, record->data, &val);
+ pevent_read_number_field(common_type_mem, record->data, &val);
type = val;
if (type == kmalloc_type)
@@ -504,8 +504,8 @@ static void do_trace_mem(struct tracecmd_input *handle)
ret = pevent_data_type(pevent, record);
event = pevent_data_event_from_type(pevent, ret);
- common_type_field = pevent_find_common_field(event, "common_type");
- if (!common_type_field)
+ common_type_mem = pevent_find_common_field(event, "common_type");
+ if (!common_type_mem)
die("Can't find a 'type' field?");
update_kmalloc(pevent);
--
1.8.3.1

View File

@ -1,6 +1,6 @@
Name: trace-cmd
Version: 2.7
Release: 5
Release: 6
Summary: A front-end for Ftrace
License: GPLv2 and LGPLv2
URL: http://git.kernel.org/?p=linux/kernel/git/rostedt/trace-cmd.git;a=summary
@ -8,6 +8,7 @@ Source0: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/tra
Source1: kernelshark.desktop
Patch1: 0001-trace-cmd-Figure-out-the-arch-and-install-library-to.patch
Patch2: 0002-trace-cmd-Fix-the-logic-behind-SWIG_DEFINED-in-the-M.patch
Patch3: 0001-trace-cmd-Fix-build-with-gcc-10.patch
BuildRequires: gcc xmlto asciidoc mlocate libxml2-devel
BuildRequires: gtk2-devel glib2-devel desktop-file-utils
Provides: kernelshark
@ -74,6 +75,9 @@ desktop-file-validate $RPM_BUILD_ROOT/%{_datadir}/applications/kernelshark.deskt
%{_mandir}/man5/*
%changelog
* Fri July 30 2021 Guoxiaoqi <guoxiaoqi2@huawei.com> - 2.7-6
- Fix build with gcc-10
* Wed Oct 28 2020 Anan Fu <fuanan3@huawei.com> - 2.7-5
- disable python2