xref: /linux/scripts/Makefile.gcc-plugins (revision 59f53855babf757ac7be19995670ab884aaf9b71)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
20dae776cSEmese Revfygcc-plugin-$(CONFIG_GCC_PLUGIN_CYC_COMPLEXITY)	+= cyc_complexity_plugin.so
3543c37cbSEmese Revfy
438addce8SEmese Revfygcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY)	+= latent_entropy_plugin.so
538addce8SEmese Revfygcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY)	+= -DLATENT_ENTROPY_PLUGIN
67b4010edSAndrew Donnellanifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
738addce8SEmese Revfy    DISABLE_LATENT_ENTROPY_PLUGIN			+= -fplugin-arg-latent_entropy_plugin-disable
838addce8SEmese Revfyendif
938addce8SEmese Revfy
10543c37cbSEmese Revfygcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV)		+= sancov_plugin.so
11c61f13eaSKees Cookgcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK)	+= structleak_plugin.so
12c61f13eaSKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE)	+= -fplugin-arg-structleak_plugin-verbose
13f7dd2507SArd Biesheuvelgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL)	+= -fplugin-arg-structleak_plugin-byref-all
14c61f13eaSKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK)	+= -DSTRUCTLEAK_PLUGIN
15c61f13eaSKees Cook
16313dd1b6SKees Cookgcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT)	+= randomize_layout_plugin.so
17313dd1b6SKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT)	+= -DRANDSTRUCT_PLUGIN
18313dd1b6SKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE)	+= -fplugin-arg-randomize_layout_plugin-performance-mode
19313dd1b6SKees Cook
2065d59ec8SEmese RevfyGCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))
216b90bd4bSEmese Revfy
22*59f53855SMasahiro Yamadaexport GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR
235aadfdebSMasahiro Yamadaexport DISABLE_LATENT_ENTROPY_PLUGIN
246b90bd4bSEmese Revfy
25*59f53855SMasahiro Yamada# sancov_plugin.so can be only in CFLAGS_KCOV because avoid duplication.
26*59f53855SMasahiro YamadaGCC_PLUGINS_CFLAGS := $(filter-out %/sancov_plugin.so, $(GCC_PLUGINS_CFLAGS))
276b90bd4bSEmese Revfy
286b90bd4bSEmese RevfyKBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
296b90bd4bSEmese RevfyGCC_PLUGIN := $(gcc-plugin-y)
30caefd8c9SEmese RevfyGCC_PLUGIN_SUBDIR := $(gcc-plugin-subdir-y)
31ed58c0e9SKees Cook
32ed58c0e9SKees Cook# Actually do the build, if requested.
33ed58c0e9SKees CookPHONY += gcc-plugins
34*59f53855SMasahiro Yamadagcc-plugins: scripts_basic
35ed58c0e9SKees Cookifdef CONFIG_GCC_PLUGINS
36ed58c0e9SKees Cook	$(Q)$(MAKE) $(build)=scripts/gcc-plugins
37ed58c0e9SKees Cookendif
38ed58c0e9SKees Cook	@:
39