From patchwork Tue Mar 27 05:29:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 132441 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp4653822ljb; Mon, 26 Mar 2018 22:32:47 -0700 (PDT) X-Google-Smtp-Source: AG47ELub9cbGCBUIM2UZGeytp+/3oxsO1FMwhFhs0+hrsPSMDcsx45s4eMtZA5XrDH5KoV7vsZIg X-Received: by 2002:a17:902:aa48:: with SMTP id c8-v6mr42644641plr.361.1522128767490; Mon, 26 Mar 2018 22:32:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522128767; cv=none; d=google.com; s=arc-20160816; b=Wy3VEvFdr2AlOHyKmuvZaSGH3aDRDoEw22RwZV/Lr9xNV/+voybSDz3d/ObFrYtTNk fBytszK8VxMvbscuRTEJUMsmZPrSX1AGNXsJyCx0CN4ORb0CnNdIl9tgBSkoAm77tOrj LsIo7lxuLP+tnwc2wRwHsH6U15FmTrTBDsop6bLw03I16YXGZ+wBWVmLxR1b0+TtABjc s9oHrjrnuPeqU4q+Zd+Wf0cg4DOr37JSeeCY4qfS0zP4k1sOekVGndcMtIyIwnpcoJ0b YASPLJj5CjIKcwsxCeq1vs+DdABrz9ZNNgpp1RCuVmNAAT6MFEgSLLjdKFAhgQ2SIQqD 0mMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=SmnoR5uX+QdJc5jR+e3JIIYITKB70ECICvL3cl8cDVA=; b=pT9jUa6siieD7Bx/mfJhMRe0AoI7iRpxRYQxzfgfe/4bzzx8FZb0ZbbO2hmNfcEOQ/ gENZNTIOjXBq7RDdeeSCv3hHpXO0cFB0U6le0aHURziIWa0T1zi4SALGP0Dz+55lQcmm vJqzr9hPf0J2VWSXZeG5Jbmghry+nzqbelMTN54t/rQUjQ8KpKQnPAWeJWY1BJOQbrr/ djgzyoG0cjJFHOhwiXf/q/ndeyc+p2CZdGAJPTV6L3/9isx+xWo2T9hEl6S2hElg/uQG dGKwwaNpiSUoLu/v0Biye9mGW3togtk+XBGU3sRP1eNjriTv/oP1WmFfBcFQl2pNFRSF ZNng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=teTvD2yn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v20-v6si481748plo.199.2018.03.26.22.32.47; Mon, 26 Mar 2018 22:32:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=teTvD2yn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752334AbeC0Fcn (ORCPT + 28 others); Tue, 27 Mar 2018 01:32:43 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:45213 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752180AbeC0FcS (ORCPT ); Tue, 27 Mar 2018 01:32:18 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id w2R5TaM2011947; Tue, 27 Mar 2018 14:29:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w2R5TaM2011947 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1522128599; bh=SmnoR5uX+QdJc5jR+e3JIIYITKB70ECICvL3cl8cDVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=teTvD2ynRoXyNj9YtZnvGTB5jOn1jLzK/WuofJKk1VZCt1aGfCaHtkBgoc89t9PYk iGoodLK7z2911DH0PrWwB6jE7/6atN7eSRAs8FdReVnYmtL3/+1RQIH5Fvb9qdy6Nl 0QANp+M0g3lPATvkb2jKNgw5hGwQOc6rhw+YS6dZ7qgNLfS27Mn6APcM3mECU/S3WK VDPtEQRG/lLdqlmv2sxCVvwZAldh99/6TnZkIs2Fn4Q45af/LDnL3hf53j/D8NKjvV HIPJKzJeDn0rbXgNJM44P9jztuUM0FQCh6qXHZYw6rXWWHL3aMX9CMAglE1A6RWW24 RRg0Hcumsa6OA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Linus Torvalds , Arnd Bergmann , Ulf Magnusson , Kees Cook , Thomas Gleixner , Greg Kroah-Hartman , Randy Dunlap , "Luis R . Rodriguez" , Nicolas Pitre , Masahiro Yamada , linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Emese Revfy Subject: [PATCH v2 17/21] gcc-plugins: always build plugins with C++ Date: Tue, 27 Mar 2018 14:29:31 +0900 Message-Id: <1522128575-5326-18-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522128575-5326-1-git-send-email-yamada.masahiro@socionext.com> References: <1522128575-5326-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the target compiler is GCC 4.8 or newer, plugins are compiled with HOSTCXX. Otherwise, gcc-plugin.sh will select HOSTCC or HOSTCXX. To simplify things, drop the HOSTCC support for plugins. If you use GCC plugins, the requirement for the target compiler is GCC 4.8 (or older compiler with necessary features backported). This is a feature for advanced users, so this requirement would not be a big deal. Currently, building plugins requires GCC 4.5, so this is not a big jump. Remove the code that was needed to build plugins with HOSTCC as a preparation for Kconfig migration. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.gcc-plugins | 11 +++-------- scripts/gcc-plugin.sh | 38 +++----------------------------------- scripts/gcc-plugins/Makefile | 15 ++++----------- 3 files changed, 10 insertions(+), 54 deletions(-) -- 2.7.4 diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins index b2a95af..b0f9108 100644 --- a/scripts/Makefile.gcc-plugins +++ b/scripts/Makefile.gcc-plugins @@ -1,7 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 ifdef CONFIG_GCC_PLUGINS - __PLUGINCC := $(call cc-ifversion, -ge, 0408, $(HOSTCXX), $(HOSTCC)) - PLUGINCC := $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-plugin.sh "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)") + PLUGINCC := $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-plugin.sh $(HOSTCXX) $(CC)) SANCOV_PLUGIN := -fplugin=$(objtree)/scripts/gcc-plugins/sancov_plugin.so @@ -65,12 +64,8 @@ ifdef CONFIG_GCC_PLUGINS @echo "Cannot use CONFIG_GCC_PLUGINS: plugin support on gcc <= 5.1 is buggy on powerpc, please upgrade to gcc 5.2 or newer" >&2 && exit 1 endif endif - ifeq ($(call cc-ifversion, -ge, 0405, y), y) - $(Q)$(srctree)/scripts/gcc-plugin.sh --show-error "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)" || true - @echo "Cannot use CONFIG_GCC_PLUGINS: your gcc installation does not support plugins, perhaps the necessary headers are missing?" >&2 && exit 1 - else - @echo "Cannot use CONFIG_GCC_PLUGINS: your gcc version does not support plugins, you should upgrade it to at least gcc 4.5" >&2 && exit 1 - endif + $(Q)$(srctree)/scripts/gcc-plugin.sh --show-error $(HOSTCXX) $(CC) || true + @echo "Cannot use CONFIG_GCC_PLUGINS: your gcc installation does not support plugins, perhaps the necessary headers are missing?" >&2 && exit 1 endif endif endif diff --git a/scripts/gcc-plugin.sh b/scripts/gcc-plugin.sh index d3caefe..0edbdae 100755 --- a/scripts/gcc-plugin.sh +++ b/scripts/gcc-plugin.sh @@ -8,42 +8,10 @@ if [ "$1" = "--show-error" ] ; then shift || true fi -gccplugins_dir=$($3 -print-file-name=plugin) -plugincc=$($1 -E -x c++ - -o /dev/null -I"${srctree}"/gcc-plugins -I"${gccplugins_dir}"/include 2>&1 <= 4008 || defined(ENABLE_BUILD_WITH_CXX) -#warning $2 CXX -#else -#warning $1 CC -#endif -EOF -) - -if [ $? -ne 0 ] -then - if [ -n "$SHOW_ERROR" ] ; then - echo "${plugincc}" >&2 - fi - exit 1 -fi - -case "$plugincc" in - *"$1 CC"*) - echo "$1" - exit 0 - ;; - - *"$2 CXX"*) - # the c++ compiler needs another test, see below - ;; - - *) - exit 1 - ;; -esac +gccplugins_dir=$($2 -print-file-name=plugin) # we need a c++ compiler that supports the designated initializer GNU extension -plugincc=$($2 -c -x c++ -std=gnu++98 - -fsyntax-only -I"${srctree}"/gcc-plugins -I"${gccplugins_dir}"/include 2>&1 <&1 <