diff options
Diffstat (limited to 'kernel/gcov/gcov.h')
| -rw-r--r-- | kernel/gcov/gcov.h | 73 |
1 files changed, 69 insertions, 4 deletions
diff --git a/kernel/gcov/gcov.h b/kernel/gcov/gcov.h index 060073ebf7a..3083b37f430 100644 --- a/kernel/gcov/gcov.h +++ b/kernel/gcov/gcov.h @@ -17,11 +17,30 @@ #include <linux/types.h> /* - * Profiling data types used for gcc 3.4 and above - these are defined by + * Profiling data types used for at least gcc 4.4 - these are defined by * gcc and need to be kept as close to the original definition as possible to * remain compatible. + * + * If compiling with an Android toolchain (from 4.4 to at least 4.6), + * CONFIG_GCOV_TOOLCHAIN_IS_ANDROID must be set, since it's not compatible + * with a vanilla gcc. + */ + +#ifdef CONFIG_GCOV_TOOLCHAIN_IS_ANDROID + +/* + * Android GCC 4.6 drops the 'name' field from 'struct gcov_fn_info'. */ -#define GCOV_COUNTERS 5 +# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) +# define GCOV_FN_INFO_HAS_NAME_FIELD +# endif + +# define GCOV_TAG_FUNCTION_LENGTH 3 +#else /* !CONFIG_GCOV_TOOLCHAIN_IS_ANDROID */ +# define GCOV_TAG_FUNCTION_LENGTH 2 +#endif + +#define GCOV_COUNTERS 10 #define GCOV_DATA_MAGIC ((unsigned int) 0x67636461) #define GCOV_TAG_FUNCTION ((unsigned int) 0x01000000) #define GCOV_TAG_COUNTER_BASE ((unsigned int) 0x01a10000) @@ -34,10 +53,39 @@ typedef long gcov_type; typedef long long gcov_type; #endif +/* + * Source module info. The data structure is used in both runtime and + * profile-use phase. Android toolchain only. + */ +struct gcov_module_info { + unsigned int ident; +/* + * This is overloaded to mean two things: + * (1) means FDO/LIPO in instrumented binary. + * (2) means IS_PRIMARY in persistent file or memory copy used in profile-use. + */ + unsigned int is_primary; + unsigned int is_exported; + unsigned int lang; + char *da_filename; + char *source_filename; + unsigned int num_quote_paths; + unsigned int num_bracket_paths; + unsigned int num_cpp_defines; + unsigned int num_cpp_includes; + unsigned int num_cl_args; + char *string_array[1]; +}; + + /** * struct gcov_fn_info - profiling meta data per function * @ident: object file-unique function identifier - * @checksum: function checksum + * @checksum: function checksum. Removed in Android GCC 4.4+ + * @lineno_checksum: function lineno checksum. In Android GCC 4.4+ + * @cfg_checksum: function cfg checksum. In Android GCC 4.4+ + * @dc_offset: direct call offset + * @name: function name. In Android GCC 4.4, removed from 4.6. * @n_ctrs: number of values per counter type belonging to this function * * This data is generated by gcc during compilation and doesn't change @@ -45,7 +93,16 @@ typedef long long gcov_type; */ struct gcov_fn_info { unsigned int ident; +#ifndef CONFIG_GCOV_TOOLCHAIN_IS_ANDROID unsigned int checksum; +#else + unsigned int lineno_checksum; + unsigned int cfg_checksum; + unsigned int dc_offset; +# ifdef GCOV_FN_INFO_HAS_NAME_FIELD + const char *name; +# endif +#endif unsigned int n_ctrs[0]; }; @@ -65,11 +122,13 @@ struct gcov_ctr_info { }; /** - * struct gcov_info - profiling data per object file + * struct gcov_info - profiling data per object file. In Android GCC 4.4+ * @version: gcov version magic indicating the gcc version used for compilation + * @modinfo: additional module information * @next: list head for a singly-linked list * @stamp: time stamp * @filename: name of the associated gcov data file + * @eof_pos: end position of profile data. In Android GCC 4.4+ * @n_functions: number of instrumented functions * @functions: function data * @ctr_mask: mask specifying which counter types are active @@ -80,9 +139,15 @@ struct gcov_ctr_info { */ struct gcov_info { unsigned int version; +#ifdef CONFIG_GCOV_TOOLCHAIN_IS_ANDROID + struct gcov_module_info *mod_info; +#endif struct gcov_info *next; unsigned int stamp; const char *filename; +#ifdef CONFIG_GCOV_TOOLCHAIN_IS_ANDROID + unsigned int eof_pos; +#endif unsigned int n_functions; const struct gcov_fn_info *functions; unsigned int ctr_mask; |
