public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gcov: add support for GCC 4.9
@ 2014-05-11  5:22 Yuan Pengfei
  0 siblings, 0 replies; 2+ messages in thread
From: Yuan Pengfei @ 2014-05-11  5:22 UTC (permalink / raw)
  To: linux-kernel

From: Yuan Pengfei <coolypf@qq.com>

This patch handles the gcov-related changes in GCC 4.9:
  A new counter (time profile) is added.
See http://gcc.gnu.org/gcc-4.9/changes.html
Signed-off-by: Yuan Pengfei <coolypf@qq.com>
---
 kernel/gcov/base.c    | 6 ++++++
 kernel/gcov/gcc_3_4.c | 2 +-
 kernel/gcov/gcc_4_7.c | 7 ++++++-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/kernel/gcov/base.c b/kernel/gcov/base.c
index f45b75b..b358a80 100644
--- a/kernel/gcov/base.c
+++ b/kernel/gcov/base.c
@@ -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()
  *
diff --git a/kernel/gcov/gcc_3_4.c b/kernel/gcov/gcc_3_4.c
index 27bc88a..1c1f425 100644
--- a/kernel/gcov/gcc_3_4.c
+++ b/kernel/gcov/gcc_3_4.c
@@ -269,7 +269,7 @@ struct gcov_info *gcov_info_dup(struct gcov_info *info)
  dup->counts[i].num = ctr->num;
  dup->counts[i].merge = ctr->merge;
  dup->counts[i].values = vmalloc(size);
- if (!dup->counts[i].values)
+ if (size && !dup->counts[i].values)
  goto err_free;
  memcpy(dup->counts[i].values, ctr->values, size);
  }
diff --git a/kernel/gcov/gcc_4_7.c b/kernel/gcov/gcc_4_7.c
index 2c6e463..7f74b59 100644
--- a/kernel/gcov/gcc_4_7.c
+++ b/kernel/gcov/gcc_4_7.c
@@ -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;
@@ -290,7 +295,7 @@ struct gcov_info *gcov_info_dup(struct gcov_info *info)
 
  dci_ptr->values = vmalloc(cv_size);
 
- if (!dci_ptr->values)
+ if (cv_size && !dci_ptr->values)
  goto err_free;
 
  dci_ptr->num = sci_ptr->num;
-- 
2.0.0.rc2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-12 12:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <tencent_339F323E15E730DF6D7AC23A@qq.com>
2014-05-12 12:08 ` [PATCH] gcov: add support for GCC 4.9 Peter Oberparleiter
2014-05-11  5:22 Yuan Pengfei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox