From 43f963c96703b60475c41bde9ac729aa86135264 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Wed, 6 May 2026 16:47:55 +0300 Subject: [PATCH] Rebuild with python 3.14 --- pkg.info | 6 +- ...801a1a3c102bf95c5339c9e985b26b823a21.patch | 81 +++++++++++++++++++ ...f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch} | 8 +- source-files/glibc-2.41.patch | 39 --------- source.sh | 10 ++- 5 files changed, 96 insertions(+), 48 deletions(-) create mode 100644 source-files/9a1c801a1a3c102bf95c5339c9e985b26b823a21.patch rename source-files/{swig-4.3.patch => 9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch} (96%) delete mode 100644 source-files/glibc-2.41.patch diff --git a/pkg.info b/pkg.info index f962ab8..507cb21 100644 --- a/pkg.info +++ b/pkg.info @@ -1,7 +1,7 @@ name: dtc description: Device tree compiler version: 1.7.2 -revision: 1 +revision: 2 url: https://www.devicetree.org/ license: GPL2-only architecture: any @@ -10,11 +10,13 @@ depends: - glibc - libyaml optional_depends: - - python + - python3=3.14.*:For python bindings make_depends: - meson + - python3=3.14.* - python-setuptools-scm - swig + - valgrind downloads: - url: https://kernel.org/pub/software/utils/dtc/dtc-${BPM_PKG_VERSION}.tar.xz extract_to: ${BPM_SOURCE} diff --git a/source-files/9a1c801a1a3c102bf95c5339c9e985b26b823a21.patch b/source-files/9a1c801a1a3c102bf95c5339c9e985b26b823a21.patch new file mode 100644 index 0000000..3b8e511 --- /dev/null +++ b/source-files/9a1c801a1a3c102bf95c5339c9e985b26b823a21.patch @@ -0,0 +1,81 @@ +From 9a1c801a1a3c102bf95c5339c9e985b26b823a21 Mon Sep 17 00:00:00 2001 +From: Stephen Gallagher +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 +Signed-off-by: David Gibson +--- + 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 05f2b933..fdb581a2 100644 +--- a/fdtput.c ++++ b/fdtput.c +@@ -254,19 +254,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 e6b9eb64..51a38596 100644 +--- a/libfdt/fdt_overlay.c ++++ b/libfdt/fdt_overlay.c +@@ -407,7 +407,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 66b44e87..501b706c 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/source-files/swig-4.3.patch b/source-files/9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch similarity index 96% rename from source-files/swig-4.3.patch rename to source-files/9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch index 48317b8..fccad57 100644 --- a/source-files/swig-4.3.patch +++ b/source-files/9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch @@ -1,7 +1,8 @@ From 9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5 Mon Sep 17 00:00:00 2001 From: Brandon Maier Date: Sun, 24 Nov 2024 15:48:04 -0600 -Subject: pylibfdt/libfdt.i: fix backwards compatibility of return values +Subject: [PATCH] pylibfdt/libfdt.i: fix backwards compatibility of return + values When our Python functions wrap `fdt_getprop()` they return a list containing `[*data, length]`. @@ -25,7 +26,7 @@ Signed-off-by: David Gibson 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i -index 9f5b6a9..bb9985c 100644 +index 9f5b6a9c..bb9985c3 100644 --- a/pylibfdt/libfdt.i +++ b/pylibfdt/libfdt.i @@ -114,11 +114,14 @@ def check_err_null(val, quiet=()): @@ -83,6 +84,3 @@ index 9f5b6a9..bb9985c 100644 return True def get_phandle(self, nodeoffset): --- -cgit 1.2.3-korg - diff --git a/source-files/glibc-2.41.patch b/source-files/glibc-2.41.patch deleted file mode 100644 index fc47087..0000000 --- a/source-files/glibc-2.41.patch +++ /dev/null @@ -1,39 +0,0 @@ -From ce1d8588880aecd7af264e422a16a8b33617cef7 Mon Sep 17 00:00:00 2001 -From: David Gibson -Date: Wed, 5 Feb 2025 13:39:43 +1100 -Subject: tests: When building .so from -O asm output mark as non-executable - stack - -For certain tests, we take the output from dtc -O asm and build it into -a .so shared library which we then dlopen() for further tests. Because we -don't mark it otherwise, it's treated as requiring an executable stack, -which dlopen() refuses to open as of glibc-2.41. - -Of course, the library is pure data, no code, so it certainly doesn't need -an executable stack. Add the -znoexecstack linker option to avoid the -error. - -Fixes: https://github.com/dgibson/dtc/issues/163 - -Reported-by: Xi Ruoyao -Signed-off-by: David Gibson ---- - tests/run_tests.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/run_tests.sh b/tests/run_tests.sh -index 937b128..f0b51c0 100755 ---- a/tests/run_tests.sh -+++ b/tests/run_tests.sh -@@ -201,7 +201,7 @@ run_dtc_test () { - } - - asm_to_so () { -- $CC -shared -o $1.test.so "$SRCDIR/data.S" $1.test.s -+ $CC -shared -Wl,-znoexecstack -o $1.test.so "$SRCDIR/data.S" $1.test.s - } - - asm_to_so_test () { --- -cgit 1.2.3-korg - diff --git a/source.sh b/source.sh index ea24ead..f68e190 100644 --- a/source.sh +++ b/source.sh @@ -6,8 +6,14 @@ # This function is used for putting downloaded files to the correct location or applying patches prepare() { cd "$BPM_SOURCE" - patch -Np1 -i "$BPM_WORKDIR"/swig-4.3.patch - patch -Np1 -i "$BPM_WORKDIR"/glibc-2.41.patch + + # pylibfdt/libfdt.i: fix backwards compatibility of return values + patch -Np1 -i "$BPM_WORKDIR"/9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5.patch + + # Fix discarded const qualifiers + patch -Np1 -i "$BPM_WORKDIR"/9a1c801a1a3c102bf95c5339c9e985b26b823a21.patch + + # Add uutils compatibility patch -Np1 -i "$BPM_WORKDIR"/add-uutils-compatibility.patch }