From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755389AbcEQO2L (ORCPT ); Tue, 17 May 2016 10:28:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:39765 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751204AbcEQO2J (ORCPT ); Tue, 17 May 2016 10:28:09 -0400 Subject: Re: [PATCH v8 2/4] GCC plugin infrastructure To: Emese Revfy References: <20160513015456.01415979f20a68eb7d2d9290@gmail.com> <20160513015725.30223ee16a2a3860b4392b90@gmail.com> Cc: linux-kbuild@vger.kernel.org, pageexec@freemail.hu, spender@grsecurity.net, kernel-hardening@lists.openwall.com, keescook@chromium.org, linux@rasmusvillemoes.dk, fengguang.wu@intel.com, dvyukov@google.com, linux-kernel@vger.kernel.org, david.brown@linaro.org, yamada.masahiro@socionext.com From: Michal Marek Message-ID: <573B2A75.9030603@suse.com> Date: Tue, 17 May 2016 16:28:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160513015725.30223ee16a2a3860b4392b90@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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