From ff605b5b1dfb24bca08023d197b76e9c3221bea8 Mon Sep 17 00:00:00 2001 From: Chen-Yuanmeng <2784841400@qq.com> Date: Mon, 20 Jul 2026 04:23:38 +0800 Subject: [PATCH 1/2] bsp: fix native libc type conflicts --- bsp/abstract-machine/include/extra.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bsp/abstract-machine/include/extra.h b/bsp/abstract-machine/include/extra.h index 27c72f4a51ce..0931a30dce28 100644 --- a/bsp/abstract-machine/include/extra.h +++ b/bsp/abstract-machine/include/extra.h @@ -1,6 +1,17 @@ +#ifndef __RTTHREAD_AM_EXTRA_H__ +#define __RTTHREAD_AM_EXTRA_H__ + +#ifdef __ISA_NATIVE__ +/* glibc uses __timeval_defined, while RT-Thread checks this guard. */ +#define _TIMEVAL_DEFINED + +/* Use the host libc definitions when AM runs as a native process. */ +#include +#else typedef long suseconds_t; typedef unsigned long useconds_t; #include +#endif #ifdef __ISA_NATIVE__ // rename posix API to avoid conflict with glibc in native @@ -36,3 +47,5 @@ typedef unsigned long useconds_t; #define gettimeofday rt_gettimeofday #endif + +#endif /* __RTTHREAD_AM_EXTRA_H__ */ From 22885a2ea1c8f42ab5370cff64d0960b3a8a5f2f Mon Sep 17 00:00:00 2001 From: Chen-Yuanmeng <2784841400@qq.com> Date: Mon, 20 Jul 2026 04:33:15 +0800 Subject: [PATCH 2/2] bsp: preserve GOT symbol when integrating AM apps --- bsp/abstract-machine/integrate-am-apps.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bsp/abstract-machine/integrate-am-apps.py b/bsp/abstract-machine/integrate-am-apps.py index 8968df387054..60463d8aeee9 100644 --- a/bsp/abstract-machine/integrate-am-apps.py +++ b/bsp/abstract-machine/integrate-am-apps.py @@ -30,6 +30,8 @@ am_app_mk_fp = open(f"build/{ARCH}/am-apps.mk", "w") am_app_c_fp = open("build/am-apps.c" , "w") lib_sym = [ + # Linker-reserved symbol; do not namespace it with the application prefix. + "_GLOBAL_OFFSET_TABLE_", "memset", "memcpy", "memmove", "memcmp", "strlen", "strcat", "strcpy", "strncpy", "strcmp", "strncmp", "srand", "rand", "malloc", "free", "abs", "atoi",