diff mbox series

[whinlatter,1/9] dtc: backport fix for build with glibc-2.43

Message ID 20260409152839.2894434-1-martin.jansa@gmail.com
State Under Review
Delegated to: Yoann Congal
Headers show
Series [whinlatter,1/9] dtc: backport fix for build with glibc-2.43 | expand

Commit Message

Martin Jansa April 9, 2026, 3:28 p.m. UTC
From: Martin Jansa <martin.jansa@gmail.com>

glibc-2.43 isn't used in OE builds yet, but this fixes dtc-native:
https://errors.yoctoproject.org/Errors/Details/903983/

../sources/dtc-1.7.2/libfdt/fdt_overlay.c: In function ‘overlay_fixup_phandle’:
../sources/dtc-1.7.2/libfdt/fdt_overlay.c:424:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  424 |                 sep = memchr(fixup_str, ':', fixup_len);
      |                     ^
../sources/dtc-1.7.2/libfdt/fdt_overlay.c:434:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  434 |                 sep = memchr(name, ':', fixup_len);
      |                     ^
cc1: all warnings being treated as errors

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 .../0001-Fix-discarded-const-qualifiers.patch | 83 +++++++++++++++++++
 meta/recipes-kernel/dtc/dtc_1.7.2.bb          |  1 +
 2 files changed, 84 insertions(+)
 create mode 100644 meta/recipes-kernel/dtc/dtc/0001-Fix-discarded-const-qualifiers.patch

Comments

Yoann Congal April 9, 2026, 7:17 p.m. UTC | #1
On Thu Apr 9, 2026 at 5:28 PM CEST, Martin Jansa via lists.openembedded.org wrote:
> From: Martin Jansa <martin.jansa@gmail.com>
>
> glibc-2.43 isn't used in OE builds yet, but this fixes dtc-native:
> https://errors.yoctoproject.org/Errors/Details/903983/
>
> ../sources/dtc-1.7.2/libfdt/fdt_overlay.c: In function ‘overlay_fixup_phandle’:
> ../sources/dtc-1.7.2/libfdt/fdt_overlay.c:424:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
>   424 |                 sep = memchr(fixup_str, ':', fixup_len);
>       |                     ^
> ../sources/dtc-1.7.2/libfdt/fdt_overlay.c:434:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
>   434 |                 sep = memchr(name, ':', fixup_len);
>       |                     ^
> cc1: all warnings being treated as errors
>
> Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---

Hello,

I've started a whinlatter bringup build on the new Ubuntu 26.04 worker
with this series applied:
https://autobuilder.yoctoproject.org/valkyrie/#/builders/96/builds/23

It got 2 errors (Other errors are most likely consequences of these ones):

ERROR: shadow-native-4.18.0-r0 do_configure: configure failed:
https://autobuilder.yoctoproject.org/valkyrie/?#/builders/96/builds/23/steps/12/logs/stdio line 6269:
| checking for crypt in -lcrypt... no
| configure: error: crypt() not found
| NOTE: The following config.log files may provide further information.
| NOTE: /srv/pokybuild/yocto-worker/bringup/build/build/tmp/work/x86_64-linux/shadow-native/4.18.0/build/config.log
| ERROR: configure failed
| WARNING: exit code 1 from a shell command.
NOTE: recipe shadow-native-4.18.0-r0: task do_configure: Failed

