diff options
Diffstat (limited to 'kernel/gcov/gcc_3_4.c')
-rw-r--r-- | kernel/gcov/gcc_3_4.c | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/kernel/gcov/gcc_3_4.c b/kernel/gcov/gcc_3_4.c index ae5bb4260033..27bc88a35013 100644 --- a/kernel/gcov/gcc_3_4.c +++ b/kernel/gcov/gcc_3_4.c | |||
@@ -21,6 +21,121 @@ | |||
21 | #include <linux/vmalloc.h> | 21 | #include <linux/vmalloc.h> |
22 | #include "gcov.h" | 22 | #include "gcov.h" |
23 | 23 | ||
24 | #define GCOV_COUNTERS 5 | ||
25 | |||
26 | static struct gcov_info *gcov_info_head; | ||
27 | |||
28 | /** | ||
29 | * struct gcov_fn_info - profiling meta data per function | ||
30 | * @ident: object file-unique function identifier | ||
31 | * @checksum: function checksum | ||
32 | * @n_ctrs: number of values per counter type belonging to this function | ||
33 | * | ||
34 | * This data is generated by gcc during compilation and doesn't change | ||
35 | * at run-time. | ||
36 | */ | ||
37 | struct gcov_fn_info { | ||
38 | unsigned int ident; | ||
39 | unsigned int checksum; | ||
40 | unsigned int n_ctrs[0]; | ||
41 | }; | ||
42 | |||
43 | /** | ||
44 | * struct gcov_ctr_info - profiling data per counter type | ||
45 | * @num: number of counter values for this type | ||
46 | * @values: array of counter values for this type | ||
47 | * @merge: merge function for counter values of this type (unused) | ||
48 | * | ||
49 | * This data is generated by gcc during compilation and doesn't change | ||
50 | * at run-time with the exception of the values array. | ||
51 | */ | ||
52 | struct gcov_ctr_info { | ||
53 | unsigned int num; | ||
54 | gcov_type *values; | ||
55 | void (*merge)(gcov_type *, unsigned int); | ||
56 | }; | ||
57 | |||
58 | /** | ||
59 | * struct gcov_info - profiling data per object file | ||
60 | * @version: gcov version magic indicating the gcc version used for compilation | ||
61 | * @next: list head for a singly-linked list | ||
62 | * @stamp: time stamp | ||
63 | * @filename: name of the associated gcov data file | ||
64 | * @n_functions: number of instrumented functions | ||
65 | * @functions: function data | ||
66 | * @ctr_mask: mask specifying which counter types are active | ||
67 | * @counts: counter data per counter type | ||
68 | * | ||
69 | * This data is generated by gcc during compilation and doesn't change | ||
70 | * at run-time with the exception of the next pointer. | ||
71 | */ | ||
72 | struct gcov_info { | ||
73 | unsigned int version; | ||
74 | struct gcov_info *next; | ||
75 | unsigned int stamp; | ||
76 | const char *filename; | ||
77 | unsigned int n_functions; | ||
78 | const struct gcov_fn_info *functions; | ||
79 | unsigned int ctr_mask; | ||
80 | struct gcov_ctr_info counts[0]; | ||
81 | }; | ||
82 | |||
83 | /** | ||
84 | * gcov_info_filename - return info filename | ||
85 | * @info: profiling data set | ||
86 | */ | ||
87 | const char *gcov_info_filename(struct gcov_info *info) | ||
88 | { | ||
89 | return info->filename; | ||
90 | } | ||
91 | |||
92 | /** | ||
93 | * gcov_info_version - return info version | ||
94 | * @info: profiling data set | ||
95 | */ | ||
96 | unsigned int gcov_info_version(struct gcov_info *info) | ||
97 | { | ||
98 | return info->version; | ||
99 | } | ||
100 | |||
101 | /** | ||
102 | * gcov_info_next - return next profiling data set | ||
103 | * @info: profiling data set | ||
104 | * | ||
105 | * Returns next gcov_info following @info or first gcov_info in the chain if | ||
106 | * @info is %NULL. | ||
107 | */ | ||
108 | struct gcov_info *gcov_info_next(struct gcov_info *info) | ||
109 | { | ||
110 | if (!info) | ||
111 | return gcov_info_head; | ||
112 | |||
113 | return info->next; | ||
114 | } | ||
115 | |||
116 | /** | ||
117 | * gcov_info_link - link/add profiling data set to the list | ||
118 | * @info: profiling data set | ||
119 | */ | ||
120 | void gcov_info_link(struct gcov_info *info) | ||
121 | { | ||
122 | info->next = gcov_info_head; | ||
123 | gcov_info_head = info; | ||
124 | } | ||
125 | |||
126 | /** | ||
127 | * gcov_info_unlink - unlink/remove profiling data set from the list | ||
128 | * @prev: previous profiling data set | ||
129 | * @info: profiling data set | ||
130 | */ | ||
131 | void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info) | ||
132 | { | ||
133 | if (prev) | ||
134 | prev->next = info->next; | ||
135 | else | ||
136 | gcov_info_head = info->next; | ||
137 | } | ||
138 | |||
24 | /* Symbolic links to be created for each profiling data file. */ | 139 | /* Symbolic links to be created for each profiling data file. */ |
25 | const struct gcov_link gcov_link[] = { | 140 | const struct gcov_link gcov_link[] = { |
26 | { OBJ_TREE, "gcno" }, /* Link to .gcno file in $(objtree). */ | 141 | { OBJ_TREE, "gcno" }, /* Link to .gcno file in $(objtree). */ |