Received: by 10.223.176.5 with SMTP id f5csp2182337wra; Thu, 8 Feb 2018 09:42:16 -0800 (PST) X-Google-Smtp-Source: AH8x225HGUdkivB/PNCjCs2tUCvQAMK33EWcW63x0Cy/mol2giH1hOrxW7xUJ4lzlrpSOC8MemCm X-Received: by 10.98.254.21 with SMTP id z21mr1487969pfh.48.1518111736463; Thu, 08 Feb 2018 09:42:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518111736; cv=none; d=google.com; s=arc-20160816; b=dBV90r3Zf3yePUE/fvH5f9c2PADdSzsDgG893qBenTtC/G/HgieUFB6Csj0TjSXQpO 0t3rY3VGaet4BgZrrsDAXntE5JjiBF7/XBWTekXh0afaMMHdrIw0DtDuS18SnEVAbLEM WGbBY0OEzN7nuOlgkkzP3c4tzGT9Cso6/xH+cHdLm311NmZyJ8PuLesf437Gk9SpIyZ9 5dOqjR+PjnyjXiVi8WRGQQdy1nU/tuWD8aeNgeRGKjbGeG57vObJ8n9bVw/2h8XgDWGJ bGmeLCI4MZhI98P+vuPWRFfPoyNAafOb9TiyttbCjTvHeY/iFG+OjCujaiCudjMMA1rf 3Fnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=Yc0aCgI+26UQeoElgzw2tLXbxYgiIJQfrl1vnkczKA8=; b=rny5D0vT7/sP0dqIoDcRiN/xdU8Y0QZAQsNl+JRdROAS17veu6x+wW8Yq5AjkIBzd1 OnfiwZ5ZdP63Eg9f4DoBPfer4uHaaoCwWSOakwScAyLdtTm6/fl8mhcfh3GUPuvnTukg x+iYzv+wMCeAC6GFvI7yvqh9sNA9eQoQxR8EJXkNkjlP/iEdkYeQjIcQcC9/O3LeFbOx WztCRQPOFQvy91dVCY2dG0ISNxUEsSk6eEW7TsfcnHhocHH9WWBoxQ0Ab2Z/d9NF1A6m OOzFyi3Zh9IuOWYQiCcJGmgO3Aiex9FAIIrY1OmULnTzMv/D56LBPCzJJriqThLIUqmN B6mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=gCpwkxFy; 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 b5si244928pff.349.2018.02.08.09.42.01; Thu, 08 Feb 2018 09:42:16 -0800 (PST) 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=gCpwkxFy; 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 S1752293AbeBHRkW (ORCPT + 99 others); Thu, 8 Feb 2018 12:40:22 -0500 Received: from conssluserg-04.nifty.com ([210.131.2.83]:26000 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751984AbeBHRkU (ORCPT ); Thu, 8 Feb 2018 12:40:20 -0500 Received: from mail-vk0-f50.google.com (mail-vk0-f50.google.com [209.85.213.50]) (authenticated) by conssluserg-04.nifty.com with ESMTP id w18HeBcg016100; Fri, 9 Feb 2018 02:40:12 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com w18HeBcg016100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1518111612; bh=Yc0aCgI+26UQeoElgzw2tLXbxYgiIJQfrl1vnkczKA8=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=gCpwkxFyc5/vz//Wdhr/ma6pPGYEi+RcxENgglKGcNjaHrabJnOod+AYvYOIw5Xci VfZ7PdT2H+LR1VE+2R800Cz15GrovQonrfkwvCMXtcbCfDLSEU7z9e2+ylgaeNS7Ap p0m1XPAhaNeKVa4kq8HnLPNOvWXIUAzJDViMeZ9qFNQtY4caEEa0q6jhM/5fFOITt8 A4u9Fpa0JdOsK2HVYVBTfUk2K7U9URwCj0cyjl7B7ICJQ7TBZYPr7/pcS/BRi6/KwM SvRa/COdXsus3UAB5F0ArUKDmI9XAp93hApLd+Sn9V0Y0OODMi4SxtbbInij54F3Hc M13d5EyiR0EWw== X-Nifty-SrcIP: [209.85.213.50] Received: by mail-vk0-f50.google.com with SMTP id w201so3250737vkw.0; Thu, 08 Feb 2018 09:40:12 -0800 (PST) X-Gm-Message-State: APf1xPDbLO0BUNfdS4U4wmjF5SYi6vM2JDr2P4v1wVsxWSrwSANAU73z N2MTl1uMz+Mb9kOQ0VWHefryZOKwJ4jVbuuq2Ec= X-Received: by 10.31.214.196 with SMTP id n187mr1175544vkg.25.1518111610688; Thu, 08 Feb 2018 09:40:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.83.212 with HTTP; Thu, 8 Feb 2018 09:39:30 -0800 (PST) In-Reply-To: References: <1518106752-29228-1-git-send-email-yamada.masahiro@socionext.com> From: Masahiro Yamada Date: Fri, 9 Feb 2018 02:39:30 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 0/7] Kconfig: add new special property shell= to test compiler options in Kconfig To: Linus Torvalds Cc: Linux Kbuild mailing list , Greg Kroah-Hartman , Andrew Morton , Kees Cook , Nicolas Pitre , "Luis R . Rodriguez" , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Michal Marek , Martin Schwidefsky , Pavel Machek , linux-s390 , Jiri Kosina , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, 2018-02-09 2:19 GMT+09:00 Linus Torvalds : > On Thu, Feb 8, 2018 at 8:19 AM, Masahiro Yamada > wrote: >> This was prompted by the email from Linus today's morning. > > Thanks. > >> I implmented this in a rush today, so there are still many TODOs, >> but I put it here to start discussion. >> >> I think it is working, but as you notice, it is tedious to repeat something >> like follows: >> >> config CC_HAS_STACKPROTECTOR >> bool >> option shell="$CC -Werror -fstack-protector -c -x c /dev/null" > > Yeah. > > I do think we want to have the "shell" thing as a generic escape for > other things too, but *realistically*, the primary target for this is > compiler flags, and I think we should target that specifically with a > shorthand. > > Doing some statistics, and looking for > > flag = $(call xyz ...) > > patterns in our makefiles (ignoring single uses), it really is > cc-option that dominates: > > 2 name-fix > 2 try-run > 3 __cc-option > 3 grep-libs > 3 strip-libs > 4 flags > 4 get-executable > 4 ld-option > 4 logo-cfiles > 5 as-option > 5 cc-cross-prefix > 6 cc-ldoption > 6 cc-supports > 7 cc-option-yn > 7 tune > 9 cc-ifversion > 30 as-instr > 48 cc-disable-warning > 239 cc-option > > so I think that's the one that we want to special-case. > > If we then have a _usable_ - but perhaps not wonderful "shell" escape > to do any random thing (including scripts etc), that will take care of > the rest, but cc-option is so common that I think it's worth making a > special Kconfig syntax for them. For all I know, the others aren't > even worth Kconfig options at all. > >> I was thinking of something like follows: >> >> config CC_STACKPROTECTOR >> bool >> option shell="$(CC_OPTION -fstack-protector)" > > I think we should go even further, and just make it be > > config CC_STACKPROTECTOR > bool > option cc_option="-fstack-protector" > > and actually have the Kconfig language itself have this special-cased. > > And obviously that "option cc_option" would be *implemented* as just > "option shell", with just some stupid string substitution. So it > really would be purely a shorthand for readability. > > What do you think? OK, I will try this way. > And btw, the patches look nice. What I like in particular is that they > don't even seem to add a lot of lines: the new shell option code is > almost balanced out by the Kconfig script simplifications. And maybe > it's just that I read C a lot better than I read GNU Makefile magic, > but I think it's more understandable too. I am glad you like it. :) -- Best Regards Masahiro Yamada