18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_cigcc-plugin-$(CONFIG_GCC_PLUGIN_CYC_COMPLEXITY)	+= cyc_complexity_plugin.so
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_cigcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY)	+= latent_entropy_plugin.so
68c2ecf20Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY)		\
78c2ecf20Sopenharmony_ci		+= -DLATENT_ENTROPY_PLUGIN
88c2ecf20Sopenharmony_ciifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
98c2ecf20Sopenharmony_ci    DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable -ULATENT_ENTROPY_PLUGIN
108c2ecf20Sopenharmony_ciendif
118c2ecf20Sopenharmony_ciexport DISABLE_LATENT_ENTROPY_PLUGIN
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cigcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV)		+= sancov_plugin.so
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cigcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK)	+= structleak_plugin.so
168c2ecf20Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE)	\
178c2ecf20Sopenharmony_ci		+= -fplugin-arg-structleak_plugin-verbose
188c2ecf20Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF)		\
198c2ecf20Sopenharmony_ci		+= -fplugin-arg-structleak_plugin-byref
208c2ecf20Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL)	\
218c2ecf20Sopenharmony_ci		+= -fplugin-arg-structleak_plugin-byref-all
228c2ecf20Sopenharmony_ciifdef CONFIG_GCC_PLUGIN_STRUCTLEAK
238c2ecf20Sopenharmony_ci    DISABLE_STRUCTLEAK_PLUGIN += -fplugin-arg-structleak_plugin-disable
248c2ecf20Sopenharmony_ciendif
258c2ecf20Sopenharmony_ciexport DISABLE_STRUCTLEAK_PLUGIN
268c2ecf20Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK)		\
278c2ecf20Sopenharmony_ci		+= -DSTRUCTLEAK_PLUGIN
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cigcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT)	+= randomize_layout_plugin.so
308c2ecf20Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT)		\
318c2ecf20Sopenharmony_ci		+= -DRANDSTRUCT_PLUGIN
328c2ecf20Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE)	\
338c2ecf20Sopenharmony_ci		+= -fplugin-arg-randomize_layout_plugin-performance-mode
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_cigcc-plugin-$(CONFIG_GCC_PLUGIN_STACKLEAK)	+= stackleak_plugin.so
368c2ecf20Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK)		\
378c2ecf20Sopenharmony_ci		+= -DSTACKLEAK_PLUGIN
388c2ecf20Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK)		\
398c2ecf20Sopenharmony_ci		+= -fplugin-arg-stackleak_plugin-track-min-size=$(CONFIG_STACKLEAK_TRACK_MIN_SIZE)
408c2ecf20Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK)		\
418c2ecf20Sopenharmony_ci		+= -fplugin-arg-stackleak_plugin-arch=$(SRCARCH)
428c2ecf20Sopenharmony_ciifdef CONFIG_GCC_PLUGIN_STACKLEAK
438c2ecf20Sopenharmony_ci    DISABLE_STACKLEAK_PLUGIN += -fplugin-arg-stackleak_plugin-disable
448c2ecf20Sopenharmony_ciendif
458c2ecf20Sopenharmony_ciexport DISABLE_STACKLEAK_PLUGIN
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_cigcc-plugin-$(CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK) += arm_ssp_per_task_plugin.so
488c2ecf20Sopenharmony_ciifdef CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK
498c2ecf20Sopenharmony_ci    DISABLE_ARM_SSP_PER_TASK_PLUGIN += -fplugin-arg-arm_ssp_per_task_plugin-disable
508c2ecf20Sopenharmony_ciendif
518c2ecf20Sopenharmony_ciexport DISABLE_ARM_SSP_PER_TASK_PLUGIN
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci# All the plugin CFLAGS are collected here in case a build target needs to
548c2ecf20Sopenharmony_ci# filter them out of the KBUILD_CFLAGS.
558c2ecf20Sopenharmony_ciGCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))
568c2ecf20Sopenharmony_ci# The sancov_plugin.so is included via CFLAGS_KCOV, so it is removed here.
578c2ecf20Sopenharmony_ciGCC_PLUGINS_CFLAGS := $(filter-out %/sancov_plugin.so, $(GCC_PLUGINS_CFLAGS))
588c2ecf20Sopenharmony_ciexport GCC_PLUGINS_CFLAGS
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci# Add the flags to the build!
618c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci# All enabled GCC plugins are collected here for building below.
648c2ecf20Sopenharmony_ciGCC_PLUGIN := $(gcc-plugin-y)
658c2ecf20Sopenharmony_ciexport GCC_PLUGIN
66