b24413180f560 (Greg Kroah-Hartman 2017-11-01 15:07:57 +0100 1) # SPDX-License-Identifier: GPL-2.0
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 2)
59f53855babf7 (Masahiro Yamada 2018-05-28 18:22:06 +0900 3) gcc-plugin-$(CONFIG_GCC_PLUGIN_CYC_COMPLEXITY) += cyc_complexity_plugin.so
543c37cb16504 (Emese Revfy 2016-05-24 00:11:37 +0200 4)
59f53855babf7 (Masahiro Yamada 2018-05-28 18:22:06 +0900 5) gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) += latent_entropy_plugin.so
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 6) gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) \
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 7) += -DLATENT_ENTROPY_PLUGIN
59f53855babf7 (Masahiro Yamada 2018-05-28 18:22:06 +0900 8) ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 9) DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable
59f53855babf7 (Masahiro Yamada 2018-05-28 18:22:06 +0900 10) endif
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 11) export DISABLE_LATENT_ENTROPY_PLUGIN
c61f13eaa1ee1 (Kees Cook 2017-01-13 11:14:39 -0800 12)
59f53855babf7 (Masahiro Yamada 2018-05-28 18:22:06 +0900 13) gcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV) += sancov_plugin.so
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 14)
59f53855babf7 (Masahiro Yamada 2018-05-28 18:22:06 +0900 15) gcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += structleak_plugin.so
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 16) gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE) \
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 17) += -fplugin-arg-structleak_plugin-verbose
81a56f6dcd203 (Kees Cook 2019-01-23 15:19:29 -0800 18) gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF) \
81a56f6dcd203 (Kees Cook 2019-01-23 15:19:29 -0800 19) += -fplugin-arg-structleak_plugin-byref
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 20) gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) \
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 21) += -fplugin-arg-structleak_plugin-byref-all
554afc3b97975 (Brendan Higgins 2021-09-29 14:27:09 -0700 22) ifdef CONFIG_GCC_PLUGIN_STRUCTLEAK
554afc3b97975 (Brendan Higgins 2021-09-29 14:27:09 -0700 23) DISABLE_STRUCTLEAK_PLUGIN += -fplugin-arg-structleak_plugin-disable
554afc3b97975 (Brendan Higgins 2021-09-29 14:27:09 -0700 24) endif
554afc3b97975 (Brendan Higgins 2021-09-29 14:27:09 -0700 25) export DISABLE_STRUCTLEAK_PLUGIN
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 26) gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) \
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 27) += -DSTRUCTLEAK_PLUGIN
313dd1b629219 (Kees Cook 2017-05-05 23:37:45 -0700 28)
59f53855babf7 (Masahiro Yamada 2018-05-28 18:22:06 +0900 29) gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 30) gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) \
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 31) += -DRANDSTRUCT_PLUGIN
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 32) gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE) \
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 33) += -fplugin-arg-randomize_layout_plugin-performance-mode
6b90bd4ba40b3 (Emese Revfy 2016-05-24 00:09:38 +0200 34)
10e9ae9fabaf9 (Alexander Popov 2018-08-17 01:16:59 +0300 35) gcc-plugin-$(CONFIG_GCC_PLUGIN_STACKLEAK) += stackleak_plugin.so
10e9ae9fabaf9 (Alexander Popov 2018-08-17 01:16:59 +0300 36) gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
10e9ae9fabaf9 (Alexander Popov 2018-08-17 01:16:59 +0300 37) += -DSTACKLEAK_PLUGIN
10e9ae9fabaf9 (Alexander Popov 2018-08-17 01:16:59 +0300 38) gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
10e9ae9fabaf9 (Alexander Popov 2018-08-17 01:16:59 +0300 39) += -fplugin-arg-stackleak_plugin-track-min-size=$(CONFIG_STACKLEAK_TRACK_MIN_SIZE)
feee1b8c49082 (Alexander Popov 2020-06-24 15:33:29 +0300 40) gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \
feee1b8c49082 (Alexander Popov 2020-06-24 15:33:29 +0300 41) += -fplugin-arg-stackleak_plugin-arch=$(SRCARCH)
10e9ae9fabaf9 (Alexander Popov 2018-08-17 01:16:59 +0300 42) ifdef CONFIG_GCC_PLUGIN_STACKLEAK
10e9ae9fabaf9 (Alexander Popov 2018-08-17 01:16:59 +0300 43) DISABLE_STACKLEAK_PLUGIN += -fplugin-arg-stackleak_plugin-disable
10e9ae9fabaf9 (Alexander Popov 2018-08-17 01:16:59 +0300 44) endif
10e9ae9fabaf9 (Alexander Popov 2018-08-17 01:16:59 +0300 45) export DISABLE_STACKLEAK_PLUGIN
10e9ae9fabaf9 (Alexander Popov 2018-08-17 01:16:59 +0300 46)
189af4657186d (Ard Biesheuvel 2018-12-06 09:32:57 +0100 47) gcc-plugin-$(CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK) += arm_ssp_per_task_plugin.so
189af4657186d (Ard Biesheuvel 2018-12-06 09:32:57 +0100 48) ifdef CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK
189af4657186d (Ard Biesheuvel 2018-12-06 09:32:57 +0100 49) DISABLE_ARM_SSP_PER_TASK_PLUGIN += -fplugin-arg-arm_ssp_per_task_plugin-disable
189af4657186d (Ard Biesheuvel 2018-12-06 09:32:57 +0100 50) endif
189af4657186d (Ard Biesheuvel 2018-12-06 09:32:57 +0100 51) export DISABLE_ARM_SSP_PER_TASK_PLUGIN
189af4657186d (Ard Biesheuvel 2018-12-06 09:32:57 +0100 52)
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 53) # All the plugin CFLAGS are collected here in case a build target needs to
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 54) # filter them out of the KBUILD_CFLAGS.
59f53855babf7 (Masahiro Yamada 2018-05-28 18:22:06 +0900 55) GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 56) # The sancov_plugin.so is included via CFLAGS_KCOV, so it is removed here.
59f53855babf7 (Masahiro Yamada 2018-05-28 18:22:06 +0900 57) GCC_PLUGINS_CFLAGS := $(filter-out %/sancov_plugin.so, $(GCC_PLUGINS_CFLAGS))
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 58) export GCC_PLUGINS_CFLAGS
ed58c0e9eefef (Kees Cook 2016-06-17 23:11:12 -0700 59)
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 60) # Add the flags to the build!
59f53855babf7 (Masahiro Yamada 2018-05-28 18:22:06 +0900 61) KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 62)
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 63) # All enabled GCC plugins are collected here for building below.
59f53855babf7 (Masahiro Yamada 2018-05-28 18:22:06 +0900 64) GCC_PLUGIN := $(gcc-plugin-y)
7ccb95e8fe913 (Kees Cook 2018-07-11 17:38:52 -0700 65) export GCC_PLUGIN