From 6964d623aa9f3c4a0f711c3678ed343e2db439bf Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Sun, 15 Jul 2018 16:03:40 +0800 Subject: [PATCH] [Kernel] Add strdup for armcc --- include/rtthread.h | 4 ++++ src/kservice.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/include/rtthread.h b/include/rtthread.h index 9042690212..86a1664f83 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -549,6 +549,10 @@ rt_int32_t rt_strncmp(const char *cs, const char *ct, rt_ubase_t count); rt_int32_t rt_strcmp(const char *cs, const char *ct); rt_size_t rt_strlen(const char *src); char *rt_strdup(const char *s); +#ifdef __CC_ARM +/* leak strdup interface */ +char* strdup(const char* str); +#endif char *rt_strstr(const char *str1, const char *str2); rt_int32_t rt_sscanf(const char *buf, const char *fmt, ...); diff --git a/src/kservice.c b/src/kservice.c index e3ddf3eb66..fa82ccdd80 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -531,6 +531,9 @@ char *rt_strdup(const char *s) return tmp; } RTM_EXPORT(rt_strdup); +#ifdef __CC_ARM +char *strdup(const char *s) __attribute__((alias("rt_strdup"))); +#endif #endif /**