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.
This commit is contained in:
Daniel Black 2023-02-06 19:16:15 +11:00
parent 9f16d15357
commit 29b4bd4ea9
2 changed files with 7 additions and 7 deletions

View file

@ -86,7 +86,7 @@
#include <m_string.h>
#include <errno.h>
#ifdef HAVE_gcov
extern void __gcov_flush();
#include <gcov.h>
#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;

View file

@ -34,6 +34,9 @@
#include <execinfo.h>
#endif
#ifdef HAVE_gcov
#include <gcov.h>
#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)