xref: /linux/scripts/Makefile.gcc-plugins (revision 8e736a2eeaf261213b4557778e015699da1e1c8c)
1# SPDX-License-Identifier: GPL-2.0
2
3gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY)	+= latent_entropy_plugin.so
4gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY)		\
5		+= -DLATENT_ENTROPY_PLUGIN
6ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
7    DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable -ULATENT_ENTROPY_PLUGIN
8endif
9export DISABLE_LATENT_ENTROPY_PLUGIN
10
11# All the plugin CFLAGS are collected here in case a build target needs to
12# filter them out of the KBUILD_CFLAGS.
13GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) -DGCC_PLUGINS
14export GCC_PLUGINS_CFLAGS
15
16# Add the flags to the build!
17KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
18
19# Some plugins are enabled outside of this Makefile, but they still need to
20# be included in GCC_PLUGIN so they can get built.
21gcc-plugin-external-$(CONFIG_GCC_PLUGIN_RANDSTRUCT)		\
22	+= randomize_layout_plugin.so
23gcc-plugin-external-$(CONFIG_GCC_PLUGIN_STACKLEAK)		\
24	+= stackleak_plugin.so
25
26# All enabled GCC plugins are collected here for building in
27# scripts/gcc-scripts/Makefile.
28GCC_PLUGIN := $(gcc-plugin-y) $(gcc-plugin-external-y)
29export GCC_PLUGIN
30