From patchwork Thu May 17 06:17:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10405491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A60C16037D for ; Thu, 17 May 2018 06:20:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96C6C288D0 for ; Thu, 17 May 2018 06:20:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A2332894C; Thu, 17 May 2018 06:20:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EC4628949 for ; Thu, 17 May 2018 06:20:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752380AbeEQGUf (ORCPT ); Thu, 17 May 2018 02:20:35 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:26308 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752176AbeEQGT7 (ORCPT ); Thu, 17 May 2018 02:19:59 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id w4H6HbUM002841; Thu, 17 May 2018 15:18:01 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com w4H6HbUM002841 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1526537882; bh=svCMWd1eJifwrbrp8GDwRGkS3dcb1kFY41kde3D/Hv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nZ8kZdMR1THYVzfecX++ogKUrJ+L5SDWTYbLDwLjnwkxk5MPoe3U3VWFEk+HulCrr M9tz+e3jl5B9l6osU9JikhZS9BlzTC9+8NTvrD+QX0x8Ta2AMxw3UxhDOjvF/t0Ats UOs10Nn2IVuLVKki8l5pKGXDed7GnC3TpBB+cXFs7UqEIzNLlO9b9CANoo+Erdnwmi XIGulccpsD/QQLr1yqBDQvptEyMRQTWonW38Nm+92ZPffP+ufHD/qXxnLcGgLQJJSo ygIYLroY6N3/Ow5zrmrYr1uQCUeCp3+oAc2MJf+PYQ8MZeaa+sNUmbhUK0oexEkC2R PmgEg/EAiI31Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Linus Torvalds , Sam Ravnborg , Ulf Magnusson , "Luis R . Rodriguez" , linux-kernel@vger.kernel.org, Nicholas Piggin , Kees Cook , Emese Revfy , x86@kernel.org, Masahiro Yamada Subject: [PATCH v4 24/31] kconfig: add CC_IS_GCC and GCC_VERSION Date: Thu, 17 May 2018 15:17:03 +0900 Message-Id: <1526537830-22606-25-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526537830-22606-1-git-send-email-yamada.masahiro@socionext.com> References: <1526537830-22606-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This will be useful to specify the required compiler version, like this: config FOO bool "Use Foo" depends on GCC_VERSION >= 40800 help This feature requires GCC 4.8 or newer. Signed-off-by: Masahiro Yamada Reviewed-by: Kees Cook --- Changes in v4: None Changes in v3: None Changes in v2: None init/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/init/Kconfig b/init/Kconfig index 66f0463..c6ac856 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -8,6 +8,14 @@ config DEFCONFIG_LIST default ARCH_DEFCONFIG default "arch/$(ARCH)/defconfig" +config CC_IS_GCC + def_bool $(success, $(CC) --version | grep -q gcc) + +config GCC_VERSION + int + default $(shell, $(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//') if CC_IS_GCC + default 0 + config CONSTRUCTORS bool depends on !UML