]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
gcov: extra fields in gcov_info for android
authordmitry pervushin <dpervushin@nvidia.com>
Fri, 16 Dec 2016 10:59:03 +0000 (11:59 +0100)
committermobile promotions <svcmobile_promotions@nvidia.com>
Sun, 22 Jan 2017 07:03:15 +0000 (23:03 -0800)
Commit 6bdb1d31afd6d67460ae1fdc105122dba1042d20 introduced changes
in the structure gcov_info, that were incompatible with mainline gcc.
This patch #ifdefs the changes with ANDROID_GCOV, that is defined by
android toolchain only.

Source of this structure is ${GCC}/gcc/coverage.c, function
build_info_type

Bug 200251313
Bug 200166422
Bug 200264826

Change-Id: Id4052679c0bee7d9ea406ffc6e4ae64fe84c06cb
Signed-off-by: dmitry pervushin <dpervushin@nvidia.com>
Reviewed-on: http://git-master/r/1259013
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
kernel/gcov/Kconfig
kernel/gcov/gcc_4_7.c

index c92e44855ddda18843a2b7c9102a323811d27917..32251b20f55f05fb41e566bf539df26a7fb91c3c 100644 (file)
@@ -79,4 +79,14 @@ config GCOV_FORMAT_4_7
 
 endchoice
 
+config GCOV_ANDROID_TOOLCHAIN
+       bool "Android toolchain is used to build the kernel"
+       default y if ANDROID
+       ---help---
+       Android toolchain defines extra fields in gcov_info structure.
+       If you compile the kernel for Android, say Y here
+       If your gcc is without android patches, say N
+       We default it to Y in case of CONFIG_ANDROID is defined, but please
+       verify which toolchain is in use (gcc/coverage.c, build_info)
+
 endmenu
index d419836af846f1491c1705318a026e542e44dab6..0e323d185e864ae44801c6cb448362f6cc2eb5c3 100644 (file)
 #include <linux/vmalloc.h>
 #include "gcov.h"
 
+/*
+ * define ANDROID_GCOV if:
+ *    gcc version >= 4.8 and CONFIG_GCOV_ANDROID_TOOLCHAIN is defined
+ * Once android toolchain evolves, more cases to define ANDROID_GCOV
+ * should be added
+ */
+#ifdef CONFIG_GCOV_ANDROID_TOOLCHAIN
+#  if __GNUC__ == 4 && __GNUC_MINOR__ >= 8
+#    define ANDROID_GCOV
+#  endif
+#endif
+
 #if __GNUC__ == 5 && __GNUC_MINOR__ >= 1
 #define GCOV_COUNTERS                  10
 #elif __GNUC__ == 4 && __GNUC_MINOR__ >= 9
+#ifdef ANDROID_GCOV
 #define GCOV_COUNTERS                  11
 #else
+#define GCOV_COUNTERS                  9
+#endif
+#else
 #define GCOV_COUNTERS                  8
 #endif
 
@@ -86,15 +102,21 @@ struct gcov_fn_info {
  */
 struct gcov_info {
        unsigned int version;
+#ifdef ANDROID_GCOV
        void *mod_info;
+#endif
        struct gcov_info *next;
        unsigned int stamp;
        const char *filename;
+#ifdef ANDROID_GCOV
        unsigned int eof_pos;
+#endif
        void (*merge[GCOV_COUNTERS])(gcov_type *, unsigned int);
        unsigned int n_functions;
        struct gcov_fn_info **functions;
+#ifdef ANDROID_GCOV
        char **build_info;
+#endif
 };
 
 /**