diff options
author | 2020-09-10 22:37:36 +0100 | |
---|---|---|
committer | 2020-09-10 22:37:36 +0100 | |
commit | bb00f570a7d3f1d0e4233f8d353fb9c56f3a55cc (patch) | |
tree | 5bc466aefefd0e8cc7d4f3c4011ac5edbcfdabe6 /10.2.0 | |
parent | 10.2.0: backport PR96377 (c vector init syntax) (diff) | |
download | gcc-patches-bb00f570a7d3f1d0e4233f8d353fb9c56f3a55cc.tar.gz gcc-patches-bb00f570a7d3f1d0e4233f8d353fb9c56f3a55cc.tar.bz2 gcc-patches-bb00f570a7d3f1d0e4233f8d353fb9c56f3a55cc.zip |
10.2.0: fix TOPN counters when logged from shared library
The change does not yet fix underlying problem of recursive inliner.
Bug: https://gcc.gnu.org/PR96913
Bug: https://gcc.gnu.org/PR96394
Bug: https://bugs.gentoo.org/734006
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to '10.2.0')
-rw-r--r-- | 10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch | 42 | ||||
-rw-r--r-- | 10.2.0/gentoo/README.history | 1 |
2 files changed, 43 insertions, 0 deletions
diff --git a/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch b/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch new file mode 100644 index 0000000..5c301e4 --- /dev/null +++ b/10.2.0/gentoo/38_all_gcov-TOPN-PR96913.patch @@ -0,0 +1,42 @@ +https://gcc.gnu.org/PR96913 +https://gcc.gnu.org/PR96394 +https://bugs.gentoo.org/734006 + +From ae887148e112e018bec0bab5bc15e53f2225037a Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich <siarheit@google.com> +Date: Sun, 6 Sep 2020 12:13:54 +0100 +Subject: [PATCH] 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. +--- + libgcc/libgcov-driver.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/libgcc/libgcov-driver.c ++++ b/libgcc/libgcov-driver.c +@@ -242,7 +242,7 @@ prune_counters (struct gcov_info *gi) + if (gi->merge[j] == NULL) + continue; + +- if (gi->merge[j] == __gcov_merge_topn) ++ if (j == GCOV_COUNTER_V_TOPN || j == GCOV_COUNTER_V_INDIR) + { + gcc_assert (!(ci->num % GCOV_TOPN_VALUES_COUNTERS)); + for (unsigned k = 0; k < (ci->num / GCOV_TOPN_VALUES_COUNTERS); diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history index 3fbcbfd..6d00c5a 100644 --- a/10.2.0/gentoo/README.history +++ b/10.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 3 TODO U 28_all_EXTRA_OPTIONS-fstack-clash-protection.patch + 37_all_c-vector-init-PR96377.patch + + 38_all_gcov-TOPN-PR96913.patch 2 23 Aug 2020 + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch |