Re: [GIT PULL] string fixes for v6.15-rc1

From: Nathan Chancellor
Date: Mon Apr 07 2025 - 15:35:49 EST


On Mon, Apr 07, 2025 at 12:02:04PM -0700, Linus Torvalds wrote:
> On Mon, 7 Apr 2025 at 10:37, Nathan Chancellor <nathan@xxxxxxxxxx> wrote:
> > +# Ensure clang does not transform certain loops into calls to wcslen() after
> > +# https://github.com/llvm/llvm-project/commit/9694844d7e36fd5e01011ab56b64f27b867aa72d
> > +KBUILD_CFLAGS-$(call clang-min-version, 210000) += -fno-builtin-wcslen
>
> I think you could just use
>
> KBUILD_CFLAGS += $(call cc-option, -fno-builtin-wcslen)
>
> instead, and not use some version check?

Sure, I just figured this has not been a problem up until this point so
applying it for older versions of clang should not be necessary (since
the optimization that introduces it does not exist) but also not be
harmful. However, I would rather not call out to the compiler since we
know it is supported with all versions of clang (and GCC but it
obviously does not need it) so maybe just

KBUILD_CFLAGS-$(CONFIG_CC_IS_CLANG) += -fno-builtin-wcslen

or

ifdef CONFIG_CC_IS_CLANG
KBUILD_CFLAGS += -fno-builtin-wcslen
endif

or if you do want this for GCC too, unconditionally adding it should be
fine too.

KBUILD_CFLAGS += -fno-builtin-wcslen

No strong opinion, let me know your preference and I will make it so.

Cheers,
Nathan