This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 197be17904c091b53a0206d98a4605f85e48c30a
Author: wangjianyu3 <[email protected]>
AuthorDate: Sun Nov 22 10:48:21 2026 +0800

    system/toybox: rename helpers colliding in a flat link
    
    toybox's global strstart (lib/lib.c) and show_help (main.c) collide
    with other apps in a flat link.  Rename them inside toybox's own
    compile.
    
    Assisted-by: OpenCode:mimo-v2.6-pro
    Co-authored-by: multica-agent <[email protected]>
    Signed-off-by: wangjianyu3 <[email protected]>
---
 system/toybox/CMakeLists.txt | 5 +++++
 system/toybox/Makefile       | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/system/toybox/CMakeLists.txt b/system/toybox/CMakeLists.txt
index 7254d38e1..b978c6031 100644
--- a/system/toybox/CMakeLists.txt
+++ b/system/toybox/CMakeLists.txt
@@ -196,6 +196,11 @@ if(CONFIG_SYSTEM_TOYBOX)
 
   set(TOYBOX_DEFINITIONS __NuttX__ 
"TOYBOX_VERSION=\"${TOYBOX_VERSION}-nuttx\"")
 
+  # strstart and show_help leak as globals and collide with other apps in a 
flat
+  # link (e.g. quickjs's strstart); rename them in toybox's compile
+  list(APPEND TOYBOX_DEFINITIONS strstart=toybox_strstart
+       show_help=toybox_show_help)
+
   if(CONFIG_SYSTEM_TOYBOX_BUILTIN_BRIDGE)
     list(APPEND TOYBOX_DEFINITIONS CONFIG_SYSTEM_TOYBOX_BUILTIN_BRIDGE=1)
   endif()
diff --git a/system/toybox/Makefile b/system/toybox/Makefile
index 83dc282be..3b5a8f2f5 100644
--- a/system/toybox/Makefile
+++ b/system/toybox/Makefile
@@ -162,6 +162,9 @@ CFLAGS += -include $(WD)$(DELIM)compat_nuttx.h
 CFLAGS += -D__linux__
 CFLAGS += -D__NuttX__
 CFLAGS += -DTOYBOX_VERSION='"$(TOYBOX_VERSION)-nuttx"'
+# strstart/show_help leak as globals and collide in a flat link (quickjs)
+CFLAGS += -Dstrstart=toybox_strstart
+CFLAGS += -Dshow_help=toybox_show_help
 
 # Upstream Toybox coding conventions NuttX's stricter default warning set
 # (-Wall -Wshadow -Wstrict-prototypes, see arch/sim/src/sim/Toolchain.defs

Reply via email to