xref: /linux/scripts/Makefile.gcc-plugins (revision dee264c16a6334dcdbea5c186f5ff35f98b1df42)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
27ccb95e8SKees Cook
338addce8SEmese Revfygcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY)	+= latent_entropy_plugin.so
47ccb95e8SKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY)		\
57ccb95e8SKees Cook		+= -DLATENT_ENTROPY_PLUGIN
67b4010edSAndrew Donnellanifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
7012e8d20SAndrew Donnellan    DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable -ULATENT_ENTROPY_PLUGIN
838addce8SEmese Revfyendif
95aadfdebSMasahiro Yamadaexport DISABLE_LATENT_ENTROPY_PLUGIN
106b90bd4bSEmese Revfy
1110e9ae9fSAlexander Popovgcc-plugin-$(CONFIG_GCC_PLUGIN_STACKLEAK)	+= stackleak_plugin.so
1210e9ae9fSAlexander Popovgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK)		\
1310e9ae9fSAlexander Popov		+= -DSTACKLEAK_PLUGIN
1410e9ae9fSAlexander Popovgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK)		\
1510e9ae9fSAlexander Popov		+= -fplugin-arg-stackleak_plugin-track-min-size=$(CONFIG_STACKLEAK_TRACK_MIN_SIZE)
16feee1b8cSAlexander Popovgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK)		\
17feee1b8cSAlexander Popov		+= -fplugin-arg-stackleak_plugin-arch=$(SRCARCH)
18f154066bSKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK_VERBOSE)	\
19f154066bSKees Cook		+= -fplugin-arg-stackleak_plugin-verbose
2010e9ae9fSAlexander Popovifdef CONFIG_GCC_PLUGIN_STACKLEAK
2110e9ae9fSAlexander Popov    DISABLE_STACKLEAK_PLUGIN += -fplugin-arg-stackleak_plugin-disable
2210e9ae9fSAlexander Popovendif
2310e9ae9fSAlexander Popovexport DISABLE_STACKLEAK_PLUGIN
2410e9ae9fSAlexander Popov
257ccb95e8SKees Cook# All the plugin CFLAGS are collected here in case a build target needs to
267ccb95e8SKees Cook# filter them out of the KBUILD_CFLAGS.
27*0cecd37dSKees CookGCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) -DGCC_PLUGINS
287ccb95e8SKees Cookexport GCC_PLUGINS_CFLAGS
297ccb95e8SKees Cook
307ccb95e8SKees Cook# Add the flags to the build!
316b90bd4bSEmese RevfyKBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
327ccb95e8SKees Cook
33d3646589SKees Cook# Some plugins are enabled outside of this Makefile, but they still need to
34d3646589SKees Cook# be included in GCC_PLUGIN so they can get built.
35613f4b3eSKees Cookgcc-plugin-external-$(CONFIG_GCC_PLUGIN_RANDSTRUCT)		\
36613f4b3eSKees Cook	+= randomize_layout_plugin.so
37d3646589SKees Cook
38d3646589SKees Cook# All enabled GCC plugins are collected here for building in
39d3646589SKees Cook# scripts/gcc-scripts/Makefile.
40d3646589SKees CookGCC_PLUGIN := $(gcc-plugin-y) $(gcc-plugin-external-y)
417ccb95e8SKees Cookexport GCC_PLUGIN
42