Makefile.gcc-plugins 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # SPDX-License-Identifier: GPL-2.0
  2. gcc-plugin-$(CONFIG_GCC_PLUGIN_CYC_COMPLEXITY) += cyc_complexity_plugin.so
  3. gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) += latent_entropy_plugin.so
  4. gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) \
  5. += -DLATENT_ENTROPY_PLUGIN
  6. ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
  7. DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable
  8. endif
  9. export DISABLE_LATENT_ENTROPY_PLUGIN
  10. gcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV) += sancov_plugin.so
  11. gcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += structleak_plugin.so
  12. gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE) \
  13. += -fplugin-arg-structleak_plugin-verbose
  14. gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) \
  15. += -fplugin-arg-structleak_plugin-byref-all
  16. gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) \
  17. += -DSTRUCTLEAK_PLUGIN
  18. gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so
  19. gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) \
  20. += -DRANDSTRUCT_PLUGIN
  21. gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE) \
  22. += -fplugin-arg-randomize_layout_plugin-performance-mode
  23. # All the plugin CFLAGS are collected here in case a build target needs to
  24. # filter them out of the KBUILD_CFLAGS.
  25. GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))
  26. # The sancov_plugin.so is included via CFLAGS_KCOV, so it is removed here.
  27. GCC_PLUGINS_CFLAGS := $(filter-out %/sancov_plugin.so, $(GCC_PLUGINS_CFLAGS))
  28. export GCC_PLUGINS_CFLAGS
  29. # Add the flags to the build!
  30. KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
  31. # All enabled GCC plugins are collected here for building below.
  32. GCC_PLUGIN := $(gcc-plugin-y)
  33. export GCC_PLUGIN
  34. # Actually do the build, if requested.
  35. PHONY += gcc-plugins
  36. gcc-plugins: scripts_basic
  37. ifdef CONFIG_GCC_PLUGINS
  38. $(Q)$(MAKE) $(build)=scripts/gcc-plugins
  39. endif
  40. @: