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 738addce8SEmese Revfy DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable 838addce8SEmese Revfyendif 95aadfdebSMasahiro Yamadaexport DISABLE_LATENT_ENTROPY_PLUGIN 106b90bd4bSEmese Revfy 117ccb95e8SKees Cookgcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV) += sancov_plugin.so 126b90bd4bSEmese Revfy 137ccb95e8SKees Cookgcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += structleak_plugin.so 147ccb95e8SKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE) \ 157ccb95e8SKees Cook += -fplugin-arg-structleak_plugin-verbose 1681a56f6dSKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF) \ 1781a56f6dSKees Cook += -fplugin-arg-structleak_plugin-byref 187ccb95e8SKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) \ 197ccb95e8SKees Cook += -fplugin-arg-structleak_plugin-byref-all 20554afc3bSBrendan Higginsifdef CONFIG_GCC_PLUGIN_STRUCTLEAK 21554afc3bSBrendan Higgins DISABLE_STRUCTLEAK_PLUGIN += -fplugin-arg-structleak_plugin-disable 22554afc3bSBrendan Higginsendif 23554afc3bSBrendan Higginsexport DISABLE_STRUCTLEAK_PLUGIN 247ccb95e8SKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) \ 257ccb95e8SKees Cook += -DSTRUCTLEAK_PLUGIN 267ccb95e8SKees Cook 277ccb95e8SKees Cookgcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so 287ccb95e8SKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) \ 297ccb95e8SKees Cook += -DRANDSTRUCT_PLUGIN 307ccb95e8SKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE) \ 317ccb95e8SKees Cook += -fplugin-arg-randomize_layout_plugin-performance-mode 327ccb95e8SKees Cook 3310e9ae9fSAlexander Popovgcc-plugin-$(CONFIG_GCC_PLUGIN_STACKLEAK) += stackleak_plugin.so 3410e9ae9fSAlexander Popovgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \ 3510e9ae9fSAlexander Popov += -DSTACKLEAK_PLUGIN 3610e9ae9fSAlexander Popovgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \ 3710e9ae9fSAlexander Popov += -fplugin-arg-stackleak_plugin-track-min-size=$(CONFIG_STACKLEAK_TRACK_MIN_SIZE) 38feee1b8cSAlexander Popovgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK) \ 39feee1b8cSAlexander Popov += -fplugin-arg-stackleak_plugin-arch=$(SRCARCH) 40*f154066bSKees Cookgcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK_VERBOSE) \ 41*f154066bSKees Cook += -fplugin-arg-stackleak_plugin-verbose 4210e9ae9fSAlexander Popovifdef CONFIG_GCC_PLUGIN_STACKLEAK 4310e9ae9fSAlexander Popov DISABLE_STACKLEAK_PLUGIN += -fplugin-arg-stackleak_plugin-disable 4410e9ae9fSAlexander Popovendif 4510e9ae9fSAlexander Popovexport DISABLE_STACKLEAK_PLUGIN 4610e9ae9fSAlexander Popov 47189af465SArd Biesheuvelgcc-plugin-$(CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK) += arm_ssp_per_task_plugin.so 48189af465SArd Biesheuvelifdef CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK 49189af465SArd Biesheuvel DISABLE_ARM_SSP_PER_TASK_PLUGIN += -fplugin-arg-arm_ssp_per_task_plugin-disable 50189af465SArd Biesheuvelendif 51189af465SArd Biesheuvelexport DISABLE_ARM_SSP_PER_TASK_PLUGIN 52189af465SArd Biesheuvel 537ccb95e8SKees Cook# All the plugin CFLAGS are collected here in case a build target needs to 547ccb95e8SKees Cook# filter them out of the KBUILD_CFLAGS. 557ccb95e8SKees CookGCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) 567ccb95e8SKees Cook# The sancov_plugin.so is included via CFLAGS_KCOV, so it is removed here. 577ccb95e8SKees CookGCC_PLUGINS_CFLAGS := $(filter-out %/sancov_plugin.so, $(GCC_PLUGINS_CFLAGS)) 587ccb95e8SKees Cookexport GCC_PLUGINS_CFLAGS 597ccb95e8SKees Cook 607ccb95e8SKees Cook# Add the flags to the build! 616b90bd4bSEmese RevfyKBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS) 627ccb95e8SKees Cook 637ccb95e8SKees Cook# All enabled GCC plugins are collected here for building below. 646b90bd4bSEmese RevfyGCC_PLUGIN := $(gcc-plugin-y) 657ccb95e8SKees Cookexport GCC_PLUGIN 66