From patchwork Mon May 28 09:22:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 137043 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2592183lji; Mon, 28 May 2018 02:24:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpZGZYvPxEl+5YH4FcFoWm6t/+nHf7uZZop7ASMfDH3FNRZM2ragWwS3e0FV/sP/n62MoGd X-Received: by 2002:a17:902:274a:: with SMTP id j10-v6mr13160444plg.393.1527499496538; Mon, 28 May 2018 02:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527499496; cv=none; d=google.com; s=arc-20160816; b=SnOqyFX3PC/lTa13YCW9kWyrPLYgQQyfZ191Uopd4bWqGpDeqyDEFs/k7XZK1IxhvG BTOZZ9Dw8BYqDy9Yuvb5TMJxItYsKaqYug1OR7xsK0zC+1TSdgWsAndMl+AS37af+/w2 m9Byovvm5bsJqD5otwC+9YL5ZvoFdz94JBItKr5AmZH+JE4nOYpj8Lim2H9Ozf/e/SHH JvgbsQ7Dp5BXRygUueH1SQszwnLdOFcDtFwZ7cALD40bCWVhGQulg7kwo5fgu8/42TtA 2ccBCOFihAzzBPkwwjvYTQNu/TGmxpcMqzfXGPK29J3ZVkFOyj1/1E/cfbM3R0ySXaQL dv9A== 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=KGWTRxsHzhfYmXXlA+L1qxO2n0s45ic1ueQ8VBleHpw=; b=nr9nSP+rnVD6/m3hpCGYC+EtMwju9THvUR50+dM0mppWtu1LzjVh8572sztiKRzup+ PSeers73OvtOsubM09i00efWbx00zT/d1vKCjvJSr3CfwfhgUSM1gQsyGUglRlWOdR5j VoqAkSm+OQCBblGKs0TS+6iFUKuyDbTwTGAcSDboq9a/F+iVaBihRQH2wUeej1gTLxsi zjLKA7HcjXJUg8i4SZQAQAlRENPegclDUdrd4zfCP8XnAQ8vpS02BqvcJOBt0tbee5zo qkQiCG9c3EpXjdxUetymyWn8u0mHF4SZfdHMKbJmTQhQvUl1Tnk+APwKmexMegs8ylj4 53Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Tjgz7Qy+; 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 m11-v6si17795287plt.284.2018.05.28.02.24.56; Mon, 28 May 2018 02:24:56 -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=Tjgz7Qy+; 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 S933503AbeE1JYy (ORCPT + 30 others); Mon, 28 May 2018 05:24:54 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:22335 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933272AbeE1JYl (ORCPT ); Mon, 28 May 2018 05:24:41 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-10.nifty.com with ESMTP id w4S9MInm027506; Mon, 28 May 2018 18:22:44 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com w4S9MInm027506 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1527499365; bh=KGWTRxsHzhfYmXXlA+L1qxO2n0s45ic1ueQ8VBleHpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tjgz7Qy+K42twdfDruErrrUqpD1QYre98ZJFpnbrzmxBFs87YxLy85SMyAENR+zyz G8wq7JH4kmCNg2cLXXApK+lmoWlMvkaTrn9J6AdMhYosMU/AbD2MPHdWaonOC3y+sA tK5a+M6y3VGrHY5aUN41Xq7H4q8tMSolTLHhQ/cZa1utDLRRTZorVzUQ6ZyGKyrCuR AI+Kp4wI69fENOytrZSweltt6T1CEYuhM4p3dw55CFXTgcknn2Mb3te7sRBRa8r4q9 U3fuKW4B1NNOAxht7Qbd6SxGCQo/G8dV/y7KMau2oSFTPzWgPTZPLXGINjkaAcfMtd ya5M0ThC1k90g== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Kees Cook , Nicholas Piggin , "Luis R . Rodriguez" , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Linus Torvalds , Masahiro Yamada Subject: [PATCH v5 31/31] Documentation: kconfig: add recommended way to describe compiler support Date: Mon, 28 May 2018 18:22:08 +0900 Message-Id: <1527499328-13213-32-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527499328-13213-1-git-send-email-yamada.masahiro@socionext.com> References: <1527499328-13213-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 It would be nice if the source code is written in the same style. This proposes the convention for describing the compiler capability in Kconfig. Signed-off-by: Masahiro Yamada --- This is not a technical issue, but it would be nice if everybody follows the same coding style. Without any documemation, people may write the code in their own way. For example, there could be some possibilities for the option naming. CC_HAS_ CC_SUPPORTS_ CC_HAVE_ ... IMHO, CC_HAS_ is short and enough to understand the meaning. CC_SUPPORTS_ is also good, but I personally prefer the shorter one. Comments are appreciated. Changes in v5: - Newly added Changes in v4: None Changes in v3: None Changes in v2: None Documentation/kbuild/kconfig-language.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.7.4 diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt index 0e966e8..a4eb018 100644 --- a/Documentation/kbuild/kconfig-language.txt +++ b/Documentation/kbuild/kconfig-language.txt @@ -473,6 +473,24 @@ config option to 'y' no matter the dependencies. The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the situation where select forces a symbol equals to 'y'. +Adding features that need compiler support +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are several features that need compiler support. The recommended way +to describe the dependency on the compiler feature is to use "depends on" +followed by a test macro. + +config CC_STACKPROTECTOR + bool "Stack Protector buffer overflow detection" + depends on $(cc-option,-fstack-protector) + ... + +If you need to expose a compiler capability to makefiles and/or C source files, +CC_HAS_ is the recommended prefix for the config option. + +config CC_HAS_STACKPROTECTOR_NONE + def_bool $(cc-option,-fno-stack-protector) + Build as module only ~~~~~~~~~~~~~~~~~~~~ To restrict a component build to module-only, qualify its config symbol