1# SPDX-License-Identifier: GPL-2.0 2 3gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) += latent_entropy_plugin.so 4gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) \ 5 += -DLATENT_ENTROPY_PLUGIN 6ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY 7 DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable -ULATENT_ENTROPY_PLUGIN 8endif 9export DISABLE_LATENT_ENTROPY_PLUGIN 10 11# Disable recording GCC options in debug info when building external modules to 12# avoid leaking absolute host build paths 13gcc-plugin-cflags-$(if $(KBUILD_EXTMOD),y) += -gno-record-gcc-switches 14 15# All the plugin CFLAGS are collected here in case a build target needs to 16# filter them out of the KBUILD_CFLAGS. 17GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) -DGCC_PLUGINS 18export GCC_PLUGINS_CFLAGS 19 20# Add the flags to the build! 21KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS) 22 23# Some plugins are enabled outside of this Makefile, but they still need to 24# be included in GCC_PLUGIN so they can get built. 25gcc-plugin-external-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) \ 26 += randomize_layout_plugin.so 27gcc-plugin-external-$(CONFIG_GCC_PLUGIN_STACKLEAK) \ 28 += stackleak_plugin.so 29 30# All enabled GCC plugins are collected here for building in 31# scripts/gcc-scripts/Makefile. 32GCC_PLUGIN := $(gcc-plugin-y) $(gcc-plugin-external-y) 33export GCC_PLUGIN 34