ERROR: virglrenderer-native-1.1.1-r0 do_compile: Execution of '/srv/pokybuild/yocto-worker/bringup/build/build/tmp/work/x86_64-linux/virglrenderer-native/1.1.1/temp/run.do_compile.2048675' failed with exit code 1
https://autobuilder.yoctoproject.org/valkyrie/?#/builders/96/builds/23/steps/12/logs/stdio line 29545:
| [4/57] gcc -Isrc/mesa/libmesa.a.p -Isrc/mesa -I../sources/virglrenderer-1.1.1/src/mesa -I../sources/virglrenderer-1.1.1/src/mesa/compat -I../sources/virglrenderer-1.1.1/src/mesa/pipe -I../sources/virglrenderer-1.1.1/src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -Werror=format -fvisibility=hidden -fno-strict-aliasing -imacros /srv/pokybuild/yocto-worker/bringup/build/build/tmp/work/x86_64-linux/virglrenderer-native/1.1.1/build/config.h -DHAVE_CONFIG_H=1 -isystem/srv/pokybuild/yocto-worker/bringup/build/build/tmp/work/x86_64-linux/virglrenderer-native/1.1.1/recipe-sysroot-native/usr/include -O2 -pipe -fPIC -pthread -MD -MQ src/mesa/libmesa.a.p/util_u_math.c.o -MF src/mesa/libmesa.a.p/util_u_math.c.o.d -o src/mesa/libmesa.a.p/util_u_math.c.o -c ../sources/virglrenderer-1.1.1/src/mesa/util/u_math.c
| FAILED: [code=1] src/mesa/libmesa.a.p/util_u_math.c.o
| gcc -Isrc/mesa/libmesa.a.p -Isrc/mesa -I../sources/virglrenderer-1.1.1/src/mesa -I../sources/virglrenderer-1.1.1/src/mesa/compat -I../sources/virglrenderer-1.1.1/src/mesa/pipe -I../sources/virglrenderer-1.1.1/src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -Werror=format -fvisibility=hidden -fno-strict-aliasing -imacros /srv/pokybuild/yocto-worker/bringup/build/build/tmp/work/x86_64-linux/virglrenderer-native/1.1.1/build/config.h -DHAVE_CONFIG_H=1 -isystem/srv/pokybuild/yocto-worker/bringup/build/build/tmp/work/x86_64-linux/virglrenderer-native/1.1.1/recipe-sysroot-native/usr/include -O2 -pipe -fPIC -pthread -MD -MQ src/mesa/libmesa.a.p/util_u_math.c.o -MF src/mesa/libmesa.a.p/util_u_math.c.o.d -o src/mesa/libmesa.a.p/util_u_math.c.o -c ../sources/virglrenderer-1.1.1/src/mesa/util/u_math.c
| In file included from ../sources/virglrenderer-1.1.1/src/mesa/compat/c11/threads.h:64,
|                  from ../sources/virglrenderer-1.1.1/src/mesa/util/u_thread.h:35,
|                  from ../sources/virglrenderer-1.1.1/src/mesa/util/u_cpu_detect.h:40,
|                  from ../sources/virglrenderer-1.1.1/src/mesa/util/u_math.c:32:
| ../sources/virglrenderer-1.1.1/src/mesa/compat/c11/threads_posix.h:54:9: warning: ‘ONCE_FLAG_INIT’ redefined
|    54 | #define ONCE_FLAG_INIT PTHREAD_ONCE_INIT
|       |         ^~~~~~~~~~~~~~
| In file included from /usr/include/stdlib.h:1191,
|                  from ../sources/virglrenderer-1.1.1/src/mesa/compat/c11/threads_posix.h:29:
| /usr/include/x86_64-linux-gnu/bits/types/once_flag.h:25:9: note: this is the location of the previous definition
|    25 | #define ONCE_FLAG_INIT __ONCE_FLAG_INIT
|       |         ^~~~~~~~~~~~~~
| ../sources/virglrenderer-1.1.1/src/mesa/compat/c11/threads_posix.h:69:25: error: conflicting types for ‘once_flag’; have ‘pthread_once_t’ {aka ‘int’}
|    69 | typedef pthread_once_t  once_flag;
|       |                         ^~~~~~~~~
| /usr/include/x86_64-linux-gnu/bits/types/once_flag.h:24:21: note: previous declaration of ‘once_flag’ with type ‘once_flag’
|    24 | typedef __once_flag once_flag;
|       |                     ^~~~~~~~~
| ../sources/virglrenderer-1.1.1/src/mesa/compat/c11/threads_posix.h:94:1: error: conflicting types for ‘call_once’; have ‘void(int *, void (*)(void))’
|    94 | call_once(once_flag *flag, void (*func)(void))
|       | ^~~~~~~~~
| /usr/include/stdlib.h:1195:13: note: previous declaration of ‘call_once’ with type ‘void(once_flag *, void (*)(void))’
|  1195 | extern void call_once (once_flag *__flag, void (*__func)(void));
|       |             ^~~~~~~~~

