[PATCH] riscv: enable kcov
Dmitry Vyukov
dvyukov at google.com
Thu Jun 25 14:45:55 EDT 2020
On Thu, Jun 25, 2020 at 8:39 PM Tobias Klauser <tklauser at distanz.ch> wrote:
>
> Add ARCH_HAS_KCOV and HAVE_GCC_PLUGINS to the riscv Kconfig.
> Also disable instrumentation of vdso.
>
> Cc: Björn Töpel <bjorn.topel at gmail.com>
> Cc: Dmitry Vyukov <dvyukov at google.com>
> Signed-off-by: Tobias Klauser <tklauser at distanz.ch>
If it boots:
Acked-by: Dmitry Vyukov <dvyukov at google.com>
FWIW for x86 we needed to do much more of this:
$ find arch/x86/ -name Makefile -exec grep KCOV_INSTRUMENT {} \; -print
KCOV_INSTRUMENT := n
arch/x86/kernel/Makefile
KCOV_INSTRUMENT := n
arch/x86/kernel/apic/Makefile
KCOV_INSTRUMENT_common.o := n
KCOV_INSTRUMENT_perf_event.o := n
arch/x86/kernel/cpu/Makefile
KCOV_INSTRUMENT := n
arch/x86/realmode/rm/Makefile
KCOV_INSTRUMENT := n
arch/x86/boot/Makefile
KCOV_INSTRUMENT := n
arch/x86/boot/compressed/Makefile
KCOV_INSTRUMENT := n
arch/x86/entry/Makefile
KCOV_INSTRUMENT := n
arch/x86/entry/vdso/Makefile
KCOV_INSTRUMENT := n
arch/x86/um/vdso/Makefile
KCOV_INSTRUMENT_delay.o := n
KCOV_INSTRUMENT_cmdline.o := n
arch/x86/lib/Makefile
KCOV_INSTRUMENT_tlb.o := n
KCOV_INSTRUMENT_mem_encrypt.o := n
KCOV_INSTRUMENT_mem_encrypt_identity.o := n
arch/x86/mm/Makefile
KCOV_INSTRUMENT := n
arch/x86/purgatory/Makefile
> ---
> arch/riscv/Kconfig | 2 ++
> arch/riscv/kernel/vdso/Makefile | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 089293e4ad46..a7d7f8184f15 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -19,6 +19,7 @@ config RISCV
> select ARCH_HAS_DEBUG_WX
> select ARCH_HAS_GCOV_PROFILE_ALL
> select ARCH_HAS_GIGANTIC_PAGE
> + select ARCH_HAS_KCOV
> select ARCH_HAS_MMIOWB
> select ARCH_HAS_PTE_SPECIAL
> select ARCH_HAS_SET_DIRECT_MAP
> @@ -57,6 +58,7 @@ config RISCV
> select HAVE_DMA_CONTIGUOUS if MMU
> select HAVE_EBPF_JIT if MMU
> select HAVE_FUTEX_CMPXCHG if FUTEX
> + select HAVE_GCC_PLUGINS
> select HAVE_GENERIC_VDSO if MMU && 64BIT
> select HAVE_PCI
> select HAVE_PERF_EVENTS
> diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
> index 38ba55b0eb9d..9debbaab393d 100644
> --- a/arch/riscv/kernel/vdso/Makefile
> +++ b/arch/riscv/kernel/vdso/Makefile
> @@ -29,6 +29,7 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
>
> # Disable gcov profiling for VDSO code
> GCOV_PROFILE := n
> +KCOV_INSTRUMENT := n
>
> # Force dependency
> $(obj)/vdso.o: $(obj)/vdso.so
> --
> 2.27.0
>
More information about the linux-riscv
mailing list