Skip to contentSkip to conversation

gcov: add support for GCC 4.9

PATCH In review Yuan Pengfei 2 participants 2 messages May 14, 2014 Gcov based kernel profiling

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 gcov: add support for GCC 4.9

From: Yuan Pengfei <[email protected]>

This patch handles the gcov-related changes in GCC 4.9:
A new counter (time profile) is added. The total number is 9 now. A new profile merge function __gcov_merge_time_profile is added.
See gcc/gcov-io.h and libgcc/libgcov-merge.c
For the first change, the layout of struct gcov_info is affected. For the second one, a dummy function is added to kernel/gcov/base.c similarly.

---
 kernel/gcov/base.c    | 6 ++++++
 kernel/gcov/gcc_4_7.c | 5 +++++
 2 files changed, 11 insertions(+)
kernel/gcov/base.c +6 -0
index f45b75b..b358a80 100644
@@ -85,6 +85,12 @@ void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
 }
 EXPORT_SYMBOL(__gcov_merge_ior);
 
+void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters)
+{
+	/* Unused. */
+}
+EXPORT_SYMBOL(__gcov_merge_time_profile);
+
 /**
  * gcov_enable_events - enable event reporting through gcov_event()
  *
kernel/gcov/gcc_4_7.c +5 -0
index 7465944..7f74b59 100644
@@ -18,7 +18,12 @@
 #include <linux/vmalloc.h>
 #include "gcov.h"
 
+#if __GNUC__ == 4 && __GNUC_MINOR__ >= 9
+#define GCOV_COUNTERS			9
+#else
 #define GCOV_COUNTERS			8
+#endif
+
 #define GCOV_TAG_FUNCTION_LENGTH	3
 
 static struct gcov_info *gcov_info_head;
Signature · 1 line
2.0.0.rc2
Acked-by on v4 1/1
#1 lore raw
Quoted 9 lines · Yuan Pengfei

From: Yuan Pengfei <[email protected]>

This patch handles the gcov-related changes in GCC 4.9:
A new counter (time profile) is added. The total number is 9 now. A new profile merge function __gcov_merge_time_profile is added.
See gcc/gcov-io.h and libgcc/libgcov-merge.c
For the first change, the layout of struct gcov_info is affected. For the second one, a dummy function is added to kernel/gcov/base.c similarly.

Looks good. Tested successfully on s390x with both GCC 4.9 and GCC 4.3.4.

Quoted 40 lines
---
 kernel/gcov/base.c    | 6 ++++++
 kernel/gcov/gcc_4_7.c | 5 +++++
 2 files changed, 11 insertions(+)
kernel/gcov/base.c +6 -0
index f45b75b..b358a80 100644
@@ -85,6 +85,12 @@ void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
 }
 EXPORT_SYMBOL(__gcov_merge_ior);
 
+void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters)
+{
+	/* Unused. */
+}
+EXPORT_SYMBOL(__gcov_merge_time_profile);
+
 /**
  * gcov_enable_events - enable event reporting through gcov_event()
  *
kernel/gcov/gcc_4_7.c +5 -0
index 7465944..7f74b59 100644
@@ -18,7 +18,12 @@
 #include <linux/vmalloc.h>
 #include "gcov.h"
 
+#if __GNUC__ == 4 && __GNUC_MINOR__ >= 9
+#define GCOV_COUNTERS			9
+#else
 #define GCOV_COUNTERS			8
+#endif
+
 #define GCOV_TAG_FUNCTION_LENGTH	3
 
 static struct gcov_info *gcov_info_head;
Signature · 2 lines
Peter Oberparleiter
Linux on System z Development - IBM Germany