Le 01/10/2026 à 12:48, Jason A. Donenfeld a écrit :
On Thu, Oct 01, 2026 at 12:20:59PM +0200, Nathan Chancellor wrote:
control. The change that introduced -max-store-memset only did it to
"allow fine-tuning of the inlining threshold for performance analysis
and optimization". If they decide to remove it for whatever reason,
we're back to square one.

I suppose all the more reason to get -finline-stringops=memset added to
clang. Then the dual-default thing you came up with below will naturally
start choosing the first option when it becomes available.

I know something like below would be uglier due to the ifdef but it
would avoid changing anything for GCC while clearing up the issue at
hand for clang in a guaranteed stable and succinct manner.

But then we're back to the byte-by-byte codegen that Christophe pointed
out.
If that is not acceptable, something like the following does appear to
work for me.

Okay, great, let's do that.

Does this commit seem okay with you? I used the diff you sent below and
adjusted the commit message: 
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.zx2c4.com%2Flinux-rng%2Fcommit%2F%3Fid%3D56ff95ee85715047eb5b5220243778af657778c8&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7Cd89b4de22ff94b6be71208df1fa9839a%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639264485055490029%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Vxf8xRCdLavtw4Dmi%2B49FY1lJDWtm%2BjKv7f8BxKTGq4%3D&reserved=0


The commit message says: Similarly, GCC has -finline-stringops=memset to do the same [4], should this issue ever hit future version of GCC.

Why default "-finline-stringops=memset" if $(cc-option,-finline-stringops=memset), have we identified cases where build fail without that or is it just for future provision ?

As shown in my previous email, with GCC 16 on powerpc32 we get a slightly better code without this option.

---
diff --git a/init/Kconfig b/init/Kconfig
index 8583d9f06c52..98d8d7fa64c5 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -173,6 +173,11 @@ config CC_HAS_ALLOC_TOKEN
 config CC_HAS_MULTIDIMENSIONAL_NONSTRING
def_bool $(success,echo 'char tag[][4] __attribute__((__nonstring__)) = { };' | $(CC) $(CLANG_FLAGS) -x c - -c -o /dev/null -Werror)

+config CC_OPT_INLINE_MEMSET
+       string
+ default "-finline-stringops=memset" if $(cc-option,-finline-stringops=memset) + default "-mllvm -max-store-memset=4294967295" if $(cc-option,-mllvm -max-store-memset=4294967295)
+
 config LD_CAN_USE_KEEP_IN_OVERLAY
# ld.lld prior to 21.0.0 did not support KEEP within an overlay description
        # https://github.com/llvm/llvm-project/pull/130661


Reply via email to