Regards,
Martin Jansa April 9, 2026, 9:29 p.m. UTC | #2
On Thu, Apr 9, 2026 at 9:17 PM Yoann Congal <yoann.congal@smile.fr> wrote:
>
> On Thu Apr 9, 2026 at 5:28 PM CEST, Martin Jansa via lists.openembedded.org wrote:
> > From: Martin Jansa <martin.jansa@gmail.com>
> >
> > glibc-2.43 isn't used in OE builds yet, but this fixes dtc-native:
> > https://errors.yoctoproject.org/Errors/Details/903983/
> >
> > ../sources/dtc-1.7.2/libfdt/fdt_overlay.c: In function ‘overlay_fixup_phandle’:
> > ../sources/dtc-1.7.2/libfdt/fdt_overlay.c:424:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> >   424 |                 sep = memchr(fixup_str, ':', fixup_len);
> >       |                     ^
> > ../sources/dtc-1.7.2/libfdt/fdt_overlay.c:434:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> >   434 |                 sep = memchr(name, ':', fixup_len);
> >       |                     ^
> > cc1: all warnings being treated as errors
> >
> > Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
> > Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> > ---
>
> Hello,
>
> I've started a whinlatter bringup build on the new Ubuntu 26.04 worker
> with this series applied:
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/96/builds/23
>
> It got 2 errors (Other errors are most likely consequences of these ones):
>
> ERROR: shadow-native-4.18.0-r0 do_configure: configure failed:
> https://autobuilder.yoctoproject.org/valkyrie/?#/builders/96/builds/23/steps/12/logs/stdio line 6269:
> | checking for crypt in -lcrypt... no
> | configure: error: crypt() not found
> | NOTE: The following config.log files may provide further information.
> | NOTE: /srv/pokybuild/yocto-worker/bringup/build/build/tmp/work/x86_64-linux/shadow-native/4.18.0/build/config.log
> | ERROR: configure failed
> | WARNING: exit code 1 from a shell command.
> NOTE: recipe shadow-native-4.18.0-r0: task do_configure: Failed

Hello,

for shadow please read
https://lists.openembedded.org/g/openembedded-core/message/234119 the
important part:
"libcrypt-dev is no longer installed as a dependency in my minimal docker image"
I guess it's now missing on your ubuntu-26.04 host as well.
It used to be typically installed by build-essential -> libc6-dev ->
libcrypt-dev but not anymore since 2.42-7:

25.10 questing with 2.42-0ubuntu3.1:
https://packages.ubuntu.com/questing/libc6-dev
26.04 resolute with 2.43-2ubuntu1:
https://packages.ubuntu.com/resolute/libc6-dev

