title: How to resolve __gcov_init undefined reference issue when linking
body: <p>I now work on C code coverage study and encountered following issue, GCC version 4.4.6:</p>
  
  <ol>
  <li>Added compiler flag <code>CFLAGS = --coverage</code> and linker option <code>LDFLAGS := --coverage</code> or <code>LOCAL_LDLIBS := --coverage</code> and got the error: </li>
  </ol>
  
  <p><code>undefined reference to '__gcov_init'" and "undefined reference to '__gcov_merge_add'</code></p>
  
  <ol start="2">
  <li>Added option <code>LOCAL_LDFLAGS := --coverage</code>, and got link error:</li>
  </ol>
  
  <p><code>libgcov.a(_gcov.o): in function __gcov_set_sampling_rate: undefined reference to '__gcov_sampling_rate' 
  libgcov.a(_gcov.o): in function gcov_exit: undefined reference to '__gcov_pmu_profile_filename' 
  libgcov.a(_gcov.o): in function __gcov_init: undefined reference to '__gcov_pmu_profile_options' '__gcov_pmu_top_n_address'</code></p>
  
  <p>Can anyone help to provide some suggestions on this issue?</p>