Received: by 10.223.176.5 with SMTP id f5csp2159970wra; Thu, 8 Feb 2018 09:20:40 -0800 (PST) X-Google-Smtp-Source: AH8x226CPAg1qTPPHVGe1jUSAoYfcxoNYqvTm1UngYFTBC2kn2LHCCwataOUDQ6JPRW1QYWkQXKj X-Received: by 2002:a17:902:76cc:: with SMTP id j12-v6mr1283952plt.120.1518110440082; Thu, 08 Feb 2018 09:20:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518110440; cv=none; d=google.com; s=arc-20160816; b=WQRC97qqo7iTb/3aqlQ2PqPr4O3nQwYUL/OzVqTsZXptERFwKCYRoxP4US3b6EjATS rOi02NqvdyyXCS0oNEvt7ugWZ9OQXMd/sWVHCZvQeCFJre9k7ubbfJ/kZTSIyNS5SPL5 Aq4F/uRP7hYcCUGxkOH7RtHx7/V9peOxfusjU7P2b7Ao5RG69EvmL8FLMrASLdx4tMFG ETm/z0zSIFsZUwz/mR2a/syNzUQfkFFE/46KwDXJBMkoaTpAb1tEET7jfYZ3v/lh8sT2 8BeggHyj6lYZFF0e6V34lfYqryvLyhkoDka4SMqZvCb7jimx1HmlzwCHuStp0cbNXfzO XxaA== 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 :arc-authentication-results; bh=gB0FouZNGwdphzvqNWoaASyuUAuoUVxD/k3hfugHIU4=; b=wdWOEcPnouWxSzk9+mjYwjXM8eRCn7bgjqt8cbj8cGYFbsHSJ71EepCxgn6n6qaSCX f2LcDD4Bh7AAEgUym4XNW4D+2q3qu9YQQdg/PCnQQp1ydZVg6zBK1wbRYUIy5OhEnVcj fxfMqMasTXfA8eJ1jy0EU3cIf0YrDw0yfLFH+eIlaSt1T7QKXe5khTAK00YZsIu8NJ7d OxP5NHMDkZvwRC/ra3CjtasuViHXqNpcHFkTHryHQRzdIkljyTh1mGUhCAyXsx/wWtIR ZSt4+GkQFDHsjdZtaRcGI7h4o9sNJhICLjjKGqiyNrBice70PZ52XTP+ycmCYj3whrI8 o2Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=IxNv7FyU; 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 k1si207171pgc.95.2018.02.08.09.20.25; Thu, 08 Feb 2018 09:20:40 -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=fail header.i=@gmail.com header.s=20161025 header.b=IxNv7FyU; 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 S1752387AbeBHRTi (ORCPT + 99 others); Thu, 8 Feb 2018 12:19:38 -0500 Received: from mail-io0-f181.google.com ([209.85.223.181]:39863 "EHLO mail-io0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751988AbeBHRTf (ORCPT ); Thu, 8 Feb 2018 12:19:35 -0500 Received: by mail-io0-f181.google.com with SMTP id b198so6574616iof.6; Thu, 08 Feb 2018 09:19:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=gB0FouZNGwdphzvqNWoaASyuUAuoUVxD/k3hfugHIU4=; b=IxNv7FyUrOf8mYdjCTstRhAvJfbETB4hOLv+b2DBEVhNvhBQpnep3NSx5rlRJWm8PE srZVFfdEnxDk97oCUuUVIupzHFyNxGWg6fr2es8oGiaf73QLREHSP3ZIDhi779wxrVc3 3r+hMxM0hjeb2ias5LOT0t7Oda6bj6kjpvSMk5FBAzf8sj45mJUSM89Nw80Z8Ho3zbjb aR2Wv6naqrPxkiKYbds4pHy3AbEJ9kwc31XJQGEy6IdeNOWr2oGCqw8uujw9Ts6fEi60 U+hyAEBHBXuSSPKVud76sraO3NOsOgBhWQRh/QnOGj4iSIyvQCJuHGPIYzfw27n/jbBo il1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=gB0FouZNGwdphzvqNWoaASyuUAuoUVxD/k3hfugHIU4=; b=PXMVy2yn7Llu6EfEqmoKs5sXfJdBiD7x1G8oaqBooaOmHLyUmGe4CbRdc1STModqDh wtqDyuQTxTPh2RSKhuGqumQxBDOqL/D2R5uBg1OSa3ADxcFDT82BIIwftbJs/6dKf+Vm mn7LQQiMHeLalBrPnLkRle6QYW10sC9A4u/AVQHEp3PmUeDmleTHiFRgnIg3oKfLyXLW 1jXiivDL6jeu1u/ORIRif9AG2Ir+PNsmlVrSW0aj1ujNr6NtF8DCAqqntVG3ZiVN/Jlj FMYZC9Xx6nLO1Jx6KgEtbXFbkWHNU1RGBWP0rWQhvTTIkdDPBPzYsApBudal0LIFdnMy ep2w== X-Gm-Message-State: APf1xPCUqbd7WO6kWMiLCWQgNv5CQvYD2CAUCdjB66ckjYVV+Q1QC/cn aoeXTrB1veYP/j0sRUMUslcsQ9en4X1HUgbyDyE= X-Received: by 10.107.132.3 with SMTP id g3mr1768734iod.46.1518110374462; Thu, 08 Feb 2018 09:19:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.59.196 with HTTP; Thu, 8 Feb 2018 09:19:33 -0800 (PST) In-Reply-To: <1518106752-29228-1-git-send-email-yamada.masahiro@socionext.com> References: <1518106752-29228-1-git-send-email-yamada.masahiro@socionext.com> From: Linus Torvalds Date: Thu, 8 Feb 2018 09:19:34 -0800 X-Google-Sender-Auth: D1tM9EUS42NAVp6U-ZSyfwdWZK4 Message-ID: Subject: Re: [RFC PATCH 0/7] Kconfig: add new special property shell= to test compiler options in Kconfig To: Masahiro Yamada 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 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? 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. Linus