Hi Simon,

Simon Josefsson <[EMAIL PROTECTED]> writes:

> Hi Ludovic.  Thanks, I pushed this patch.  Adding anything to LDFLAGS
> doesn't seem to be required though?

According to the doc (info "(gcc)Debugging Options") it is required.
See also this example (with GCC 4.2.4):

  $ cat > t.c <<EOF
  int main (int argc, char *argv[]) { return 0; }
  EOF   
  $ gcc --coverage -c t.c
  $ gcc t.o 
  t.o: In function `global constructors keyed to 0_main':
  t.c:(.text+0x43): undefined reference to `__gcov_init'
  t.o:(.data+0x24): undefined reference to `__gcov_merge_add'
  collect2: ld returned 1 exit status
  $ gcc --coverage t.o
  [ success ]

> Btw, it is better/worse to compile with -O2?  It may be better for
> profiling optimizations, but the use-case here is to generate code
> coverage reports for the self tests.  So I would assume -O2 is harmful
> here.  Whether -g is useful or not is another question.

I don't think `-O' matters.  I don't think `-g' is required to get
useful source location information.

Thanks,
Ludo'.



Reply via email to