Skip to content

Commit 29b4bd4

Browse files
committed
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.
1 parent 9f16d15 commit 29b4bd4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

dbug/dbug.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
#include <m_string.h>
8787
#include <errno.h>
8888
#ifdef HAVE_gcov
89-
extern void __gcov_flush();
89+
#include <gcov.h>
9090
#endif
9191

9292
#ifndef DBUG_OFF
@@ -2212,7 +2212,7 @@ void _db_suicide_()
22122212
fprintf(stderr, "SIGKILL myself\n");
22132213
fflush(stderr);
22142214
#ifdef HAVE_gcov
2215-
__gcov_flush();
2215+
__gcov_dump();
22162216
#endif
22172217

22182218
retval= kill(getpid(), SIGKILL);
@@ -2262,7 +2262,7 @@ my_bool _db_my_assert(const char *file, int line, const char *msg)
22622262
fprintf(stderr, "%s:%d: assert: %s\n", file, line, msg);
22632263
fflush(stderr);
22642264
#ifdef HAVE_gcov
2265-
__gcov_flush();
2265+
__gcov_dump();
22662266
#endif
22672267
}
22682268
return a;

mysys/stacktrace.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
#include <execinfo.h>
3535
#endif
3636

37+
#ifdef HAVE_gcov
38+
#include <gcov.h>
39+
#endif
3740
/**
3841
Default handler for printing stacktrace
3942
*/
@@ -409,17 +412,14 @@ void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack,
409412
/* Produce a core for the thread */
410413
void my_write_core(int sig)
411414
{
412-
#ifdef HAVE_gcov
413-
extern void __gcov_flush(void);
414-
#endif
415415
signal(sig, SIG_DFL);
416416
#ifdef HAVE_gcov
417417
/*
418418
For GCOV build, crashing will prevent the writing of code coverage
419419
information from this process, causing gcov output to be incomplete.
420420
So we force the writing of coverage information here before terminating.
421421
*/
422-
__gcov_flush();
422+
__gcov_dump();
423423
#endif
424424
pthread_kill(pthread_self(), sig);
425425
#if defined(P_MYID) && !defined(SCO)

0 commit comments

Comments
 (0)