diff --git a/cmake/profile.cmake b/cmake/profile.cmake
index 0c40ad834a663e4ea164d32ad4da7e9f678b4ff7..16492efb160ff9a737670ba3f5aa5f6ddc30d3fd 100644
--- a/cmake/profile.cmake
+++ b/cmake/profile.cmake
@@ -1,5 +1,12 @@
 set(CMAKE_REQUIRED_FLAGS "-fprofile-arcs -ftest-coverage")
-check_library_exists("" __gcov_flush "" HAVE_GCOV)
+if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 11)
+    check_library_exists("" __gcov_dump "" HAVE_GCOV)
+    if (HAVE_GCOV)
+        check_library_exists("" __gcov_reset "" HAVE_GCOV)
+      endif()
+else()
+    check_library_exists("" __gcov_flush "" HAVE_GCOV)
+endif()
 set(CMAKE_REQUIRED_FLAGS "")
 
 set(ENABLE_GCOV_DEFAULT OFF)
diff --git a/src/main.cc b/src/main.cc
index 0bcd5699baeb64cd1f616db105586f6b266dec28..23a50f2ee16e65f5968f14059ca4b0d8780fbf6a 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -567,7 +567,7 @@ tarantool_free(void)
 	free(pid_file);
 	signal_free();
 #ifdef ENABLE_GCOV
-	__gcov_flush();
+	gcov_flush();
 #endif
 	cbus_free();
 #if 0
diff --git a/src/trivia/util.h b/src/trivia/util.h
index 1fd2dfed10e58f3c9dcc2a02184d6ce8d323e31c..06192fe895a5d8145583fa3c212627e2ccb5df83 100644
--- a/src/trivia/util.h
+++ b/src/trivia/util.h
@@ -420,7 +420,32 @@ strnindex(const char *const *haystack, const char *needle, uint32_t len,
 
 void close_all_xcpt(int fdc, ...);
 
-void __gcov_flush();
+#if defined(__GNUC__) && __GNUC__ >= 11
+/** Import __gcov_dump function. */
+void
+__gcov_dump(void);
+
+/** Import __gcov_reset function. */
+void
+__gcov_reset(void);
+
+static inline void
+gcov_flush(void)
+{
+	__gcov_dump();
+	__gcov_reset();
+}
+#else
+/** Import __gcov_flush function. */
+void
+__gcov_flush(void);
+
+static inline void
+gcov_flush(void)
+{
+	__gcov_flush();
+}
+#endif
 
 /**
  * Async-signal-safe implementation of printf(), to