https://changelogs.ubuntu.com/changelogs/pool/main/g/glibc/glibc_2.43-2ubuntu1/changelog:
...
glibc (2.42-7) unstable; urgency=medium

  [ Aurelien Jarno ]
  * debian/control.in/libc, debian/rules.d/debhelper.mk: drop libcrypt-dev
    dependency from libc6-dev. Thanks to Helmut Grohne for proposing that,
    doing an archive rebuild and filling the bug reports.
  * debian/control.in/main, debian/sysdeps/linux.mk: enable SystemTap static
    probes.
  * debian/debhelper.in/libc-dev.NEWS: add a NEWS entry about the removal of
    the obsolete termio interface.  Closes: #1124068.
  * debian/rules.d/debhelper.mk: ensure that linker scripts work even when
    /usr is unmerged.  Closes: #1120508
  * debian/debhelper.in/libc-dev{,-alt}.lintian-overrides,
    source/lintian-overrides, rules.d/debhelper.mk, salsa-ci.yml: drop
    unpack-message-for-{orig,source} overrides, fixed in lintian 2.128.0.
  * debian/control.in/main: drop Rules-Requires-Root: no, this is now the
    default.
  * debian/libc6.symbols.i386, debian/libc6-i386.symbols.{amd64,x32}: remove
    the workaround for GLIBC_ABI_GNU_TLS.  Closes: #1122038.
  * debian/control.in/{libc,i386}: ensure that libdpkg-perl is fixed wrt
    GLIBC_ABI_GNU_TLS.

 -- Aurelien Jarno <aurel32@debian.org>  Sun, 04 Jan 2026 10:07:24 +0100
...


I'll have a look at virglrenderer-native tomorrow. khem already fixed it in:
https://gitlab.freedesktop.org/virgl/virglrenderer/-/commit/3f0f775edb2df5ea54c37863286ad565ccddb276
https://git.openembedded.org/openembedded-core/commit/?id=8e85dc6b7f5f7668a610b5fd3754c716f0af65b0
https://git.openembedded.org/openembedded-core/commit/?id=5ff5aac9ed9e53a2e06515cc480c7d89a8aa3171
will add a backport in whinlatter and possibly scarthgap as well.

Regards,

