Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-30573

Server doesn't build with GCOV by GCC 11+

    XMLWordPrintable

Details

    Description

      10.6 9f16d1535

      /usr/bin/ld: libdbug.a(dbug.c.o): in function `_db_suicide_':
      /data/src/10.6-bug/dbug/dbug.c:2215: undefined reference to `__gcov_flush'
      /usr/bin/ld: libdbug.a(dbug.c.o): in function `_db_my_assert':
      /data/src/10.6-bug/dbug/dbug.c:2265: undefined reference to `__gcov_flush'
      collect2: error: ld returned 1 exit status
      make[2]: *** [dbug/CMakeFiles/tests.dir/build.make:104: dbug/tests] Error 1
      make[1]: *** [CMakeFiles/Makefile2:8982: dbug/CMakeFiles/tests.dir/all] Error 2
      make[1]: *** Waiting for unfinished jobs....
      

      The recipe from stackoverflow helps, but I don't know (didn't check) whether it will still build with older compilers.

      Recipe diff

      diff --git a/dbug/dbug.c b/dbug/dbug.c
      index a6d893e3f49..45809c521d6 100644
      --- a/dbug/dbug.c
      +++ b/dbug/dbug.c
      @@ -86,7 +86,7 @@
       #include <m_string.h>
       #include <errno.h>
       #ifdef HAVE_gcov
      -extern void __gcov_flush();
      +extern void __gcov_dump();
       #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..42a8c5f192e 100644
      --- a/mysys/stacktrace.c
      +++ b/mysys/stacktrace.c
      @@ -410,7 +410,7 @@ void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack,
       void my_write_core(int sig)
       {
       #ifdef HAVE_gcov
      -  extern void __gcov_flush(void);
      +  extern void __gcov_dump(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)
      

      Attachments

        Activity

          People

            danblack Daniel Black
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.