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__ */ 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",