Re: [PATCH v8 2/4] GCC plugin infrastructure

From: Michal Marek
Date: Tue May 17 2016 - 10:28:14 EST


Dne 13.5.2016 v 01:57 Emese Revfy napsal(a):
> --- /dev/null
> +++ b/scripts/Makefile.gcc-plugins
> @@ -0,0 +1,21 @@
> +ifdef CONFIG_GCC_PLUGINS
> + __PLUGINCC := $(call cc-ifversion, -ge, 0408, $(HOSTCXX), $(HOSTCC))
> + PLUGINCC := $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-plugin.sh "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)")
> +
> + GCC_PLUGINS_CFLAGS := $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y))
> +
> + ifeq ($(PLUGINCC),)
> + ifneq ($(GCC_PLUGINS_CFLAGS),)
> + ifeq ($(call cc-ifversion, -ge, 0405, y), y)
> + PLUGINCC := $(shell $(CO, NFIG_SHELL) -x $(srctree)/scripts/gcc-plugin.sh "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)")
> + $(error error, your gcc installation does not support plugins, perhaps the necessary headers are missing?)
> + else
> + $(error error, your gcc version does not support plugins, you should upgrade it to gcc 4.5 at least)
> + endif
> + endif
> + endif
> +
> + KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
> + GCC_PLUGIN := $(gcc-plugin-y)
> +
> +endif

Hi Emese,

sorry for the late feedback. A problem I ran into now is that if you
have a compiler that is either too old or built with plugin support
disabled, scripts/Makefile.gcc-plugins errors out immediately. This is
going to be an issue with allmodconfig/allyesconfig test builds. A
solution would either be to make the respective options depend on
!COMPILE_TEST, or turn the errors into warnings and do nothing if the
compiler lacks plugin support. We are handling CONFIG_CC_STACKPROTECTOR
on x86 this way already.

Michal