Skip to content

Commit 40249c6

Browse files
oberpartorvalds
authored andcommitted
gcov: add support for GCC 10.1
Using gcov to collect coverage data for kernels compiled with GCC 10.1 causes random malfunctions and kernel crashes. This is the result of a changed GCOV_COUNTERS value in GCC 10.1 that causes a mismatch between the layout of the gcov_info structure created by GCC profiling code and the related structure used by the kernel. Fix this by updating the in-kernel GCOV_COUNTERS value. Also re-enable config GCOV_KERNEL for use with GCC 10. Reported-by: Colin Ian King <[email protected]> Reported-by: Leon Romanovsky <[email protected]> Signed-off-by: Peter Oberparleiter <[email protected]> Tested-by: Leon Romanovsky <[email protected]> Tested-and-Acked-by: Colin Ian King <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 581cb3a commit 40249c6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

kernel/gcov/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ menu "GCOV-based kernel profiling"
44
config GCOV_KERNEL
55
bool "Enable gcov-based kernel profiling"
66
depends on DEBUG_FS
7-
depends on !CC_IS_GCC || GCC_VERSION < 100000
87
select CONSTRUCTORS if !UML
98
default n
109
help

kernel/gcov/gcc_4_7.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#include <linux/vmalloc.h>
2020
#include "gcov.h"
2121

22-
#if (__GNUC__ >= 7)
22+
#if (__GNUC__ >= 10)
23+
#define GCOV_COUNTERS 8
24+
#elif (__GNUC__ >= 7)
2325
#define GCOV_COUNTERS 9
2426
#elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
2527
#define GCOV_COUNTERS 10

0 commit comments

Comments
 (0)