Skip to content

Commit

Permalink
gcov: docs: add a note on GCC vs Clang differences
Browse files Browse the repository at this point in the history
Document some things of note to gcov users:
1. GCC gcov and Clang llvm-cov tools are not compatible.
2. The use of GCC vs Clang is transparent at build-time.

Also adjust the documentation to account for the removal of config symbol
CONFIG_GCOV_FORMAT_AUTODETECT by commit 6a61b70 ("gcov: remove
CONFIG_GCOV_FORMAT_AUTODETECT").

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Tri Vo <[email protected]>
Reviewed-by: Peter Oberparleiter <[email protected]>
Cc: Daniel Mentz <[email protected]>
Cc: Greg Hackmann <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: Petri Gynther <[email protected]>
Cc: Prasad Sodagudi <[email protected]>
Cc: Trilok Soni <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
vo4 authored and torvalds committed May 15, 2019
1 parent 826eba0 commit aa069a2
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Documentation/dev-tools/gcov.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ Configure the kernel with::
CONFIG_DEBUG_FS=y
CONFIG_GCOV_KERNEL=y

select the gcc's gcov format, default is autodetect based on gcc version::

CONFIG_GCOV_FORMAT_AUTODETECT=y

and to get coverage data for the entire kernel::

CONFIG_GCOV_PROFILE_ALL=y
Expand Down Expand Up @@ -169,6 +165,20 @@ b) gcov is run on the BUILD machine
[user@build] gcov -o /tmp/coverage/tmp/out/init main.c


Note on compilers
-----------------

GCC and LLVM gcov tools are not necessarily compatible. Use gcov_ to work with
GCC-generated .gcno and .gcda files, and use llvm-cov_ for Clang.

.. _gcov: http://gcc.gnu.org/onlinedocs/gcc/Gcov.html
.. _llvm-cov: https://llvm.org/docs/CommandGuide/llvm-cov.html

Build differences between GCC and Clang gcov are handled by Kconfig. It
automatically selects the appropriate gcov format depending on the detected
toolchain.


Troubleshooting
---------------

Expand Down

0 comments on commit aa069a2

Please sign in to comment.