Rebuild with python 3.14

This commit is contained in:
2026-05-06 16:47:55 +03:00
parent e0e380c69f
commit 43f963c967
5 changed files with 96 additions and 48 deletions
@@ -0,0 +1,81 @@
From 9a1c801a1a3c102bf95c5339c9e985b26b823a21 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <[email protected]>
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 <[email protected]>
Signed-off-by: David Gibson <[email protected]>
---
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'
)
@@ -1,7 +1,8 @@
From 9a969f3b70b07bbf1c9df44a38d7f8d1d3a6e2a5 Mon Sep 17 00:00:00 2001
From: Brandon Maier <[email protected]>
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 <[email protected]>
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
-39
View File
@@ -1,39 +0,0 @@
From ce1d8588880aecd7af264e422a16a8b33617cef7 Mon Sep 17 00:00:00 2001
From: David Gibson <[email protected]>
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 <[email protected]>
Signed-off-by: David Gibson <[email protected]>
---
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