From 29b4bd4ea9d1b7cd6a241c83ff0daf7856107c55 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Mon, 6 Feb 2023 19:16:15 +1100 Subject: [PATCH] MDEV-30573 Server doesn't build with GCOV by GCC 11+ __gcov_flush was never an external symbol in the documentation. It was removed in gcc-11. The correct function to use is __gcov_dump which is defined in the gcov.h header. --- dbug/dbug.c | 6 +++--- mysys/stacktrace.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dbug/dbug.c b/dbug/dbug.c index a6d893e3f49..30b92b22dd0 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -86,7 +86,7 @@ #include #include #ifdef HAVE_gcov -extern void __gcov_flush(); +#include #endif #ifndef DBUG_OFF @@ -2212,7 +2212,7 @@ void _db_suicide_() fprintf(stderr, "SIGKILL myself\n"); fflush(stderr); #ifdef HAVE_gcov - __gcov_flush(); + __gcov_dump(); #endif retval= kill(getpid(), SIGKILL); @@ -2262,7 +2262,7 @@ my_bool _db_my_assert(const char *file, int line, const char *msg) fprintf(stderr, "%s:%d: assert: %s\n", file, line, msg); fflush(stderr); #ifdef HAVE_gcov - __gcov_flush(); + __gcov_dump(); #endif } return a; diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 844d8a0b28f..f203bba4d8d 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -34,6 +34,9 @@ #include #endif +#ifdef HAVE_gcov +#include +#endif /** Default handler for printing stacktrace */ @@ -409,9 +412,6 @@ end: /* Produce a core for the thread */ void my_write_core(int sig) { -#ifdef HAVE_gcov - extern void __gcov_flush(void); -#endif signal(sig, SIG_DFL); #ifdef HAVE_gcov /* @@ -419,7 +419,7 @@ void my_write_core(int sig) information from this process, causing gcov output to be incomplete. So we force the writing of coverage information here before terminating. */ - __gcov_flush(); + __gcov_dump(); #endif pthread_kill(pthread_self(), sig); #if defined(P_MYID) && !defined(SCO)