Files
Alexis Lothoré 3b52fe6f2e package/dtc: fix host build with glibc 2.43
When trying to build host-dtc on a host with glibc 2.43, the build fails
on the following error:

  libfdt/fdt_overlay.c: In function ‘overlay_fixup_phandle’:
  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);
        |                     ^
  libfdt/fdt_overlay.c:434:21: error: assignment discards ‘const’
  qualifier from pointer target type [-Werror=discarded-qualifiers]
    434 |                 sep = memchr(name, ':', fixup_len);
        |                     ^
  fdtput.c: In function ‘create_node’:
  fdtput.c:235:11: error: assignment discards ‘const’ qualifier from
  pointer target type [-Werror=discarded-qualifiers]
    235 |         p = strrchr(node_name, '/');
        |           ^
  cc1: all warnings being treated as errors
  make[2]: *** [Makefile:359: fdtput.o] Error 1
  make[2]: *** Waiting for unfinished jobs....
  cc1: all warnings being treated as errors
  make[2]: *** [Makefile:359: libfdt/fdt_overlay.o] Error 1
  make[1]: *** [package/pkg-generic.mk:273:
  /home/alexis/src/buildroot/dtc/build/host-dtc-1.7.2/.stamp_built] Error 2
  make: *** [Makefile:83: _all] Error 2

The issue can be reproduced on master with this minimal defconfig on a
host having glibc 2.43:

  BR2_x86_64=y
  BR2_TOOLCHAIN_EXTERNAL=y
  BR2_PACKAGE_QORIQ_MC_UTILS=y

(QORIQ_MC_UTILS will pull HOST_DTC)

This error is due to some functions prototype update in glibc 2.43 for
ISO C23 (see [1], point 3 in the NEWS list). The corresponding fix has
already been integrated upstream, but it has not been released since
then.

Bring the corresponding upstream patch to allow host-dtc to build on
affected hosts.

[1] https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2026-02-16 21:19:46 +01:00
..
2024-11-09 16:29:09 +01:00