summaryrefslogtreecommitdiffstats
path: root/patches/trace-cmd-v2.8.3/0001-trace-cmd-Fix-multiple-definition-compiler-errors.patch
blob: 9ff3f4424db4ef703b9610ebb36d70738ece3198 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Date: Mon, 10 Feb 2020 10:50:10 +0200
Subject: [PATCH] trace-cmd: Fix "multiple definition" compiler errors

When compiling with gcc and option "-fno-common", there are
errors because of multiple global variables with the same names.
The "-fno-common" gcc option is turned on by default on gcc 10, so
trace-cmd build fails on this compiler.

Proposed solution: set the variables to be static, as their scope is
only the current C file.

Link: http://lore.kernel.org/linux-trace-devel/20200210085010.7974-1-tz.stoyanov@gmail.com

Reported-by: Ziqian SUN (Zamir) <sztsian@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=206467
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tracecmd/trace-hist.c | 40 ++++++++++++++++++++--------------------
 tracecmd/trace-mem.c  | 38 +++++++++++++++++++-------------------
 2 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/tracecmd/trace-hist.c b/tracecmd/trace-hist.c
index 384a7ff09306..2e30d021c3f3 100644
--- a/tracecmd/trace-hist.c
+++ b/tracecmd/trace-hist.c
@@ -27,26 +27,26 @@ static int kernel_stack_type;
 
 static int long_size;
 
-struct tep_format_field *common_type_field;
-struct tep_format_field *common_pid_field;
-struct tep_format_field *sched_wakeup_comm_field;
-struct tep_format_field *sched_wakeup_new_comm_field;
-struct tep_format_field *sched_wakeup_pid_field;
-struct tep_format_field *sched_wakeup_new_pid_field;
-struct tep_format_field *sched_switch_prev_field;
-struct tep_format_field *sched_switch_next_field;
-struct tep_format_field *sched_switch_prev_pid_field;
-struct tep_format_field *sched_switch_next_pid_field;
-struct tep_format_field *function_ip_field;
-struct tep_format_field *function_parent_ip_field;
-struct tep_format_field *function_graph_entry_func_field;
-struct tep_format_field *function_graph_entry_depth_field;
-struct tep_format_field *function_graph_exit_func_field;
-struct tep_format_field *function_graph_exit_depth_field;
-struct tep_format_field *function_graph_exit_calltime_field;
-struct tep_format_field *function_graph_exit_rettime_field;
-struct tep_format_field *function_graph_exit_overrun_field;
-struct tep_format_field *kernel_stack_caller_field;
+static struct tep_format_field *common_type_field;
+static struct tep_format_field *common_pid_field;
+static struct tep_format_field *sched_wakeup_comm_field;
+static struct tep_format_field *sched_wakeup_new_comm_field;
+static struct tep_format_field *sched_wakeup_pid_field;
+static struct tep_format_field *sched_wakeup_new_pid_field;
+static struct tep_format_field *sched_switch_prev_field;
+static struct tep_format_field *sched_switch_next_field;
+static struct tep_format_field *sched_switch_prev_pid_field;
+static struct tep_format_field *sched_switch_next_pid_field;
+static struct tep_format_field *function_ip_field;
+static struct tep_format_field *function_parent_ip_field;
+static struct tep_format_field *function_graph_entry_func_field;
+static struct tep_format_field *function_graph_entry_depth_field;
+static struct tep_format_field *function_graph_exit_func_field;
+static struct tep_format_field *function_graph_exit_depth_field;
+static struct tep_format_field *function_graph_exit_calltime_field;
+static struct tep_format_field *function_graph_exit_rettime_field;
+static struct tep_format_field *function_graph_exit_overrun_field;
+static struct tep_format_field *kernel_stack_caller_field;
 
 static int compact;
 
diff --git a/tracecmd/trace-mem.c b/tracecmd/trace-mem.c
index 078a61bc702a..25bdbaee8160 100644
--- a/tracecmd/trace-mem.c
+++ b/tracecmd/trace-mem.c
@@ -30,31 +30,31 @@ static int kmem_cache_alloc_type;
 static int kmem_cache_alloc_node_type;
 static int kmem_cache_free_type;
 
-struct tep_format_field *common_type_field;
+static struct tep_format_field *common_type_field;
 
-struct tep_format_field *kmalloc_callsite_field;
-struct tep_format_field *kmalloc_bytes_req_field;
-struct tep_format_field *kmalloc_bytes_alloc_field;
-struct tep_format_field *kmalloc_ptr_field;
+static struct tep_format_field *kmalloc_callsite_field;
+static struct tep_format_field *kmalloc_bytes_req_field;
+static struct tep_format_field *kmalloc_bytes_alloc_field;
+static struct tep_format_field *kmalloc_ptr_field;
 
-struct tep_format_field *kmalloc_node_callsite_field;
-struct tep_format_field *kmalloc_node_bytes_req_field;
-struct tep_format_field *kmalloc_node_bytes_alloc_field;
-struct tep_format_field *kmalloc_node_ptr_field;
+static struct tep_format_field *kmalloc_node_callsite_field;
+static struct tep_format_field *kmalloc_node_bytes_req_field;
+static struct tep_format_field *kmalloc_node_bytes_alloc_field;
+static struct tep_format_field *kmalloc_node_ptr_field;
 
-struct tep_format_field *kfree_ptr_field;
+static struct tep_format_field *kfree_ptr_field;
 
-struct tep_format_field *kmem_cache_callsite_field;
-struct tep_format_field *kmem_cache_bytes_req_field;
-struct tep_format_field *kmem_cache_bytes_alloc_field;
-struct tep_format_field *kmem_cache_ptr_field;
+static struct tep_format_field *kmem_cache_callsite_field;
+static struct tep_format_field *kmem_cache_bytes_req_field;
+static struct tep_format_field *kmem_cache_bytes_alloc_field;
+static struct tep_format_field *kmem_cache_ptr_field;
 
-struct tep_format_field *kmem_cache_node_callsite_field;
-struct tep_format_field *kmem_cache_node_bytes_req_field;
-struct tep_format_field *kmem_cache_node_bytes_alloc_field;
-struct tep_format_field *kmem_cache_node_ptr_field;
+static struct tep_format_field *kmem_cache_node_callsite_field;
+static struct tep_format_field *kmem_cache_node_bytes_req_field;
+static struct tep_format_field *kmem_cache_node_bytes_alloc_field;
+static struct tep_format_field *kmem_cache_node_ptr_field;
 
-struct tep_format_field *kmem_cache_free_ptr_field;
+static struct tep_format_field *kmem_cache_free_ptr_field;
 
 static void *zalloc(size_t size)
 {