gcov: move gcov structs definitions to a gcc version specific file
Since also the gcov structures(gcov_info, gcov_fn_info, gcov_ctr_info) can change between gcc releases, as shown in gcc 4.7, they cannot be defined in a common header and need to be moved to a specific gcc implemention file. This also requires to make the gcov_info structure opaque for the common code and to introduce simple helpers for accessing data inside gcov_info. Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com> Cc: Jan Stancek <jstancek@redhat.com> Cc: Kees Cook <keescook@chromium.org> Acked-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Andy Gospodarek <agospoda@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
0d20633b04
commit
8cbce376e3
@@ -21,7 +21,6 @@
|
||||
* gcc and need to be kept as close to the original definition as possible to
|
||||
* remain compatible.
|
||||
*/
|
||||
#define GCOV_COUNTERS 5
|
||||
#define GCOV_DATA_MAGIC ((unsigned int) 0x67636461)
|
||||
#define GCOV_TAG_FUNCTION ((unsigned int) 0x01000000)
|
||||
#define GCOV_TAG_COUNTER_BASE ((unsigned int) 0x01a10000)
|
||||
@@ -34,60 +33,18 @@ typedef long gcov_type;
|
||||
typedef long long gcov_type;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* struct gcov_fn_info - profiling meta data per function
|
||||
* @ident: object file-unique function identifier
|
||||
* @checksum: function checksum
|
||||
* @n_ctrs: number of values per counter type belonging to this function
|
||||
*
|
||||
* This data is generated by gcc during compilation and doesn't change
|
||||
* at run-time.
|
||||
*/
|
||||
struct gcov_fn_info {
|
||||
unsigned int ident;
|
||||
unsigned int checksum;
|
||||
unsigned int n_ctrs[0];
|
||||
};
|
||||
/* Opaque gcov_info. The gcov structures can change as for example in gcc 4.7 so
|
||||
* we cannot use full definition here and they need to be placed in gcc specific
|
||||
* implementation of gcov. This also means no direct access to the members in
|
||||
* generic code and usage of the interface below.*/
|
||||
struct gcov_info;
|
||||
|
||||
/**
|
||||
* struct gcov_ctr_info - profiling data per counter type
|
||||
* @num: number of counter values for this type
|
||||
* @values: array of counter values for this type
|
||||
* @merge: merge function for counter values of this type (unused)
|
||||
*
|
||||
* This data is generated by gcc during compilation and doesn't change
|
||||
* at run-time with the exception of the values array.
|
||||
*/
|
||||
struct gcov_ctr_info {
|
||||
unsigned int num;
|
||||
gcov_type *values;
|
||||
void (*merge)(gcov_type *, unsigned int);
|
||||
};
|
||||
|
||||
/**
|
||||
* struct gcov_info - profiling data per object file
|
||||
* @version: gcov version magic indicating the gcc version used for compilation
|
||||
* @next: list head for a singly-linked list
|
||||
* @stamp: time stamp
|
||||
* @filename: name of the associated gcov data file
|
||||
* @n_functions: number of instrumented functions
|
||||
* @functions: function data
|
||||
* @ctr_mask: mask specifying which counter types are active
|
||||
* @counts: counter data per counter type
|
||||
*
|
||||
* This data is generated by gcc during compilation and doesn't change
|
||||
* at run-time with the exception of the next pointer.
|
||||
*/
|
||||
struct gcov_info {
|
||||
unsigned int version;
|
||||
struct gcov_info *next;
|
||||
unsigned int stamp;
|
||||
const char *filename;
|
||||
unsigned int n_functions;
|
||||
const struct gcov_fn_info *functions;
|
||||
unsigned int ctr_mask;
|
||||
struct gcov_ctr_info counts[0];
|
||||
};
|
||||
/* Interface to access gcov_info data */
|
||||
const char *gcov_info_filename(struct gcov_info *info);
|
||||
unsigned int gcov_info_version(struct gcov_info *info);
|
||||
struct gcov_info *gcov_info_next(struct gcov_info *info);
|
||||
void gcov_info_link(struct gcov_info *info);
|
||||
void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info);
|
||||
|
||||
/* Base interface. */
|
||||
enum gcov_action {
|
||||
|
Reference in New Issue
Block a user