Received: by 10.223.185.116 with SMTP id b49csp751819wrg; Wed, 21 Feb 2018 06:24:22 -0800 (PST) X-Google-Smtp-Source: AH8x227xxUHZ7bz0VIOQ+p5shn24gf1vhawonaM6LMn7OKC11awLDQ1HWNZrEywj+bpSOwYPyAwe X-Received: by 10.99.60.72 with SMTP id i8mr2819488pgn.399.1519223062118; Wed, 21 Feb 2018 06:24:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519223062; cv=none; d=google.com; s=arc-20160816; b=haEouplZ6mtkn7PDpW9XH/rlcj+ERirIV4lS5qJFFdDLUGOxF9+CowIGqYJYZTmK+b X0EzuGkBnLzbLondOINQxL4Qva5a+wXLeFUe5gskeSPrw4SKoiMMbFSn33c8NrQt55d0 jpGBcYTEj7//U4j7O2IIipUs/+i1G5nRHyI8md8UtSL4CXqYESPMdICyn3aealyqxSkj CNMdhBkdrs8iPWN0rBis8CpKLf3DZpmvIUAG3zaaocRMQcBNN8++lQm1HFCUcQlYfFK+ BCqFFgD/TasNmsoZY+iRcZ1iJGPqWE4N2ZXgGtydqEAIeSglkDkFYH57YcKwAYWcfRci 3dWA== 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=K4UIT7NLyatWkqe4qwVrCM5M/VanEw2Zh7sKSKYJ/3Q=; b=IGiWNQKiuLSeQbg9frwDohxNnIPrV1D+WRkvgpuGtcOmVMVrmuRVpP21/blOp4T5js REkfY6AHOUwiIrEQIsJMaYSAbO3KgnCyuogV5Ezh58a/Ywz73bRKoYvksPD1R0Z/8pyq 2X2cA/zdYQ554DDcBJWhYxqBF8qchqaX2b1ivnfrZwNymlTtdSqkujbCcZ05yNUBBzc8 bRqOoUeOD8gUO1UB2cMljD9YNGNW8PJbq0FA0WFue3GtpQP2SxyctrT5Rwoj+r7xeXaE 8cCD78UQ1gN06eHRPhOonsFbBIdQ6DAJ2rbsbopj3jncNSAR/d9xM6iMhIm98xqLppXg d29g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Zru2M8Un; 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 bh11-v6si1124440plb.62.2018.02.21.06.24.07; Wed, 21 Feb 2018 06:24:22 -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=Zru2M8Un; 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 S934847AbeBUM6H (ORCPT + 99 others); Wed, 21 Feb 2018 07:58:07 -0500 Received: from conssluserg-03.nifty.com ([210.131.2.82]:52484 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934788AbeBUM56 (ORCPT ); Wed, 21 Feb 2018 07:57:58 -0500 Received: from mail-ua0-f181.google.com (mail-ua0-f181.google.com [209.85.217.181]) (authenticated) by conssluserg-03.nifty.com with ESMTP id w1LCvibG028868; Wed, 21 Feb 2018 21:57:45 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com w1LCvibG028868 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1519217865; bh=K4UIT7NLyatWkqe4qwVrCM5M/VanEw2Zh7sKSKYJ/3Q=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=Zru2M8Un4f8dlupzFnzIRzKFVTxgInDoUmLBqaSD6Uxkv8DxesNzpFf+YTY6yGPfN KuN0VgywmTG/no0cWvpG2J8r0zs2dVPA4KltRu12CDUV53Xq+gwRrhDmNPWy3GXh16 irOqORL9U6hOhs8KQzdmKz43iN7zVIa3A+syPXeTd6y0ujvvyduxsJDntcC3mBlDsP xEGM42fQROQAOOB2qgEF7VgdBmYEzi+I1QneABv6nwY8xfT+QWTa7TvaOmyLRLxbEs +7BREYmfP7uOI6trcDthUYamwf5XTBoyQRJItQC+Be0Bv29q6gvIL+cuMpZuzI/NlC 4JeVhwCUuFaBQ== X-Nifty-SrcIP: [209.85.217.181] Received: by mail-ua0-f181.google.com with SMTP id m43so938345uah.1; Wed, 21 Feb 2018 04:57:45 -0800 (PST) X-Gm-Message-State: APf1xPC6i/zUlayT2U3h1qREcA26eX2plBb+LKnqOt63F+ZaM365XoEe EFJKTMT4Cgo6UCyqhzYg6KofmvyfNZUNObgz8X4= X-Received: by 10.176.69.102 with SMTP id r93mr2350191uar.140.1519217863996; Wed, 21 Feb 2018 04:57:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.83.212 with HTTP; Wed, 21 Feb 2018 04:57:03 -0800 (PST) In-Reply-To: References: <1518806331-7101-1-git-send-email-yamada.masahiro@socionext.com> <20180218221352.GA6651@ravnborg.org> From: Masahiro Yamada Date: Wed, 21 Feb 2018 21:57:03 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 00/23] kconfig: move compiler capability tests to Kconfig To: Arnd Bergmann Cc: Rich Felker , Kernel Hardening , X86 ML , Paul Mackerras , "H. Peter Anvin" , sparclinux , Sam Ravnborg , Yoshinori Sato , Jonathan Corbet , Richard Weinberger , Linux-sh list , Ingo Molnar , Emese Revfy , Kees Cook , uml-devel , Linux Kbuild mailing list , Peter Oberparleiter , Jeff Dike , linuxppc-dev , user-mode-linux-user@lists.sourceforge.net, Thomas Gleixner , Michal Marek , Ulf Magnusson , Greg Kroah-Hartman , Randy Dunlap , "open list:DOCUMENTATION" , Linux Kernel Mailing List , Linus Torvalds , "David S. Miller" 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 2018-02-21 19:52 GMT+09:00 Arnd Bergmann : > On Wed, Feb 21, 2018 at 11:20 AM, Masahiro Yamada > wrote: >> 2018-02-21 18:56 GMT+09:00 Arnd Bergmann : >>> On Wed, Feb 21, 2018 at 8:38 AM, Masahiro Yamada >>> wrote: >>>> 2018-02-20 0:18 GMT+09:00 Ulf Magnusson : >> >> Let me clarify my concern. >> >> When we test the compiler flag, is there a case >> where a particular flag depends on -m{32,64} ? >> >> For example, is there a compiler that supports -fstack-protector >> for 64bit mode, but unsupports it for 32bit mode? >> >> $(cc-option -m32) -> y >> $(cc-option -m64) -> y >> $(cc-option -fstack-protector) -> y >> $(cc-option -m32 -fstack-protector) -> n >> $(cc-option -m64 -fstack-protector) -> y >> >> I guess this is unlikely to happen, >> but I am not whether it is zero possibility. >> >> If this could happen, >> $(cc-option ) must be evaluated together with >> correct bi-arch option (either -m32 or -m64). >> >> >> Currently, -m32/-m64 is specified in Makefile, >> but we are moving compiler tests to Kconfig >> and, CONFIG_64BIT can be dynamically toggled in Kconfig. > > I don't think it can happen for this particular combination (stack protector > and word size), but I'm sure we'll eventually run into options that > need to be tested in combination. For the current CFLAGS_KERNEL > setting, we definitely have the case of needing the variables to be > evaluated in a specific order. > I was thinking of how we can handle complex cases in the current approach. (Case 1) Compiler flag -foo and -bar interacts, so we also need to check the combination of the two. config CC_HAS_FOO def_bool $(cc-option -foo) config CC_HAS_BAR def_bool $(cc-option -bar) config CC_HAS_FOO_WITH_BAR def_bool $(cc-option -foo -bar) (Case 2) Compiler flag -foo is sensitive to word-size. So, we need to test this option together with -m32/-m64. User can toggle CONFIG_64BIT, like i386/x86_64. config CC_NEEDS_M64 def_bool $(cc-option -m64) && 64BIT config CC_NEEDS_M32 def_bool $(cc-option -m32) && !64BIT config CC_HAS_FOO bool default $(cc-option -m64 -foo) if CC_NEEDS_M64 default $(cc-option -m32 -foo) if CC_NEEDS_M32 default $(cc-option -foo) (Case 3) Compiler flag -foo is sensitive to endian-ness. config CC_NEEDS_BIG_ENDIAN def_bool $(cc-option -mbig-endian) && CPU_BIG_ENDIAN config CC_NEEDS_LITTLE_ENDIAN def_bool $(cc-option -mlittle-endian) && CPU_LITTLE_ENDIAN config CC_HAS_FOO bool default $(cc-option -mbig-endian -foo) if CC_NEEDS_BIG_ENDIAN default $(cc-option -mlittle-endian -foo) if CC_NEEDS_LITTLE_ENDIAN default $(cc-option -foo) Hmm, I think I can implement those somehow. But, I hope we do not have many instances like this... If you know more naive cases, please share your knowledge. Thanks! -- Best Regards Masahiro Yamada