diff options
author | Sergei Trofimovich <siarheit@google.com> | 2020-09-06 12:13:54 +0100 |
---|---|---|
committer | Sergei Trofimovich <siarheit@google.com> | 2020-09-22 11:41:04 +0100 |
commit | 4ecf368f4b4223fb2df4f3887429dfbb48852e38 (patch) | |
tree | 031f2bdda3e470e17656355aa44e52c1df8f5f15 /libgcc | |
parent | 46a274154786678e037fdce5dacd0305cddba0f9 (diff) | |
download | gcc-4ecf368f4b4223fb2df4f3887429dfbb48852e38.zip gcc-4ecf368f4b4223fb2df4f3887429dfbb48852e38.tar.gz gcc-4ecf368f4b4223fb2df4f3887429dfbb48852e38.tar.bz2 |
gcov: fix TOPN streaming from shared libraries
Before the change gcc did not stream correctly TOPN counters
if counters belonged to a non-local shared object.
As a result zero-section optimization generated TOPN sections
in a form not recognizable by '__gcov_merge_topn'.
The problem happens because in a case of multiple shared objects
'__gcov_merge_topn' function is present in address space multiple
times (once per each object).
The fix is to never rely on function address and predicate on TOPN
counter types.
libgcc/ChangeLog:
PR gcov-profile/96913
* libgcov-driver.c (write_one_data): Avoid function pointer
comparison in TOP streaming decision.
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/libgcov-driver.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c index 5891426..e53e4dc 100644 --- a/libgcc/libgcov-driver.c +++ b/libgcc/libgcov-driver.c @@ -424,7 +424,7 @@ write_one_data (const struct gcov_info *gi_ptr, n_counts = ci_ptr->num; - if (gi_ptr->merge[t_ix] == __gcov_merge_topn) + if (t_ix == GCOV_COUNTER_V_TOPN || t_ix == GCOV_COUNTER_V_INDIR) write_top_counters (ci_ptr, t_ix, n_counts); else { |