Makefile.kcov 865 B

1234567891011121314151617181920212223242526
  1. ifdef CONFIG_KCOV
  2. ifeq ($(call cc-option, -fsanitize-coverage=trace-pc -Werror),)
  3. ifneq ($(CONFIG_COMPILE_TEST),y)
  4. $(error Cannot use CONFIG_KCOV: \
  5. -fsanitize-coverage=trace-pc is not supported by compiler)
  6. endif
  7. endif
  8. ifdef CONFIG_KCOV_ENABLE_COMPARISONS
  9. ifeq ($(call cc-option, -fsanitize-coverage=trace-cmp -Werror),)
  10. ifneq ($(CONFIG_COMPILE_TEST),y)
  11. $(error Cannot use CONFIG_KCOV_ENABLE_COMPARISONS: \
  12. -fsanitize-coverage=trace-cmp is not supported by compiler)
  13. endif
  14. endif
  15. endif
  16. kcov-flags-$(CONFIG_CC_HAS_SANCOV_TRACE_PC) += -fsanitize-coverage=trace-pc
  17. kcov-flags-$(CONFIG_KCOV_ENABLE_COMPARISONS) += -fsanitize-coverage=trace-cmp
  18. kcov-flags-$(CONFIG_GCC_PLUGIN_SANCOV) += -fplugin=$(objtree)/scripts/gcc-plugins/sancov_plugin.so
  19. export CFLAGS_KCOV := $(kcov-flags-y)
  20. endif