A recent change in oe-core [1] to glibc 2.43 has introduced a build
error with 6.12 kernels.  Backport a patch [2] from linux-stable to
address this.

[1] 
https://git.openembedded.org/openembedded-core/commit/?id=f791d6c52870f3571e740ff7818d45bb0a717934
[2] 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.12.y&id=3dedeeecd1ae42a751721d83dc21877122cc1795

Signed-off-by: Ryan Eatmon <[email protected]>
---
 ...-Fix-Wdiscarded-qualifiers-under-C23.patch | 60 +++++++++++++++++++
 .../linux/linux-ti-staging_6.12.bb            |  2 +
 2 files changed, 62 insertions(+)
 create mode 100644 
meta-ti-bsp/recipes-kernel/linux/files/0001-libbpf-Fix-Wdiscarded-qualifiers-under-C23.patch

diff --git 
a/meta-ti-bsp/recipes-kernel/linux/files/0001-libbpf-Fix-Wdiscarded-qualifiers-under-C23.patch
 
b/meta-ti-bsp/recipes-kernel/linux/files/0001-libbpf-Fix-Wdiscarded-qualifiers-under-C23.patch
new file mode 100644
index 00000000..b7a81006
--- /dev/null
+++ 
b/meta-ti-bsp/recipes-kernel/linux/files/0001-libbpf-Fix-Wdiscarded-qualifiers-under-C23.patch
@@ -0,0 +1,60 @@
+From 3dedeeecd1ae42a751721d83dc21877122cc1795 Mon Sep 17 00:00:00 2001
+From: Mikhail Gavrilov <[email protected]>
+Date: Sat, 6 Dec 2025 14:28:25 +0500
+Subject: libbpf: Fix -Wdiscarded-qualifiers under C23
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+commit d70f79fef65810faf64dbae1f3a1b5623cdb2345 upstream.
+
+glibc ≥ 2.42 (GCC 15) defaults to -std=gnu23, which promotes
+-Wdiscarded-qualifiers to an error.
+
+In C23, strstr() and strchr() return "const char *".
+
+Change variable types to const char * where the pointers are never
+modified (res, sym_sfx, next_path).
+
+Suggested-by: Florian Weimer <[email protected]>
+Suggested-by: Andrii Nakryiko <[email protected]>
+Signed-off-by: Mikhail Gavrilov <[email protected]>
+Link: 
https://lore.kernel.org/r/[email protected]
+Signed-off-by: Alexei Starovoitov <[email protected]>
+[ shung-hsi.yu: needed to fix kernel build failure due to libbpf since glibc
+  2.43+ (which adds 'const' qualifier to strstr). 'sym_sfx' hunk dropped 
because
+  commit f8a05692de06 ("libbpf: Work around kernel inconsistently stripping
+  '.llvm.' suffix") is not present. ]
+Signed-off-by: Shung-Hsi Yu <[email protected]>
+Signed-off-by: Greg Kroah-Hartman <[email protected]>
+
+Upstream-Status: Backport
+---
+ tools/lib/bpf/libbpf.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
+index 060aecf60b76b1..7d496f0a9a30d1 100644
+--- a/tools/lib/bpf/libbpf.c
++++ b/tools/lib/bpf/libbpf.c
+@@ -8174,7 +8174,7 @@ static int kallsyms_cb(unsigned long long sym_addr, char 
sym_type,
+       struct bpf_object *obj = ctx;
+       const struct btf_type *t;
+       struct extern_desc *ext;
+-      char *res;
++      const char *res;
+ 
+       res = strstr(sym_name, ".llvm.");
+       if (sym_type == 'd' && res)
+@@ -11959,7 +11959,7 @@ static int resolve_full_path(const char *file, char 
*result, size_t result_sz)
+               if (!search_paths[i])
+                       continue;
+               for (s = search_paths[i]; s != NULL; s = strchr(s, ':')) {
+-                      char *next_path;
++                      const char *next_path;
+                       int seg_len;
+ 
+                       if (s[0] == ':')
+-- 
+cgit 1.2.3-korg
+
diff --git a/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb 
b/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb
index a02b90e7..c63d7532 100644
--- a/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb
+++ b/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb
@@ -24,6 +24,8 @@ BRANCH ?= "ti-linux-6.12.y"
 SRCREV ?= "da3c0f0a33ac00f7138c695a16d90301cf7ec02b"
 PV = "6.12.57+git"
 
+SRC_URI += "file://0001-libbpf-Fix-Wdiscarded-qualifiers-under-C23.patch"
+
 KERNEL_REPRODUCIBILITY_PATCHES = " \
     file://0001-drivers-gpu-drm-msm-registers-improve-reproducibilit.patch \
 "
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19719): 
https://lists.yoctoproject.org/g/meta-ti/message/19719
Mute This Topic: https://lists.yoctoproject.org/mt/118349288/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to