Re: [PATCH 1/2] x86: Do not add -falign flags unconditionally for clang

From: Nathan Chancellor
Date: Thu Sep 16 2021 - 14:42:38 EST


On 9/16/2021 10:18 AM, Borislav Petkov wrote:
On Mon, Aug 23, 2021 at 07:26:39PM -0700, Nathan Chancellor wrote:

A couple of nitpicks:

Subject: [PATCH 1/2] x86: Do not add -falign flags unconditionally for clang

Make that prefix into "x86/build: "

Done, I'll be sure to keep that prefix in mind for future flag-based changes.

clang does not support -falign-jumps and only recently gained support
for -falign-loops. When one of the configuration options that adds these
flags is enabled, clang warns and all cc-{disable-warning,option} that
follow fail because -Werror gets added to test for the presence of this
warning:

clang-14: warning: optimization flag '-falign-jumps=0' is not supported
[-Wignored-optimization-argument]

To resolve this, add a couple of cc-option calls when building with
clang; gcc has supported these options since 3.2 so there is no point in
testing for their support. -falign-functions was implemented in clang-7,
-falign-loops was implemented in clang-14, and -falign-jumps has not
been implemented yet.

Link: https://lore.kernel.org/r/YSQE2f5teuvKLkON@Ryzen-9-3900X.localdomain/

Also, there should be a second Link: tag which points to this mail
thread so that we can find it later, when we dig for the "why we did
that" question :)

I.e.,

Link: 20210824022640.2170859-2-nathan@xxxxxxxxxx

Sure thing, kind of hard to do that on the initial submission but I will do it for the v2 shortly :)

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
---
arch/x86/Makefile_32.cpu | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

with that:

Acked-by: Borislav Petkov <bp@xxxxxxx>

Thank you for the ack. The conflicting changes that I mentioned in the cover letter have been merged in 5.15-rc1 so if you guys want to take these changes via -tip, just holler for an ack from Masahiro on the second patch on v2 (but I am going with the assumption this will be merged via the kbuild tree).

Cheers,
Nathan