Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Masahiro Yamada | 59f5385 | 2018-05-28 18:22:06 +0900 | [diff] [blame] | 2 | gcc-plugin-$(CONFIG_GCC_PLUGIN_CYC_COMPLEXITY) += cyc_complexity_plugin.so |
Emese Revfy | 6b90bd4 | 2016-05-24 00:09:38 +0200 | [diff] [blame] | 3 | |
Masahiro Yamada | 59f5385 | 2018-05-28 18:22:06 +0900 | [diff] [blame] | 4 | gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) += latent_entropy_plugin.so |
| 5 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) += -DLATENT_ENTROPY_PLUGIN |
| 6 | ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY |
Emese Revfy | 38addce | 2016-06-20 20:41:19 +0200 | [diff] [blame] | 7 | DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable |
Emese Revfy | 6b90bd4 | 2016-05-24 00:09:38 +0200 | [diff] [blame] | 8 | endif |
Kees Cook | ed58c0e | 2016-06-17 23:11:12 -0700 | [diff] [blame] | 9 | |
Masahiro Yamada | 59f5385 | 2018-05-28 18:22:06 +0900 | [diff] [blame] | 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) += -fplugin-arg-structleak_plugin-verbose |
| 13 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) += -fplugin-arg-structleak_plugin-byref-all |
| 14 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += -DSTRUCTLEAK_PLUGIN |
| 15 | |
| 16 | gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so |
| 17 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += -DRANDSTRUCT_PLUGIN |
| 18 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE) += -fplugin-arg-randomize_layout_plugin-performance-mode |
| 19 | |
| 20 | GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) |
| 21 | |
| 22 | export GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR |
| 23 | export DISABLE_LATENT_ENTROPY_PLUGIN |
| 24 | |
| 25 | # sancov_plugin.so can be only in CFLAGS_KCOV because avoid duplication. |
| 26 | GCC_PLUGINS_CFLAGS := $(filter-out %/sancov_plugin.so, $(GCC_PLUGINS_CFLAGS)) |
| 27 | |
| 28 | KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS) |
| 29 | GCC_PLUGIN := $(gcc-plugin-y) |
| 30 | GCC_PLUGIN_SUBDIR := $(gcc-plugin-subdir-y) |
Kees Cook | ed58c0e | 2016-06-17 23:11:12 -0700 | [diff] [blame] | 31 | |
| 32 | # Actually do the build, if requested. |
| 33 | PHONY += gcc-plugins |
Masahiro Yamada | 59f5385 | 2018-05-28 18:22:06 +0900 | [diff] [blame] | 34 | gcc-plugins: scripts_basic |
Kees Cook | ed58c0e | 2016-06-17 23:11:12 -0700 | [diff] [blame] | 35 | ifdef CONFIG_GCC_PLUGINS |
| 36 | $(Q)$(MAKE) $(build)=scripts/gcc-plugins |
| 37 | endif |
| 38 | @: |