Skip to content

Commit c83e17c

Browse files
tmediccixiaoxiang781216
authored andcommitted
interpreters/python: Fix symbol collision with list_length function
NuttX implements a function with the same name which may end up being included whenever `CONFIG_MM_KERNEL_HEAP` is set. To avoid it, insert a prefix to it on Python's implementation. Please note that the other patches had their metadata updated too.
1 parent 3f823f9 commit c83e17c

15 files changed

+84
-39
lines changed

interpreters/python/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ $(CPYTHON_UNPACKNAME): $(CPYTHON_ZIP)
8383
$(Q) patch -p1 -d $(CPYTHON_UNPACKNAME) < patch$(DELIM)0011-avoid-redefinition-warning-if-UNUSED-is-already-defi.patch
8484
$(Q) patch -p1 -d $(CPYTHON_UNPACKNAME) < patch$(DELIM)0012-hack-place-_PyRuntime-structure-into-PSRAM-bss-regio.patch
8585
$(Q) patch -p1 -d $(CPYTHON_UNPACKNAME) < patch$(DELIM)0013-transform-functions-used-by-NuttX-to-lowercase.patch
86+
$(Q) patch -p1 -d $(CPYTHON_UNPACKNAME) < patch$(DELIM)0014-insert-prefix-to-list_length-to-avoid-symbol-collisi.patch
8687

8788
$(HOSTPYTHON):
8889
mkdir -p $(HOSTBUILD)

interpreters/python/patch/0001-workaround-newlib-resource.h-limitations.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 3917fd37644948096c6bebf53e701b59fa527cf5 Mon Sep 17 00:00:00 2001
1+
From b96f875c54e2d888413a701eb9727d704b995ce0 Mon Sep 17 00:00:00 2001
22
From: Ivan Grokhotkov <[email protected]>
33
Date: Tue, 22 Oct 2024 23:58:17 +0200
4-
Subject: [PATCH 01/11] workaround newlib resource.h limitations
4+
Subject: [PATCH 01/14] workaround newlib resource.h limitations
55

66
configure script checks if resource.h is available but doesn't check
77
if it defines all the necessary functions.
@@ -27,5 +27,5 @@ index b62362f2777..327d883f94e 100644
2727

2828
/* Disable creation of core dump */
2929
--
30-
2.46.1
30+
2.50.0
3131

interpreters/python/patch/0002-fix-various-uint32_t-unsigned-int-type-mismatch-issu.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 562138b0486ad050b5ce601d434910973ff6f094 Mon Sep 17 00:00:00 2001
1+
From 2c684af739d366dce8392ee2bb9af8248283e323 Mon Sep 17 00:00:00 2001
22
From: Ivan Grokhotkov <[email protected]>
33
Date: Wed, 23 Oct 2024 16:48:49 +0200
4-
Subject: [PATCH 02/11] fix various uint32_t/'unsigned int' type mismatch
4+
Subject: [PATCH 02/14] fix various uint32_t/'unsigned int' type mismatch
55
issues
66

77
In a few places existing code assumes that uint32_t == unsigned int.
@@ -149,5 +149,5 @@ index c911c302003..9c640e0ab65 100644
149149
assert(_PyASCIIObject_CAST(name)->hash != -1);
150150
OBJECT_STAT_INC_COND(type_cache_collisions, entry->name != Py_None && entry->name != name);
151151
--
152-
2.46.1
152+
2.50.0
153153

interpreters/python/patch/0003-reuse-wasm_assets.py-for-generating-an-archive-of-py.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From dcc6b2b6aa396f96e7c9efe3e793d96c7004ef4f Mon Sep 17 00:00:00 2001
1+
From 41728277acd7eba4e500d0b4ddd02198b92cf6ac Mon Sep 17 00:00:00 2001
22
From: Ivan Grokhotkov <[email protected]>
33
Date: Wed, 23 Oct 2024 16:54:39 +0200
4-
Subject: [PATCH 03/11] reuse wasm_assets.py for generating an archive of
4+
Subject: [PATCH 03/14] reuse wasm_assets.py for generating an archive of
55
python lib dir
66

77
wasm_assets.py is a useful script to prepare the smallest possible
@@ -39,5 +39,5 @@ index ffa5e303412..381d4819c39 100755
3939
args.wasm_stdlib = args.wasm_root / WASM_STDLIB
4040
args.wasm_dynload = args.wasm_root / WASM_DYNLOAD
4141
--
42-
2.46.1
42+
2.50.0
4343

interpreters/python/patch/0004-recognize-nuttx-as-a-supported-OS.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From ff067ccb26c91de352de362a25d87bcbabe924dc Mon Sep 17 00:00:00 2001
1+
From 9965644a9cee6c85a726d21ff2ed6f1e42445941 Mon Sep 17 00:00:00 2001
22
From: Ivan Grokhotkov <[email protected]>
33
Date: Wed, 23 Oct 2024 16:55:53 +0200
4-
Subject: [PATCH 04/11] recognize *-*-nuttx as a supported OS
4+
Subject: [PATCH 04/14] recognize *-*-nuttx as a supported OS
55

