From 72e0c742bd01f8e7e6dcca64042b9ad7e75979de Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 9 Sep 2021 13:02:24 +0200 Subject: gcov: make profile merging smarter Support merging of profiles that are built from a different .o files but belong to the same source file. Moreover, a checksum is verified during profile merging and so we can safely combine such profile. PR gcov-profile/90364 gcc/ChangeLog: * coverage.c (build_info): Emit checksum to the global variable. (build_info_type): Add new field for checksum. (coverage_obj_finish): Pass object_checksum. (coverage_init): Use 0 as checksum for .gcno files. * gcov-dump.c (dump_gcov_file): Dump also new checksum field. * gcov.c (read_graph_file): Read also checksum. * doc/invoke.texi: Document the behaviour change. libgcc/ChangeLog: * libgcov-driver.c (merge_one_data): Skip timestamp and verify checksums. (write_one_data): Write also checksum. * libgcov-util.c (read_gcda_file): Read also checksum field. * libgcov.h (struct gcov_info): Add new field. --- gcc/gcov.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/gcov.c') diff --git a/gcc/gcov.c b/gcc/gcov.c index cf0a49d..829e955 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -1814,6 +1814,8 @@ read_graph_file (void) bbg_file_name, v, e); } bbg_stamp = gcov_read_unsigned (); + /* Read checksum. */ + gcov_read_unsigned (); bbg_cwd = xstrdup (gcov_read_string ()); bbg_supports_has_unexecuted_blocks = gcov_read_unsigned (); @@ -2031,6 +2033,9 @@ read_count_file (void) goto cleanup; } + /* Read checksum. */ + gcov_read_unsigned (); + while ((tag = gcov_read_unsigned ())) { unsigned length = gcov_read_unsigned (); -- cgit v1.1