Skip to content

Commit 20d38f7

Browse files
tklauserpalmer-dabbelt
authored andcommitted
riscv: Allow building with kcov coverage
Add ARCH_HAS_KCOV and HAVE_GCC_PLUGINS to the riscv Kconfig. Also disable instrumentation of some early boot code and vdso. Boot-tested on QEMU's riscv64 virt machine. Signed-off-by: Tobias Klauser <[email protected]> Acked-by: Dmitry Vyukov <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent ed48b29 commit 20d38f7

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

arch/riscv/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ config RISCV
1919
select ARCH_HAS_DEBUG_WX
2020
select ARCH_HAS_GCOV_PROFILE_ALL
2121
select ARCH_HAS_GIGANTIC_PAGE
22+
select ARCH_HAS_KCOV
2223
select ARCH_HAS_MMIOWB
2324
select ARCH_HAS_PTE_SPECIAL
2425
select ARCH_HAS_SET_DIRECT_MAP
@@ -58,6 +59,7 @@ config RISCV
5859
select HAVE_DMA_CONTIGUOUS if MMU
5960
select HAVE_EBPF_JIT if MMU
6061
select HAVE_FUTEX_CMPXCHG if FUTEX
62+
select HAVE_GCC_PLUGINS
6163
select HAVE_GENERIC_VDSO if MMU && 64BIT
6264
select HAVE_PCI
6365
select HAVE_PERF_EVENTS

arch/riscv/boot/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# Based on the ia64 and arm64 boot/Makefile.
1515
#
1616

17+
KCOV_INSTRUMENT := n
18+
1719
OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
1820

1921
targets := Image loader

arch/riscv/kernel/vdso/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
3232

3333
# Disable gcov profiling for VDSO code
3434
GCOV_PROFILE := n
35+
KCOV_INSTRUMENT := n
3536

3637
# Force dependency
3738
$(obj)/vdso.o: $(obj)/vdso.so

arch/riscv/mm/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ ifdef CONFIG_FTRACE
55
CFLAGS_REMOVE_init.o = -pg
66
endif
77

8+
KCOV_INSTRUMENT_init.o := n
9+
810
obj-y += init.o
911
obj-y += extable.o
1012
obj-$(CONFIG_MMU) += fault.o pageattr.o

0 commit comments

Comments
 (0)