162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_cigcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY)	+= latent_entropy_plugin.so
462306a36Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY)		\
562306a36Sopenharmony_ci		+= -DLATENT_ENTROPY_PLUGIN
662306a36Sopenharmony_ciifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
762306a36Sopenharmony_ci    DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable -ULATENT_ENTROPY_PLUGIN
862306a36Sopenharmony_ciendif
962306a36Sopenharmony_ciexport DISABLE_LATENT_ENTROPY_PLUGIN
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_cigcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK)	+= structleak_plugin.so
1262306a36Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE)	\
1362306a36Sopenharmony_ci		+= -fplugin-arg-structleak_plugin-verbose
1462306a36Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF)		\
1562306a36Sopenharmony_ci		+= -fplugin-arg-structleak_plugin-byref
1662306a36Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL)	\
1762306a36Sopenharmony_ci		+= -fplugin-arg-structleak_plugin-byref-all
1862306a36Sopenharmony_ciifdef CONFIG_GCC_PLUGIN_STRUCTLEAK
1962306a36Sopenharmony_ci    DISABLE_STRUCTLEAK_PLUGIN += -fplugin-arg-structleak_plugin-disable
2062306a36Sopenharmony_ciendif
2162306a36Sopenharmony_ciexport DISABLE_STRUCTLEAK_PLUGIN
2262306a36Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK)		\
2362306a36Sopenharmony_ci		+= -DSTRUCTLEAK_PLUGIN
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_cigcc-plugin-$(CONFIG_GCC_PLUGIN_STACKLEAK)	+= stackleak_plugin.so
2662306a36Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK)		\
2762306a36Sopenharmony_ci		+= -DSTACKLEAK_PLUGIN
2862306a36Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK)		\
2962306a36Sopenharmony_ci		+= -fplugin-arg-stackleak_plugin-track-min-size=$(CONFIG_STACKLEAK_TRACK_MIN_SIZE)
3062306a36Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK)		\
3162306a36Sopenharmony_ci		+= -fplugin-arg-stackleak_plugin-arch=$(SRCARCH)
3262306a36Sopenharmony_cigcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK_VERBOSE)	\
3362306a36Sopenharmony_ci		+= -fplugin-arg-stackleak_plugin-verbose
3462306a36Sopenharmony_ciifdef CONFIG_GCC_PLUGIN_STACKLEAK
3562306a36Sopenharmony_ci    DISABLE_STACKLEAK_PLUGIN += -fplugin-arg-stackleak_plugin-disable
3662306a36Sopenharmony_ciendif
3762306a36Sopenharmony_ciexport DISABLE_STACKLEAK_PLUGIN
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_cigcc-plugin-$(CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK) += arm_ssp_per_task_plugin.so
4062306a36Sopenharmony_ciifdef CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK
4162306a36Sopenharmony_ci    DISABLE_ARM_SSP_PER_TASK_PLUGIN += -fplugin-arg-arm_ssp_per_task_plugin-disable
4262306a36Sopenharmony_ciendif
4362306a36Sopenharmony_ciexport DISABLE_ARM_SSP_PER_TASK_PLUGIN
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci# All the plugin CFLAGS are collected here in case a build target needs to
4662306a36Sopenharmony_ci# filter them out of the KBUILD_CFLAGS.
4762306a36Sopenharmony_ciGCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))
4862306a36Sopenharmony_ciexport GCC_PLUGINS_CFLAGS
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci# Add the flags to the build!
5162306a36Sopenharmony_ciKBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci# Some plugins are enabled outside of this Makefile, but they still need to
5462306a36Sopenharmony_ci# be included in GCC_PLUGIN so they can get built.
5562306a36Sopenharmony_cigcc-plugin-external-$(CONFIG_GCC_PLUGIN_SANCOV)			\
5662306a36Sopenharmony_ci	+= sancov_plugin.so
5762306a36Sopenharmony_cigcc-plugin-external-$(CONFIG_GCC_PLUGIN_RANDSTRUCT)		\
5862306a36Sopenharmony_ci	+= randomize_layout_plugin.so
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci# All enabled GCC plugins are collected here for building in
6162306a36Sopenharmony_ci# scripts/gcc-scripts/Makefile.
6262306a36Sopenharmony_ciGCC_PLUGIN := $(gcc-plugin-y) $(gcc-plugin-external-y)
6362306a36Sopenharmony_ciexport GCC_PLUGIN
64