Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752419AbdFUHTH (ORCPT ); Wed, 21 Jun 2017 03:19:07 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34415 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751739AbdFUHTD (ORCPT ); Wed, 21 Jun 2017 03:19:03 -0400 Date: Wed, 21 Jun 2017 09:18:58 +0200 From: Ingo Molnar To: Matthias Kaehlcke Cc: hpa@zytor.com, Thomas Gleixner , Ingo Molnar , "H . J . Lu" , David Woodhouse , Masahiro Yamada , Michal Marek , x86@kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Davidson , Greg Hackmann , Nick Desaulniers , Stephen Hines , Kees Cook , Arnd Bergmann , Bernhard.Rosenkranzer@linaro.org, Peter Foley , Behan Webster , Douglas Anderson Subject: Re: [PATCH v4 3/3] x86/build: Specify stack alignment for clang Message-ID: <20170621071858.74cg3vg5wbhpdsht@gmail.com> References: <20170619183757.124992-1-mka@chromium.org> <20170619183757.124992-4-mka@chromium.org> <20170619204704.GP141096@google.com> <20170620092054.7d2mgzx6cw3jvgji@gmail.com> <20170620173721.GA52338@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170620173721.GA52338@google.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1379 Lines: 40 * Matthias Kaehlcke wrote: > El Tue, Jun 20, 2017 at 11:20:54AM +0200 Ingo Molnar ha dit: > > > > > * Matthias Kaehlcke 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 The principle Looks good to me - but I'd make the second probing an 'else' branch, i.e. probe for a suitable compiler option until we find one. That would also not burden the GCC build with probing for different compiler options. Please also add a comment in the code that explains that the first option is a GCC option and the second one is a Clang-ism. > 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. This one already looks a lot cleaner to me than any of the previous ones. Thanks, Ingo