Re: [PATCH] x86/Kconfig: Fix CONFIG_CC_HAS_SANE_STACKPROTECTOR when cross compiling with clang

From: Dave Hansen
Date: Wed Jul 06 2022 - 18:28:11 EST


On 6/17/22 11:08, Nathan Chancellor wrote:
> When clang is invoked without a '--target' flag, code is generated for
> the default target, which is usually the host (it is configurable via
> cmake). As a result, the has-stack-protector scripts will generate code
> for the default target but check for x86 specific segment registers,
> which cannot succeed if the default target is not x86.

I guess the real root cause here is the direct use of '$(CC)' without
any other flags. Adding '$(CLANG_FLAGS)' seems like a pretty normal
fix, like in scripts/Kconfig.include.

I suspect there's another one of these here:

arch/x86/um/vdso/Makefile: cmd_vdso = $(CC) -nostdlib -o $@

but I wouldn't be surprised if UML doesn't work with clang in the first
place.