1 This patch contains our local modifications for gcov-io.h and libgcov.c.
2 The file gcov-iov.h is taken from a gcc build (produced at compile
3 time). The file gcov-io.c is unchanged.
5 --- gcc-4.7.2/gcc/gcov-io.h 2011-12-04 10:27:19.000000000 -0800
6 +++ coreboot/src/lib/gcov-io.h 2013-01-12 16:45:57.000000000 -0800
12 +#define GCOV_LINKAGE /* nothing */
13 +/* We need the definitions for
16 + They are defined in gcc/defaults.h and gcc/config/<arch_depend_files>
17 + (like, gcc/config/i386/i386.h). And it can be overridden by setting
18 + in build scripts. Here I hardcoded the value for x86. */
19 +#define BITS_PER_UNIT 8
20 +#define LONG_LONG_TYPE_SIZE 64
22 +/* There are many gcc_assertions. Set the value to 1 if we want a warning
23 + message if the assertion fails. */
24 +#ifndef ENABLE_ASSERT_CHECKING
25 +#define ENABLE_ASSERT_CHECKING 1
27 +#endif /* __COREBOOT__ */
30 /* About the target */
33 is not also used in a DSO. */
38 +#endif /* __COREBOOT__ */
40 #define gcov_var __gcov_var
41 #define gcov_open __gcov_open
43 /* Register a new object file module. */
44 extern void __gcov_init (struct gcov_info *) ATTRIBUTE_HIDDEN;
47 /* Called before fork, to avoid double counting. */
48 extern void __gcov_flush (void) ATTRIBUTE_HIDDEN;
51 /* The merge function that just sums the counters. */
52 extern void __gcov_merge_add (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
53 --- gcc-4.7.2/libgcc/libgcov.c 2012-01-11 10:50:21.000000000 -0800
54 +++ coreboot/src/lib/libgcov.c 2013-01-16 09:45:11.000000000 -0800
56 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
57 <http://www.gnu.org/licenses/>. */
63 +#include <console/console.h>
66 +#define gcc_assert(x) ASSERT(x)
67 +#define fprintf(file, x...) printk(BIOS_ERR, x)
68 +#define alloca(size) __builtin_alloca (size)
69 +#include "gcov-glue.c"
71 +/* Define MACROs to be used by coreboot compilation. */
73 +# define L_gcov_interval_profiler
74 +# define L_gcov_pow2_profiler
75 +# define L_gcov_one_value_profiler
76 +# define L_gcov_indirect_call_profiler
77 +# define L_gcov_average_profiler
78 +# define L_gcov_ior_profiler
80 +# define HAVE_CC_TLS 0
81 +# define __GCOV_KERNEL__
83 +# define IN_LIBGCOV 1
85 +#else /* __COREBOOT__ */
88 #include "coretypes.h"
90 #include "libgcc_tm.h"
91 +#endif /* __COREBOOT__ */
94 #if defined(inhibit_libc)
95 #define IN_LIBGCOV (-1)
98 #define GCOV_LINKAGE /* nothing */
101 +#endif /* __COREBOOT__ */
104 #if defined(inhibit_libc)
109 +#ifndef __COREBOOT__
114 #include <sys/stat.h>
117 +void __gcov_merge_add(gcov_type *counters __attribute__ ((unused)),
118 + unsigned n_counters __attribute__ ((unused))) {}
119 +#endif /* __COREBOOT__ */
125 create_file_directory (char *filename)
131 #if !defined(TARGET_POSIX_IO) && !defined(_WIN32)
141 static struct gcov_fn_buffer *
143 struct gcov_ctr_summary *cs_ptr;
144 const struct gcov_ctr_info *ci_ptr;
148 gcov_unsigned_t c_num;
149 const char *gcov_prefix;
150 int gcov_prefix_strip = 0;
155 +#ifndef __COREBOOT__
157 /* Check if the level of dirs to strip off specified. */
158 char *tmp = getenv("GCOV_PREFIX_STRIP");
166 /* If no prefix was specified and a prefix stip, then we assume
168 if (filename_length > gcov_max_filename)
169 gcov_max_filename = filename_length;
171 +#ifndef __COREBOOT__
176 info->next = gcov_list;
178 @@ -767,14 +811,15 @@
180 #ifdef L_gcov_merge_single
181 /* The profile merging function for choosing the most common value.
182 - It is given an array COUNTERS of N_COUNTERS old counters and it
183 - reads the same number of counters from the gcov file. The counters
184 - are split into 3-tuples where the members of the tuple have
187 - -- the stored candidate on the most common value of the measured entity
189 - -- total number of evaluations of the value */
190 + * It is given an array COUNTERS of N_COUNTERS old counters and it
191 + * reads the same number of counters from the gcov file. The counters
192 + * are split into 3-tuples where the members of the tuple have
195 + * -- the stored candidate on the most common value of the measured entity
197 + * -- total number of evaluations of the value
200 __gcov_merge_single (gcov_type *counters, unsigned n_counters)
202 @@ -805,15 +850,16 @@
204 #ifdef L_gcov_merge_delta
205 /* The profile merging function for choosing the most common
206 - difference between two consecutive evaluations of the value. It is
207 - given an array COUNTERS of N_COUNTERS old counters and it reads the
208 - same number of counters from the gcov file. The counters are split
209 - into 4-tuples where the members of the tuple have meanings:
211 - -- the last value of the measured entity
212 - -- the stored candidate on the most common difference
214 - -- total number of evaluations of the value */
215 + * difference between two consecutive evaluations of the value. It is
216 + * given an array COUNTERS of N_COUNTERS old counters and it reads the
217 + * same number of counters from the gcov file. The counters are split
218 + * into 4-tuples where the members of the tuple have meanings:
220 + * -- the last value of the measured entity
221 + * -- the stored candidate on the most common difference
223 + * -- total number of evaluations of the value
226 __gcov_merge_delta (gcov_type *counters, unsigned n_counters)