From 147901c2cbb798caf2e9fb340d9b065b76f2c954 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Sun, 11 Oct 2015 15:37:34 +0800 Subject: [PATCH] [Libc] Export more symbols for libc. --- components/libc/armlibc/libc_syms.c | 39 ++++++++++++++++++++++++ components/libc/armlibc/mem_std.c | 4 +++ components/libc/newlib/libc_sym.c | 47 +++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 components/libc/armlibc/libc_syms.c create mode 100644 components/libc/newlib/libc_sym.c diff --git a/components/libc/armlibc/libc_syms.c b/components/libc/armlibc/libc_syms.c new file mode 100644 index 0000000000..847c48544a --- /dev/null +++ b/components/libc/armlibc/libc_syms.c @@ -0,0 +1,39 @@ +#include +#include +#include +#include +#include + +#include + +/* some export routines for module */ + +RTM_EXPORT(strstr); +RTM_EXPORT(strlen); +RTM_EXPORT(strchr); +RTM_EXPORT(strcpy); +RTM_EXPORT(strncpy); +RTM_EXPORT(strcmp); +RTM_EXPORT(strncmp); +RTM_EXPORT(strcat); +RTM_EXPORT(strtol); + +RTM_EXPORT(memcpy); +RTM_EXPORT(memcmp); +RTM_EXPORT(memmove); +RTM_EXPORT(memset); +RTM_EXPORT(memchr); + +RTM_EXPORT(toupper); +RTM_EXPORT(atoi); + +RTM_EXPORT(localtime); +RTM_EXPORT(time); + +/* import the full stdio for printf */ +#ifdef __MICROLIB +#error "[RT_USING_LIBC] Please use standard libc but not microlib." +#endif + +RTM_EXPORT(puts); +RTM_EXPORT(printf); diff --git a/components/libc/armlibc/mem_std.c b/components/libc/armlibc/mem_std.c index 6faf86555f..56aa525df2 100644 --- a/components/libc/armlibc/mem_std.c +++ b/components/libc/armlibc/mem_std.c @@ -22,18 +22,22 @@ void *malloc(int n) { return rt_malloc(n); } +RTM_EXPORT(malloc); void *realloc(void *rmem, rt_size_t newsize) { return rt_realloc(rmem, newsize); } +RTM_EXPORT(realloc); void *calloc(rt_size_t nelem, rt_size_t elsize) { return rt_calloc(nelem, elsize); } +RTM_EXPORT(calloc); void free(void *rmem) { rt_free(rmem); } +RTM_EXPORT(free); diff --git a/components/libc/newlib/libc_sym.c b/components/libc/newlib/libc_sym.c new file mode 100644 index 0000000000..48e488f5d8 --- /dev/null +++ b/components/libc/newlib/libc_sym.c @@ -0,0 +1,47 @@ +#include +#include + +#include +#include +#include + +RTM_EXPORT(strcpy); +RTM_EXPORT(strncpy); +RTM_EXPORT(strlen); +RTM_EXPORT(strcat); +RTM_EXPORT(strstr); +RTM_EXPORT(strchr); +RTM_EXPORT(strcmp); +RTM_EXPORT(strtol); +RTM_EXPORT(strtoul); +RTM_EXPORT(strncmp); + +RTM_EXPORT(memcpy); +RTM_EXPORT(memcmp); +RTM_EXPORT(memmove); +RTM_EXPORT(memset); +RTM_EXPORT(memchr); + +RTM_EXPORT(putchar); +RTM_EXPORT(puts); +RTM_EXPORT(printf); +RTM_EXPORT(sprintf); +RTM_EXPORT(snprintf); + +RTM_EXPORT(fwrite); + +#include +RTM_EXPORT(localtime); +RTM_EXPORT(time); + +#include +RTM_EXPORT(longjmp); +RTM_EXPORT(setjmp); + +RTM_EXPORT(exit); +RTM_EXPORT(abort); + +RTM_EXPORT(rand); + +#include +RTM_EXPORT(__assert_func);