[all-commits] [llvm/llvm-project] 2d00eb: [gcov] Fix .gcda decoding and support GCC 8, 9 and 10

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun May 10 09:55:42 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2d00eb17cac40d96f357490d005c4601271bbba3
      https://github.com/llvm/llvm-project/commit/2d00eb17cac40d96f357490d005c4601271bbba3
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-05-10 (Sun, 10 May 2020)

  Changed paths:
    M llvm/include/llvm/ProfileData/GCOV.h
    M llvm/lib/ProfileData/GCOV.cpp
    M llvm/lib/ProfileData/SampleProfReader.cpp
    A llvm/test/tools/llvm-cov/Inputs/gcov-4.7.gcda
    A llvm/test/tools/llvm-cov/Inputs/gcov-4.7.gcno
    A llvm/test/tools/llvm-cov/Inputs/gcov-8.gcda
    A llvm/test/tools/llvm-cov/Inputs/gcov-8.gcno
    A llvm/test/tools/llvm-cov/Inputs/gcov-9.gcda
    A llvm/test/tools/llvm-cov/Inputs/gcov-9.gcno
    R llvm/test/tools/llvm-cov/Inputs/gcov47_compatibility.gcda
    R llvm/test/tools/llvm-cov/Inputs/gcov47_compatibility.gcno
    A llvm/test/tools/llvm-cov/gcov-4.7.c
    A llvm/test/tools/llvm-cov/gcov-8.c
    A llvm/test/tools/llvm-cov/gcov-9.c
    R llvm/test/tools/llvm-cov/gcov47_compatibility.cpp
    M llvm/test/tools/llvm-cov/llvm-cov.test
    M llvm/tools/llvm-cov/gcov.cpp

  Log Message:
  -----------
  [gcov] Fix .gcda decoding and support GCC 8, 9 and 10

GCDAProfiling.c unnecessarily writes function names to .gcda files.
GCC 4.2 gcc/libgcov.c (now renamed to libgcc/libgcov*) did not write function
names. gcov-7 (compatible) crashes on .gcda produced by libclang_rt.profile
rL176173 realized the problem and introduced a mode to remove function
names.

llvm-cov code apparently takes GCDAProfiling.c output format as truth
and tries to decode function names.  Additionally, llvm-cov tries to
decode tags in certain order which does not match libgcov emitted .gcda
files.

This patch fixes the .gcda decoder and makes it work with GCC 8 and 9
(10 is compatible with 9). Note, line statistics are broken and not
fixed by this patch.

Add test/tools/llvm-cov/gcov-{4.7,8,9}.c to test compatibility.




More information about the All-commits mailing list