LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Ingo Molnar <mingo@redhat.com>
Cc: llvm@lists.linux.dev, Masahiro Yamada <masahiroy@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] x86/build: Refresh stale cc-option check for stack alignment
Date: Thu, 26 Aug 2021 11:58:33 -0700	[thread overview]
Message-ID: <20210826185833.174862-1-ndesaulniers@google.com> (raw)
In-Reply-To: <CAKwvOd=ML1ytp8Q10oiz8q1ERAHcGnjjCSMOHj=tq6E2vHAkQw@mail.gmail.com>

GCC did not support values for -mpreferred-stack-boundary= outside the
range [4, 12] for -m64 until GCC 7+. Modify the cc-option tests to check
for support for a value of 3, and only when using GCC.

GCC has long supported values in the range [2, 12] for -m16 and -m32
targets, so there's no need to test for support for
-mpreferred-stack-boundary=2, since cc_stack_align4 is only used for
-m16 and -m32 targets.

Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 arch/x86/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index d82d01490dd3..2744c4f60b63 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -14,10 +14,11 @@ endif
 
 # For gcc stack alignment is specified with -mpreferred-stack-boundary,
 # clang has the option -mstack-alignment for that purpose.
-ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
+ifdef CONFIG_CC_IS_GCC
       cc_stack_align4 := -mpreferred-stack-boundary=2
-      cc_stack_align8 := -mpreferred-stack-boundary=3
-else ifneq ($(call cc-option, -mstack-alignment=16),)
+      cc_stack_align8 := $(call cc-option,-mpreferred-stack-boundary=3)
+endif
+ifdef CONFIG_CC_IS_CLANG
       cc_stack_align4 := -mstack-alignment=4
       cc_stack_align8 := -mstack-alignment=8
 endif

base-commit: 2e98d9bede666aa8f2137047043bfba9c2c2edc0
-- 
2.33.0.259.gc128427fd7-goog


  reply	other threads:[~2021-08-26 18:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 18:38 [PATCH v2] x86/build: remove stale cc-option checks Nick Desaulniers
2021-08-15  9:57 ` [tip: x86/build] x86/build: Remove " tip-bot2 for Nick Desaulniers
2021-08-22  8:31   ` Ingo Molnar
2021-08-26 18:55     ` Nick Desaulniers
2021-08-26 18:58       ` Nick Desaulniers [this message]
2021-08-22  8:32 ` tip-bot2 for Nick Desaulniers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210826185833.174862-1-ndesaulniers@google.com \
    --to=ndesaulniers@google.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH] x86/build: Refresh stale cc-option check for stack alignment' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).