66
cpython's configure script bails out when cross-compiling for an
77
unknown OS, so we have to add "nuttx" to the list, even though it
@@ -57,5 +57,5 @@ index 24e28a1e2de..80d6738fab5 100644
5757
# for now, limit cross builds to known configurations
5858
MACHDEP="unknown"
5959
--
60-
2.46.1
60+
2.50.0
6161

interpreters/python/patch/0005-gh-122907-Fix-Builds-Without-HAVE_DYNAMIC_LOADING-Se.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 7e646549488f2d3de4cf1e04ad975625342a9218 Mon Sep 17 00:00:00 2001
1+
From d5c061676d7ee6f1fb963bdf79791e37b5b05a36 Mon Sep 17 00:00:00 2001
22
From: Eric Snow <[email protected]>
33
Date: Tue, 13 Aug 2024 14:44:57 -0600
4-
Subject: [PATCH 05/11] gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set
4+
Subject: [PATCH 05/14] gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set
55
(gh-122952)
66

77
As of 529a160 (gh-118204), building with HAVE_DYNAMIC_LOADING stopped working. This is a minimal fix just to get builds working again. There are actually a number of long-standing deficiencies with HAVE_DYNAMIC_LOADING builds that need to be resolved separately.
@@ -186,5 +186,5 @@ index 7de35b499da..66b2a262e11 100644
186186
raise
187187

188188
--
189-
2.46.1
189+
2.50.0
190190

interpreters/python/patch/0006-change-var-name-to-avoid-conflict-with-nuttx-unused_.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 82a3c7c021324e4245289c565b2d379b83ed4be3 Mon Sep 17 00:00:00 2001
1+
From 221e92fa16864f8a590091b643fc40050bab163c Mon Sep 17 00:00:00 2001
22
From: Tiago Medicci <[email protected]>
33
Date: Wed, 13 Nov 2024 14:20:36 -0300
4-
Subject: [PATCH 06/11] change var name to avoid conflict with nuttx
4+
Subject: [PATCH 06/14] change var name to avoid conflict with nuttx
55
unused_data macro
66

77
Signed-off-by: Tiago Medicci <[email protected]>
@@ -165,5 +165,5 @@ index 034a9420b16..595d4ad32e9 100644
165165
{"needs_input", Py_T_BOOL, offsetof(ZlibDecompressor, needs_input), Py_READONLY,
166166
ZlibDecompressor_needs_input_doc},
167167
--
168-
2.46.1
168+
2.50.0
169169

interpreters/python/patch/0007-undef-atexit_register.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 7eab2315d75d5e78e67e0b049ebb2fc71914b7ea Mon Sep 17 00:00:00 2001
1+
From 6ebe2333a7862532aa50e7286db9ea8b9df895c4 Mon Sep 17 00:00:00 2001
22
From: Tiago Medicci <[email protected]>
33
Date: Wed, 13 Nov 2024 14:22:04 -0300
4-
Subject: [PATCH 07/11] undef atexit_register
4+
Subject: [PATCH 07/14] undef atexit_register
55

66
Even if not built, nuttx/include/nuttx/atexit.h defines it and this
77
causes conflicts.
@@ -27,5 +27,5 @@ index 297a8d74ba3..1fea72fbc99 100644
2727
atexit_register(PyObject *module, PyObject *args, PyObject *kwargs)
2828
{
2929
--
30-
2.46.1
30+
2.50.0
3131

interpreters/python/patch/0008-declare-struct-timeval.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From fc042cfa496f37f2a859495ad281583f79af0044 Mon Sep 17 00:00:00 2001
1+
From ce41aed2d663d6a7278b83bcdc2dc0adb65b9f5c Mon Sep 17 00:00:00 2001
22
From: Tiago Medicci <[email protected]>
33
Date: Wed, 13 Nov 2024 14:23:34 -0300
4-
Subject: [PATCH 08/11] declare struct timeval
4+
Subject: [PATCH 08/14] declare struct timeval
55

66
Otherwise, build will fail due to redefinition of _PyTime_FromTimeval
77

@@ -25,5 +25,5 @@ index 205ac5d3781..c30e07f4b4a 100644
2525
#define _SIZEOF_PYTIME_T 8
2626

2727
--
28-
2.46.1
28+
2.50.0
2929

interpreters/python/patch/0009-include-nuttx-sys-select-header-to-define-FD_SETSIZE.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 3d140751ebec3aedd8ed3cdf2a7eff5009693112 Mon Sep 17 00:00:00 2001
1+
From 682b331c77974ef5f051b39f30f3a5af4f7789d1 Mon Sep 17 00:00:00 2001
22
From: Tiago Medicci <[email protected]>
33
Date: Thu, 14 Nov 2024 13:44:49 -0300
4-
Subject: [PATCH 09/11] include nuttx sys/select header to define FD_SETSIZE
4+
Subject: [PATCH 09/14] include nuttx sys/select header to define FD_SETSIZE
55

66
Signed-off-by: Tiago Medicci <[email protected]>
77
---
@@ -24,5 +24,5 @@ index 5bd9b7732a4..e9fab839122 100644
2424
# ifndef WIN32_LEAN_AND_MEAN
2525
# define WIN32_LEAN_AND_MEAN
2626
--
27-
2.46.1
27+
2.50.0
2828

0 commit comments

Comments
 (0)