1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

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 <m_string.h>
#include <errno.h> #include <errno.h>
#ifdef HAVE_gcov #ifdef HAVE_gcov
extern void __gcov_flush(); #include <gcov.h>
#endif #endif
#ifndef DBUG_OFF #ifndef DBUG_OFF
@@ -2212,7 +2212,7 @@ void _db_suicide_()
fprintf(stderr, "SIGKILL myself\n"); fprintf(stderr, "SIGKILL myself\n");
fflush(stderr); fflush(stderr);
#ifdef HAVE_gcov #ifdef HAVE_gcov
__gcov_flush(); __gcov_dump();
#endif #endif
retval= kill(getpid(), SIGKILL); 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); fprintf(stderr, "%s:%d: assert: %s\n", file, line, msg);
fflush(stderr); fflush(stderr);
#ifdef HAVE_gcov #ifdef HAVE_gcov
__gcov_flush(); __gcov_dump();
#endif #endif
} }
return a; return a;

View File

@@ -34,6 +34,9 @@
#include <execinfo.h> #include <execinfo.h>
#endif #endif
#ifdef HAVE_gcov
#include <gcov.h>
#endif
/** /**
Default handler for printing stacktrace Default handler for printing stacktrace
*/ */
@@ -409,9 +412,6 @@ end:
/* Produce a core for the thread */ /* Produce a core for the thread */
void my_write_core(int sig) void my_write_core(int sig)
{ {
#ifdef HAVE_gcov
extern void __gcov_flush(void);
#endif
signal(sig, SIG_DFL); signal(sig, SIG_DFL);
#ifdef HAVE_gcov #ifdef HAVE_gcov
/* /*
@@ -419,7 +419,7 @@ void my_write_core(int sig)
information from this process, causing gcov output to be incomplete. information from this process, causing gcov output to be incomplete.
So we force the writing of coverage information here before terminating. So we force the writing of coverage information here before terminating.
*/ */
__gcov_flush(); __gcov_dump();
#endif #endif
pthread_kill(pthread_self(), sig); pthread_kill(pthread_self(), sig);
#if defined(P_MYID) && !defined(SCO) #if defined(P_MYID) && !defined(SCO)