summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorTuomas Tynkkynen <ttynkkynen@nvidia.com>2012-06-20 14:47:25 +0300
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 12:13:08 -0700
commit390fce38879a4c9c4d7a99200e34d2037f37036d (patch)
tree0d95c6b068d3225ea2ffff25d176301300023522 /kernel
parent49c2da0bf4fc553cc083dfa84b37f86b663e05d1 (diff)
Fix gcov for GCC 4.6.
Gcov's internal data structures, on which the kernel depends on, have changed in GCC 4.6. This patch adds support for GCC 4.6 and should still work on GCC 4.4 too. For reference, look at 'struct gcov_fn_info' in GCC's 'gcc/gcov-io.h', near line 698: https://android.googlesource.com/toolchain/gcc/+/master/gcc-4.4.3/ https://android.googlesource.com/toolchain/gcc/+/master/gcc-4.6/ Bug 1003822 Change-Id: I527736f944c80b8b345d1685669c0b99eb38fb66 Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Reviewed-on: http://git-master/r/110073 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com> Tested-by: Juha Tukkinen <jtukkinen@nvidia.com> Rebase-Id: Rfdb0c2f3801fc41d3ed4b3696634adf79bdc232b
Diffstat (limited to 'kernel')
-rw-r--r--kernel/gcov/gcc_3_4.c12
-rw-r--r--kernel/gcov/gcov.h11
2 files changed, 22 insertions, 1 deletions
diff --git a/kernel/gcov/gcc_3_4.c b/kernel/gcov/gcc_3_4.c
index d753d1152b7b..bc78336bc345 100644
--- a/kernel/gcov/gcc_3_4.c
+++ b/kernel/gcov/gcc_3_4.c
@@ -466,8 +466,12 @@ int gcov_iter_write(struct gcov_iterator *iter, struct seq_file *seq)
rc = seq_write_gcov_u32(seq, GCOV_TAG_FUNCTION);
break;
case RECORD_FUNCTON_TAG_LEN:
+#ifdef GCOV_FN_INFO_HAS_NAME_FIELD
rc = seq_write_gcov_u32(seq, GCOV_TAG_FUNCTION_LENGTH +
(sizeof_str(get_func(iter)->name)));
+#else
+ rc = seq_write_gcov_u32(seq, GCOV_TAG_FUNCTION_LENGTH);
+#endif
break;
case RECORD_FUNCTION_IDENT:
rc = seq_write_gcov_u32(seq, get_func(iter)->ident);
@@ -479,11 +483,19 @@ int gcov_iter_write(struct gcov_iterator *iter, struct seq_file *seq)
rc = seq_write_gcov_u32(seq, get_func(iter)->cfg_checksum);
break;
case RECORD_FUNCTION_NAME_LEN:
+#ifdef GCOV_FN_INFO_HAS_NAME_FIELD
rc = seq_write_gcov_u32(seq,
(sizeof_str(get_func(iter)->name) - 1));
+#else
+ rc = 0;
+#endif
break;
case RECORD_FUNCTION_NAME:
+#ifdef GCOV_FN_INFO_HAS_NAME_FIELD
rc = seq_write_gcov_str(seq, get_func(iter)->name);
+#else
+ rc = 0;
+#endif
break;
case RECORD_COUNT_TAG:
rc = seq_write_gcov_u32(seq,
diff --git a/kernel/gcov/gcov.h b/kernel/gcov/gcov.h
index 040c6980df0d..8c5130a5c1b5 100644
--- a/kernel/gcov/gcov.h
+++ b/kernel/gcov/gcov.h
@@ -17,7 +17,14 @@
#include <linux/types.h>
/*
- * Profiling data types used for gcc 3.4 and above - these are defined by
+ * GCC 4.6 drops the 'name' field from 'struct gcov_fn_info'.
+ */
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
+#define GCOV_FN_INFO_HAS_NAME_FIELD
+#endif
+
+/*
+ * Profiling data types used for at least gcc 4.4 and 4.6 - these are defined by
* gcc and need to be kept as close to the original definition as possible to
* remain compatible.
*/
@@ -77,7 +84,9 @@ struct gcov_fn_info {
unsigned int lineno_checksum;
unsigned int cfg_checksum;
unsigned int dc_offset;
+#ifdef GCOV_FN_INFO_HAS_NAME_FIELD
const char *name;
+#endif
unsigned int n_ctrs[0];
};