[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170620173721.GA52338@google.com>
Date: Tue, 20 Jun 2017 10:37:21 -0700
From: Matthias Kaehlcke <mka@...omium.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: hpa@...or.com, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H . J . Lu" <hjl.tools@...il.com>,
David Woodhouse <dwmw2@...radead.org>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Michal Marek <mmarek@...e.com>, x86@...nel.org,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
Michael Davidson <md@...gle.com>,
Greg Hackmann <ghackmann@...gle.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Stephen Hines <srhines@...gle.com>,
Kees Cook <keescook@...omium.org>,
Arnd Bergmann <arnd@...db.de>,
Bernhard.Rosenkranzer@...aro.org,
Peter Foley <pefoley2@...oley.com>,
Behan Webster <behanw@...verseincode.com>,
Douglas Anderson <dianders@...omium.org>
Subject: Re: [PATCH v4 3/3] x86/build: Specify stack alignment for clang
El Tue, Jun 20, 2017 at 11:20:54AM +0200 Ingo Molnar ha dit:
>
> * Matthias Kaehlcke <mka@...omium.org> wrote:
>
> > Ingo didn't like the duplication and suggested the use of a variable, which
> > kinda implies a check for the compiler name.
>
> I don't think it implies that: why cannot cc_stack_align_opt probe for the
> compiler option and use whichever is available, without hard-coding the compiler
> name?
We could do this:
ifneq ($(call __cc-option, $(CC), -mno-sse, -mpreferred-stack-boundary=3,),)
cc_stack_align_opt := -mpreferred-stack-boundary
endif
ifneq ($(call cc-option, -mstack-alignment=3,),)
cc_stack_align_opt := -mstack-alignment
endif
If preferred cc-option could be used to probe for
-mpreferred-stack-boundary , however it would require REALMODE_CFLAGS
to be moved further down in the Makefile.
Since this solution also won't win a beauty price please let me know
if it is acceptable before respinning the patch or if you have other
suggestions.
> > I also think this is a cleaner solution. [...]
>
> I concur with hpa: hard-coding compiler is awfully fragile and ugly as well.
>
> With the proper probing of compiler options it will be possible for compilers to
> consolidate their options, and it would be possible for a third compiler to use a
> mixture of GCC and Clang options. With hard-coding none of that flexibility is
> available.
>
> > but I'm happy to respin the patch if you have another suggestion that is ok for
> > both of you.
>
> Please do.
>
> Thanks,
>
> Ingo
Powered by blists - more mailing lists