|
Message-ID: <CAK7LNAR3OMh9Q9ZfaBq=FpSJ-+DT5-RH_20ohV-iu34pX9hFKw@mail.gmail.com> Date: Wed, 21 Feb 2018 21:57:03 +0900 From: Masahiro Yamada <yamada.masahiro@...ionext.com> To: Arnd Bergmann <arnd@...db.de> Cc: Rich Felker <dalias@...c.org>, Kernel Hardening <kernel-hardening@...ts.openwall.com>, X86 ML <x86@...nel.org>, Paul Mackerras <paulus@...ba.org>, "H. Peter Anvin" <hpa@...or.com>, sparclinux <sparclinux@...r.kernel.org>, Sam Ravnborg <sam@...nborg.org>, Yoshinori Sato <ysato@...rs.sourceforge.jp>, Jonathan Corbet <corbet@....net>, Richard Weinberger <richard@....at>, Linux-sh list <linux-sh@...r.kernel.org>, Ingo Molnar <mingo@...hat.com>, Emese Revfy <re.emese@...il.com>, Kees Cook <keescook@...omium.org>, uml-devel <user-mode-linux-devel@...ts.sourceforge.net>, Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>, Peter Oberparleiter <oberpar@...ux.vnet.ibm.com>, Jeff Dike <jdike@...toit.com>, linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>, user-mode-linux-user@...ts.sourceforge.net, Thomas Gleixner <tglx@...utronix.de>, Michal Marek <michal.lkml@...kovi.net>, Ulf Magnusson <ulfalizer@...il.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Randy Dunlap <rdunlap@...radead.org>, "open list:DOCUMENTATION" <linux-doc@...r.kernel.org>, Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, Linus Torvalds <torvalds@...ux-foundation.org>, "David S. Miller" <davem@...emloft.net> Subject: Re: [PATCH 00/23] kconfig: move compiler capability tests to Kconfig 2018-02-21 19:52 GMT+09:00 Arnd Bergmann <arnd@...db.de>: > On Wed, Feb 21, 2018 at 11:20 AM, Masahiro Yamada > <yamada.masahiro@...ionext.com> wrote: >> 2018-02-21 18:56 GMT+09:00 Arnd Bergmann <arnd@...db.de>: >>> On Wed, Feb 21, 2018 at 8:38 AM, Masahiro Yamada >>> <yamada.masahiro@...ionext.com> wrote: >>>> 2018-02-20 0:18 GMT+09:00 Ulf Magnusson <ulfalizer@...il.com>: >> >> 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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.