> ERROR: virglrenderer-native-1.1.1-r0 do_compile: Execution of '/srv/pokybuild/yocto-worker/bringup/build/build/tmp/work/x86_64-linux/virglrenderer-native/1.1.1/temp/run.do_compile.2048675' failed with exit code 1
> https://autobuilder.yoctoproject.org/valkyrie/?#/builders/96/builds/23/steps/12/logs/stdio line 29545:
> | [4/57] gcc -Isrc/mesa/libmesa.a.p -Isrc/mesa -I../sources/virglrenderer-1.1.1/src/mesa -I../sources/virglrenderer-1.1.1/src/mesa/compat -I../sources/virglrenderer-1.1.1/src/mesa/pipe -I../sources/virglrenderer-1.1.1/src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -Werror=format -fvisibility=hidden -fno-strict-aliasing -imacros /srv/pokybuild/yocto-worker/bringup/build/build/tmp/work/x86_64-linux/virglrenderer-native/1.1.1/build/config.h -DHAVE_CONFIG_H=1 -isystem/srv/pokybuild/yocto-worker/bringup/build/build/tmp/work/x86_64-linux/virglrenderer-native/1.1.1/recipe-sysroot-native/usr/include -O2 -pipe -fPIC -pthread -MD -MQ src/mesa/libmesa.a.p/util_u_math.c.o -MF src/mesa/libmesa.a.p/util_u_math.c.o.d -o src/mesa/libmesa.a.p/util_u_math.c.o -c ../sources/virglrenderer-1.1.1/src/mesa/util/u_math.c
> | FAILED: [code=1] src/mesa/libmesa.a.p/util_u_math.c.o
> | gcc -Isrc/mesa/libmesa.a.p -Isrc/mesa -I../sources/virglrenderer-1.1.1/src/mesa -I../sources/virglrenderer-1.1.1/src/mesa/compat -I../sources/virglrenderer-1.1.1/src/mesa/pipe -I../sources/virglrenderer-1.1.1/src/mesa/util -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu11 -Werror=enum-int-mismatch -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pedantic -Wmissing-prototypes -Werror=incompatible-pointer-types -Werror=int-to-pointer-cast -Werror=switch -Wno-overlength-strings -Wno-missing-field-initializers -Werror=format -fvisibility=hidden -fno-strict-aliasing -imacros /srv/pokybuild/yocto-worker/bringup/build/build/tmp/work/x86_64-linux/virglrenderer-native/1.1.1/build/config.h -DHAVE_CONFIG_H=1 -isystem/srv/pokybuild/yocto-worker/bringup/build/build/tmp/work/x86_64-linux/virglrenderer-native/1.1.1/recipe-sysroot-native/usr/include -O2 -pipe -fPIC -pthread -MD -MQ src/mesa/libmesa.a.p/util_u_math.c.o -MF src/mesa/libmesa.a.p/util_u_math.c.o.d -o src/mesa/libmesa.a.p/util_u_math.c.o -c ../sources/virglrenderer-1.1.1/src/mesa/util/u_math.c
> | In file included from ../sources/virglrenderer-1.1.1/src/mesa/compat/c11/threads.h:64,
> |                  from ../sources/virglrenderer-1.1.1/src/mesa/util/u_thread.h:35,
> |                  from ../sources/virglrenderer-1.1.1/src/mesa/util/u_cpu_detect.h:40,
> |                  from ../sources/virglrenderer-1.1.1/src/mesa/util/u_math.c:32:
> | ../sources/virglrenderer-1.1.1/src/mesa/compat/c11/threads_posix.h:54:9: warning: ‘ONCE_FLAG_INIT’ redefined
> |    54 | #define ONCE_FLAG_INIT PTHREAD_ONCE_INIT
> |       |         ^~~~~~~~~~~~~~
> | In file included from /usr/include/stdlib.h:1191,
> |                  from ../sources/virglrenderer-1.1.1/src/mesa/compat/c11/threads_posix.h:29:
> | /usr/include/x86_64-linux-gnu/bits/types/once_flag.h:25:9: note: this is the location of the previous definition
> |    25 | #define ONCE_FLAG_INIT __ONCE_FLAG_INIT
> |       |         ^~~~~~~~~~~~~~
> | ../sources/virglrenderer-1.1.1/src/mesa/compat/c11/threads_posix.h:69:25: error: conflicting types for ‘once_flag’; have ‘pthread_once_t’ {aka ‘int’}
> |    69 | typedef pthread_once_t  once_flag;
> |       |                         ^~~~~~~~~
> | /usr/include/x86_64-linux-gnu/bits/types/once_flag.h:24:21: note: previous declaration of ‘once_flag’ with type ‘once_flag’
> |    24 | typedef __once_flag once_flag;
> |       |                     ^~~~~~~~~
> | ../sources/virglrenderer-1.1.1/src/mesa/compat/c11/threads_posix.h:94:1: error: conflicting types for ‘call_once’; have ‘void(int *, void (*)(void))’
> |    94 | call_once(once_flag *flag, void (*func)(void))
> |       | ^~~~~~~~~
> | /usr/include/stdlib.h:1195:13: note: previous declaration of ‘call_once’ with type ‘void(once_flag *, void (*)(void))’
> |  1195 | extern void call_once (once_flag *__flag, void (*__func)(void));
> |       |             ^~~~~~~~~
>
> Regards,
>
> --
> Yoann Congal
> Smile ECS
>
diff mbox series

Patch

