Received: by 10.223.185.116 with SMTP id b49csp658070wrg; Wed, 21 Feb 2018 04:59:14 -0800 (PST) X-Google-Smtp-Source: AH8x2272P1Q6xt/M3UW/ZtD4VjGV3W8QIXOcnFtSpt9hxR5vk865e3FEPFzti/l8zpDoqgwHsuDV X-Received: by 10.99.38.67 with SMTP id m64mr2684107pgm.2.1519217954571; Wed, 21 Feb 2018 04:59:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519217954; cv=none; d=google.com; s=arc-20160816; b=QK3ZdnP9naT1pNja478wDjkwpZzMvVUf7XXy3SwQcytQCRyTkYGM5P6+3EZBkLmVso Dm9+k/RNbkdBj6aNZ0SVmi9s7fhtJLvbidF1sQVeAISrrwDjjWLNySWrZ7WrpzqbsJ+I 1PzRpJfSCH1RbnA7SIaD80HGM1pfoIglVFh/esi6CrUt8oN+3xTjqWHlHJDjGaMgm15O BLkSdkz6KMW8YrcNqh8AddegbaF3IRXpMuNZSo5t7uYaC1WoOpTwLnnJbj819CfGHS+9 ECXoWXAEw5kI7kAy291HUdqQ8MqE8WReTGGBC37EdMC+SE3QH0eoco6azYiZj4KC4vtC 8zlQ== 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=Bi4fA2ypTG6Mvop+Fzpk/VgkeoGzhkCYUgy69xdsQDA=; b=UnMCr5qKi+xt6MQqXh6fGrL7UBH7L38b3BVUtjftvE/8Ud54sYuuqCx+rSDkIpIUmm 7vLnncXLxkIo2pv2qB1OrzkN+Pgfk1JZffxI3miRUac67zf2DfFh2SoHkIvsUZRMpp2X K6AVmKMTon7Ui9ACjg2oM9lD9kVUx2hD0CzX4cZYBuqewvnt2yIMDh+emSOByj5Jqt4U yt2gmWrGqA3topwWZHAXDQnneoC0A/8a4StJE7d+dCTwqjmlJIC1WXyzlNIq6wej6ejf 4UoXJtRLfCDIuKfm6vFfSCb/5L+0dAkxi/x4o7GgmzLV7dCkCQwgq0vXJB+hfpLwlUKt nWHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=MYqbZ2G9; 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 s36-v6si2853087pld.175.2018.02.21.04.59.00; Wed, 21 Feb 2018 04:59:14 -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=MYqbZ2G9; 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 S932964AbeBUKVF (ORCPT + 99 others); Wed, 21 Feb 2018 05:21:05 -0500 Received: from conssluserg-03.nifty.com ([210.131.2.82]:23480 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932822AbeBUKU5 (ORCPT ); Wed, 21 Feb 2018 05:20:57 -0500 X-Greylist: delayed 9697 seconds by postgrey-1.27 at vger.kernel.org; Wed, 21 Feb 2018 05:20:56 EST Received: from mail-vk0-f44.google.com (mail-vk0-f44.google.com [209.85.213.44]) (authenticated) by conssluserg-03.nifty.com with ESMTP id w1LAKonN000361; Wed, 21 Feb 2018 19:20:50 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com w1LAKonN000361 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1519208451; bh=Bi4fA2ypTG6Mvop+Fzpk/VgkeoGzhkCYUgy69xdsQDA=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=MYqbZ2G9AK/d/PzD0HGYz6eEuiAMvmgBajz94gTOGBoyaJj68RhSafs/52Yp24V1v NVFcBOPGTQFieQZl3B95D1zmWrq4fR69Yi61KcQJ0Ul86X3xplHGGuiaPCk+9GQhxY VYP9n9eOzA7+j9TCJGefPgNXNYqkUUj5/CvrPcOp4Qyvpsd+tEpQXcxMPXd87RUSdk 5lguyfIwgklqAKHFD5m89GVL+K5lvmPulvzyZEnBNlVO1hBILYkn/Rhd/JbF6hrxqW sU4eUrLMZEi+a52mI4EYsQpKA5FKNWy1+xHjZHG+dXlvR6hq7TDmMl76/lS5Q+Mml9 JCFkXhE4xG2YQ== X-Nifty-SrcIP: [209.85.213.44] Received: by mail-vk0-f44.google.com with SMTP id q7so629728vkh.3; Wed, 21 Feb 2018 02:20:50 -0800 (PST) X-Gm-Message-State: APf1xPB3H6uTJda4w+5qTYMb0wrSdKqdqHkgfSLIgcJy/NiioS0ck4rA FklicJtSfNQrZRF/UIuliI3roxu/xE1PXwfgUXM= X-Received: by 10.31.237.68 with SMTP id l65mr1957520vkh.11.1519208449497; Wed, 21 Feb 2018 02:20:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.83.212 with HTTP; Wed, 21 Feb 2018 02:20:09 -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 19:20:09 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 00/23] kconfig: move compiler capability tests to Kconfig To: Arnd Bergmann Cc: Ulf Magnusson , Rich Felker , Linux-sh list , Kernel Hardening , Paul Mackerras , "H. Peter Anvin" , sparclinux , Sam Ravnborg , uml-devel , Yoshinori Sato , Jonathan Corbet , X86 ML , Linus Torvalds , Ingo Molnar , Emese Revfy , Kees Cook , Linux Kbuild mailing list , Peter Oberparleiter , Jeff Dike , user-mode-linux-user@lists.sourceforge.net, Thomas Gleixner , Michal Marek , Greg Kroah-Hartman , Randy Dunlap , "open list:DOCUMENTATION" , Linux Kernel Mailing List , Richard Weinberger , linuxppc-dev , "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 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 : >> >>>> >>>> I'm not happy that we in one context can reference CONFIG variables >>>> directly, but inside the $(call ...) and $(shell ...) needs the $ prefix. >>>> But I could not come up with something un-ambigious where this could be avoided. >>> >>> I think we should be careful about allowing references to config >>> symbols. It mixes up the parsing and evaluation phases, since $() is >>> expanded during parsing (which I consider a feature and think is >>> needed to retain sanity). >>> >>> Patch 06/23 removes the last existing instance of symbol references in >>> strings by getting rid of 'option env'. That's an improvement to me. >>> We shouldn't add it back. >> >> >> This is really important design decision, >> so I'd like to hear a little more from experts. >> >> >> For example, x86 allows users to choose sub-arch, either 'i386' or 'x86_64'. >> >> https://github.com/torvalds/linux/blob/v4.16-rc2/arch/x86/Kconfig#L4 >> >> >> >> If the user toggles CONFIG_64BIT, >> the bi-arch compiler will work in a slightly different mode >> (at least, back-end parts) >> >> So, my question is, is there a case, >> >> $(cc-option, -m32 -foo) is y, but >> $(cc-option, -m64 -foo) is n ? >> (or vice versa) >> >> >> If the answer is yes, $(cc-option -foo) would have to be re-calculated >> every time CONFIG_64BIT is toggled. >> >> This is what I'd like to avoid, though. > > The -m32/-m64 trick (and -mbig-endian/-mlittle-endian on other architectures > as well as a couple of other flags) only works if the compiler is configured to > support it. In other cases (e.g. big-endian xtensa), the kernel always > detects what the compiler does and silently configures itself to match > using Makefile logic. > > On x86, compilers are usually built as bi-arch, but you can build one that > only allows one of them. > > I can see two reasonable ways out: > > - we don't use $(cc-option -foo) in a case like this, and instead require the > user to have a matching toolchain. > - we could make the 32/64 selection on x86 a 'choice' statement where > each option depends on both the ARCH= variable and the > $(cc-option, -m32)/ $(cc-option, -m64) output. > > Arnd 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. -- Best Regards Masahiro Yamada