blob: c961b9a65d11ac7954b2a5a3b0826f6a5697063a [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Masahiro Yamada59f53852018-05-28 18:22:06 +09002gcc-plugin-$(CONFIG_GCC_PLUGIN_CYC_COMPLEXITY) += cyc_complexity_plugin.so
Emese Revfy6b90bd42016-05-24 00:09:38 +02003
Masahiro Yamada59f53852018-05-28 18:22:06 +09004gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) += latent_entropy_plugin.so
5gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) += -DLATENT_ENTROPY_PLUGIN
6ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
Emese Revfy38addce2016-06-20 20:41:19 +02007 DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable
Emese Revfy6b90bd42016-05-24 00:09:38 +02008endif
Kees Cooked58c0e2016-06-17 23:11:12 -07009
Masahiro Yamada59f53852018-05-28 18:22:06 +090010gcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV) += sancov_plugin.so
11gcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += structleak_plugin.so
12gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE) += -fplugin-arg-structleak_plugin-verbose
13gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) += -fplugin-arg-structleak_plugin-byref-all
14gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += -DSTRUCTLEAK_PLUGIN
15
16gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so
17gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += -DRANDSTRUCT_PLUGIN
18gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE) += -fplugin-arg-randomize_layout_plugin-performance-mode
19
20GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))
21
22export GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR
23export DISABLE_LATENT_ENTROPY_PLUGIN
24
25# sancov_plugin.so can be only in CFLAGS_KCOV because avoid duplication.
26GCC_PLUGINS_CFLAGS := $(filter-out %/sancov_plugin.so, $(GCC_PLUGINS_CFLAGS))
27
28KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
29GCC_PLUGIN := $(gcc-plugin-y)
30GCC_PLUGIN_SUBDIR := $(gcc-plugin-subdir-y)
Kees Cooked58c0e2016-06-17 23:11:12 -070031
32# Actually do the build, if requested.
33PHONY += gcc-plugins
Masahiro Yamada59f53852018-05-28 18:22:06 +090034gcc-plugins: scripts_basic
Kees Cooked58c0e2016-06-17 23:11:12 -070035ifdef CONFIG_GCC_PLUGINS
36 $(Q)$(MAKE) $(build)=scripts/gcc-plugins
37endif
38 @: