Skip to content

Commit 83f6698

Browse files
committed
patches: Update wcslen() patch to indicate upstream acceptance
Signed-off-by: Nathan Chancellor <[email protected]>
1 parent 24cf4d2 commit 83f6698

File tree

6 files changed

+63
-48
lines changed

6 files changed

+63
-48
lines changed

patches/android14-5.15/20250407_nathan_kbuild_add_fno_builtin_wcslen.patch renamed to patches/android14-5.15/84ffc79bfbf70c779e60218563f2f3ad45288671.patch

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
From git@z Thu Jan 1 00:00:00 1970
2-
Subject: [PATCH] kbuild: Add '-fno-builtin-wcslen'
1+
From 84ffc79bfbf70c779e60218563f2f3ad45288671 Mon Sep 17 00:00:00 2001
32
From: Nathan Chancellor <[email protected]>
4-
Date: Mon, 07 Apr 2025 16:22:12 -0700
5-
Message-Id: <[email protected]>
6-
MIME-Version: 1.0
7-
Content-Type: text/plain; charset="utf-8"
8-
Content-Transfer-Encoding: 7bit
3+
Date: Mon, 7 Apr 2025 16:22:12 -0700
4+
Subject: kbuild: Add '-fno-builtin-wcslen'
95

106
A recent optimization change in LLVM [1] aims to transform certain loop
117
idioms into calls to strlen() or wcslen(). This change transforms the
@@ -20,12 +16,26 @@ build when UniStrcat() gets inlined into alloc_path_with_tree_prefix():
2016

2117
Disable this optimization with '-fno-builtin-wcslen', which prevents the
2218
compiler from assuming that wcslen() is available in the kernel's C
23-
library
19+
library.
20+
21+
[ More to the point - it's not that we couldn't implement wcslen(), it's
22+
that this isn't an optimization at all in the context of the kernel.
23+
24+
Replacing a simple inlined loop with a function call to the same loop
25+
is just stupid and pointless if you don't have long strings and fancy
26+
libraries with vectorization support etc.
27+
28+
For the regular 'strlen()' cases, we want the compiler to do this in
29+
order to handle the trivial case of constant strings. And we do have
30+
optimized versions of 'strlen()' on some architectures. But for
31+
wcslen? Just no. - Linus ]
2432

2533
2634
Link: https://github.com/llvm/llvm-project/commit/9694844d7e36fd5e01011ab56b64f27b867aa72d [1]
27-
Link: https://lore.kernel.org/r/[email protected]
2835
Signed-off-by: Nathan Chancellor <[email protected]>
36+
Signed-off-by: Linus Torvalds <[email protected]>
37+
---
38+
Link: https://git.kernel.org/linus/84ffc79bfbf70c779e60218563f2f3ad45288671
2939
---
3040
Makefile | 3 +++
3141
1 file changed, 3 insertions(+)
@@ -44,11 +54,6 @@ index 6b3a24466e288..7bb6cfc2f0f13 100644
4454
# change __FILE__ to the relative path from the srctree
4555
KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
4656

47-
---
48-
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
49-
change-id: 20250407-fno-builtin-wcslen-90a858ae7d54
50-
51-
Best regards,
5257
--
53-
Nathan Chancellor <[email protected]>
58+
cgit 1.2.3-korg
5459

patches/android14-5.15/series

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
20250407_nathan_kbuild_add_fno_builtin_wcslen.patch
1+
84ffc79bfbf70c779e60218563f2f3ad45288671.patch
22
d0afcfeb9e3810ec89d1ffde1a0e36621bb75dca.patch

patches/android14-6.1/20250407_nathan_kbuild_add_fno_builtin_wcslen.patch renamed to patches/android14-6.1/84ffc79bfbf70c779e60218563f2f3ad45288671.patch

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
From git@z Thu Jan 1 00:00:00 1970
2-
Subject: [PATCH] kbuild: Add '-fno-builtin-wcslen'
1+
From 84ffc79bfbf70c779e60218563f2f3ad45288671 Mon Sep 17 00:00:00 2001
32
From: Nathan Chancellor <[email protected]>
4-
Date: Mon, 07 Apr 2025 16:22:12 -0700
5-
Message-Id: <[email protected]>
6-
MIME-Version: 1.0
7-
Content-Type: text/plain; charset="utf-8"
8-
Content-Transfer-Encoding: 7bit
3+
Date: Mon, 7 Apr 2025 16:22:12 -0700
4+
Subject: kbuild: Add '-fno-builtin-wcslen'
95

106
A recent optimization change in LLVM [1] aims to transform certain loop
117
idioms into calls to strlen() or wcslen(). This change transforms the
@@ -20,12 +16,26 @@ build when UniStrcat() gets inlined into alloc_path_with_tree_prefix():
2016

2117
Disable this optimization with '-fno-builtin-wcslen', which prevents the
2218
compiler from assuming that wcslen() is available in the kernel's C
23-
library
19+
library.
20+
21+
[ More to the point - it's not that we couldn't implement wcslen(), it's
22+
that this isn't an optimization at all in the context of the kernel.
23+
24+
Replacing a simple inlined loop with a function call to the same loop
25+
is just stupid and pointless if you don't have long strings and fancy
26+
libraries with vectorization support etc.
27+
28+
For the regular 'strlen()' cases, we want the compiler to do this in
29+
order to handle the trivial case of constant strings. And we do have
30+
optimized versions of 'strlen()' on some architectures. But for
31+
wcslen? Just no. - Linus ]
2432

2533
2634
Link: https://github.com/llvm/llvm-project/commit/9694844d7e36fd5e01011ab56b64f27b867aa72d [1]
27-
Link: https://lore.kernel.org/r/[email protected]
2835
Signed-off-by: Nathan Chancellor <[email protected]>
36+
Signed-off-by: Linus Torvalds <[email protected]>
37+
---
38+
Link: https://git.kernel.org/linus/84ffc79bfbf70c779e60218563f2f3ad45288671
2939
---
3040
Makefile | 3 +++
3141
1 file changed, 3 insertions(+)
@@ -44,11 +54,6 @@ index 89742f1246cfb..593149161053d 100644
4454
# change __FILE__ to the relative path from the srctree
4555
KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
4656

47-
---
48-
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
49-
change-id: 20250407-fno-builtin-wcslen-90a858ae7d54
50-
51-
Best regards,
5257
--
53-
Nathan Chancellor <[email protected]>
58+
cgit 1.2.3-korg
5459

patches/android14-6.1/series

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
6b3ab7f2cbfaeb6580709cd8ef4d72cfd01bfde4.patch
2-
20250407_nathan_kbuild_add_fno_builtin_wcslen.patch
2+
84ffc79bfbf70c779e60218563f2f3ad45288671.patch
33
d0afcfeb9e3810ec89d1ffde1a0e36621bb75dca.patch
44
d8720235d5b5cad86c1f07f65117ef2a96f8bec7.patch

patches/android15-6.6/20250407_nathan_kbuild_add_fno_builtin_wcslen.patch renamed to patches/android15-6.6/84ffc79bfbf70c779e60218563f2f3ad45288671.patch

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
From git@z Thu Jan 1 00:00:00 1970
2-
Subject: [PATCH] kbuild: Add '-fno-builtin-wcslen'
1+
From 84ffc79bfbf70c779e60218563f2f3ad45288671 Mon Sep 17 00:00:00 2001
32
From: Nathan Chancellor <[email protected]>
4-
Date: Mon, 07 Apr 2025 16:22:12 -0700
5-
Message-Id: <[email protected]>
6-
MIME-Version: 1.0
7-
Content-Type: text/plain; charset="utf-8"
8-
Content-Transfer-Encoding: 7bit
3+
Date: Mon, 7 Apr 2025 16:22:12 -0700
4+
Subject: kbuild: Add '-fno-builtin-wcslen'
95

106
A recent optimization change in LLVM [1] aims to transform certain loop
117
idioms into calls to strlen() or wcslen(). This change transforms the
@@ -20,12 +16,26 @@ build when UniStrcat() gets inlined into alloc_path_with_tree_prefix():
2016

2117
Disable this optimization with '-fno-builtin-wcslen', which prevents the
2218
compiler from assuming that wcslen() is available in the kernel's C
23-
library
19+
library.
20+
21+
[ More to the point - it's not that we couldn't implement wcslen(), it's
22+
that this isn't an optimization at all in the context of the kernel.
23+
24+
Replacing a simple inlined loop with a function call to the same loop
25+
is just stupid and pointless if you don't have long strings and fancy
26+
libraries with vectorization support etc.
27+
28+
For the regular 'strlen()' cases, we want the compiler to do this in
29+
order to handle the trivial case of constant strings. And we do have
30+
optimized versions of 'strlen()' on some architectures. But for
31+
wcslen? Just no. - Linus ]
2432

2533
2634
Link: https://github.com/llvm/llvm-project/commit/9694844d7e36fd5e01011ab56b64f27b867aa72d [1]
27-
Link: https://lore.kernel.org/r/[email protected]
2835
Signed-off-by: Nathan Chancellor <[email protected]>
36+
Signed-off-by: Linus Torvalds <[email protected]>
37+
---
38+
Link: https://git.kernel.org/linus/84ffc79bfbf70c779e60218563f2f3ad45288671
2939
---
3040
Makefile | 3 +++
3141
1 file changed, 3 insertions(+)
@@ -44,11 +54,6 @@ index 2b22872d3cea5..2c9ed52924839 100644
4454
# change __FILE__ to the relative path from the srctree
4555
KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
4656

47-
---
48-
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
49-
change-id: 20250407-fno-builtin-wcslen-90a858ae7d54
50-
51-
Best regards,
5257
--
53-
Nathan Chancellor <[email protected]>
58+
cgit 1.2.3-korg
5459

patches/android15-6.6/series

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
6b3ab7f2cbfaeb6580709cd8ef4d72cfd01bfde4.patch
2-
20250407_nathan_kbuild_add_fno_builtin_wcslen.patch
2+
84ffc79bfbf70c779e60218563f2f3ad45288671.patch
33
d0afcfeb9e3810ec89d1ffde1a0e36621bb75dca.patch
44
d8720235d5b5cad86c1f07f65117ef2a96f8bec7.patch

0 commit comments

Comments
 (0)