Hello,
In our GCC porting, we use newlib instead of libc.  Today I tried to use
profiling feedback based optimization with option -fprofile-arcs.  But
the executable doesn't produce .gcda file.  I examined the disassembled
binary file and found the following functions are basically just dummy
ones: __gcov_init, __gcov_flush,  __gcov_merge_add. I checked libgcov.c
that contains these functions and found following code. 


#if defined(inhibit_libc)
/* If libc and its header files are not available, provide dummy
functions.  */

#ifdef L_gcov
void __gcov_init (struct gcov_info *p __attribute__ ((unused))) {}
void __gcov_flush (void) {}
#endif

#ifdef L_gcov_merge_add
void __gcov_merge_add (gcov_type *counters  __attribute__ ((unused)),
                       unsigned n_counters __attribute__ ((unused))) {}
#endif

#ifdef L_gcov_merge_single
void __gcov_merge_single (gcov_type *counters  __attribute__ ((unused)),
                          unsigned n_counters __attribute__ ((unused)))
{}
#endif

#ifdef L_gcov_merge_delta
void __gcov_merge_delta (gcov_type *counters  __attribute__ ((unused)),
                         unsigned n_counters __attribute__ ((unused)))
{}
#endif


Both -Dinhibit_libc and -DL_gcov are used as shown in our building log
file.  I guess -Dinhibit_libc is added because we used newlibc instead
of glibc. I tried to grep these functions in newlibc and didn't find
them.  My question is how to enable gcov with newlibc.  Do I need to
write my own versions of them?  Any suggestion is greatly appreciated.  

Cheers,
Bingfeng Mei

Broadcom UK

Reply via email to