diff --git a/meta/recipes-kernel/dtc/dtc/0001-Fix-discarded-const-qualifiers.patch b/meta/recipes-kernel/dtc/dtc/0001-Fix-discarded-const-qualifiers.patch
new file mode 100644
index 0000000000..053a94f0bf
--- /dev/null
+++ b/meta/recipes-kernel/dtc/dtc/0001-Fix-discarded-const-qualifiers.patch
@@ -0,0 +1,83 @@ 
+From c58beee7bec0774f12202511c97beb741ff2b534 Mon Sep 17 00:00:00 2001
+From: Stephen Gallagher <sgallagh@redhat.com>
+Date: Tue, 6 Jan 2026 14:19:30 -0500
+Subject: [PATCH] Fix discarded const qualifiers
+
+It's unsafe to implicitly discard the const qualifier on a pointer. In
+overlay_fixup_phandle(), this was probably just an oversight, and making
+the "sep" variable a const char * is sufficient to fix it.
+
+In create_node(), however, the "p" variable is directly modifying the
+buffer pointed to by "const char* node_name". To fix this, we need to
+actually make a duplicate of the buffer and operate on that instead.
+
+This introduces a malloc()/free()  and an unbounded strdup() into the
+operation, but fdtput isn't a long-running service and the node_name
+argument comes directly from argv, so this shouldn't introduce a
+significant performance impact.
+
+Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
+Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
+Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
+Upstream-Status: Backport [https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/libfdt/fdt_overlay.c?h=main&id=9a1c801a1a3c102bf95c5339c9e985b26b823a21]
+---
+ fdtput.c             | 8 +++++---
+ libfdt/fdt_overlay.c | 3 ++-
+ meson.build          | 1 +
+ 3 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/fdtput.c b/fdtput.c
+index c2fecf4..8deec7e 100644
+--- a/fdtput.c
++++ b/fdtput.c
+@@ -230,19 +230,21 @@ static int create_paths(char **blob, const char *in_path)
+ static int create_node(char **blob, const char *node_name)
+ {
+ 	int node = 0;
+-	char *p;
++	const char *p;
++	char *path = NULL;
+ 
+ 	p = strrchr(node_name, '/');
+ 	if (!p) {
+ 		report_error(node_name, -1, -FDT_ERR_BADPATH);
+ 		return -1;
+ 	}
+-	*p = '\0';
+ 
+ 	*blob = realloc_node(*blob, p + 1);
+ 
+ 	if (p > node_name) {
+-		node = fdt_path_offset(*blob, node_name);
++		path = xstrndup(node_name, (size_t)(p - node_name));
++		node = fdt_path_offset(*blob, path);
++		free(path);
+ 		if (node < 0) {
+ 			report_error(node_name, -1, node);
+ 			return -1;
+diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c
+index 28b667f..5f8aa62 100644
+--- a/libfdt/fdt_overlay.c
++++ b/libfdt/fdt_overlay.c
+@@ -409,7 +409,8 @@ static int overlay_fixup_phandle(void *fdt, void *fdto, int symbols_off,
+ 		const char *fixup_str = value;
+ 		uint32_t path_len, name_len;
+ 		uint32_t fixup_len;
+-		char *sep, *endptr;
++		const char *sep;
++		char *endptr;
+ 		int poffset, ret;
+ 
+ 		fixup_end = memchr(value, '\0', len);
+diff --git a/meson.build b/meson.build
+index 310699f..2966b06 100644
+--- a/meson.build
++++ b/meson.build
+@@ -18,6 +18,7 @@ add_project_arguments(
+     '-Wshadow',
+     '-Wsuggest-attribute=format',
+     '-Wwrite-strings',
++    '-Wdiscarded-qualifiers',
+   ]),
+   language: 'c'
+ )
diff --git a/meta/recipes-kernel/dtc/dtc_1.7.2.bb b/meta/recipes-kernel/dtc/dtc_1.7.2.bb
index 92e83a9404..b8b79542c5 100644
--- a/meta/recipes-kernel/dtc/dtc_1.7.2.bb
+++ b/meta/recipes-kernel/dtc/dtc_1.7.2.bb
@@ -10,6 +10,7 @@  LIC_FILES_CHKSUM = "file://GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
 
 SRC_URI = " \
     git://git.kernel.org/pub/scm/utils/dtc/dtc.git;branch=main;protocol=https \
+    file://0001-Fix-discarded-const-qualifiers.patch \
 "
 SRCREV = "2d10aa2afe35527728db30b35ec491ecb6959e5c"