Skip to content

Commit 147901c

Browse files
committed
[Libc] Export more symbols for libc.
1 parent 3fb53ad commit 147901c

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <string.h>
4+
#include <ctype.h>
5+
#include <time.h>
6+
7+
#include <rtm.h>
8+
9+
/* some export routines for module */
10+
11+
RTM_EXPORT(strstr);
12+
RTM_EXPORT(strlen);
13+
RTM_EXPORT(strchr);
14+
RTM_EXPORT(strcpy);
15+
RTM_EXPORT(strncpy);
16+
RTM_EXPORT(strcmp);
17+
RTM_EXPORT(strncmp);
18+
RTM_EXPORT(strcat);
19+
RTM_EXPORT(strtol);
20+
21+
RTM_EXPORT(memcpy);
22+
RTM_EXPORT(memcmp);
23+
RTM_EXPORT(memmove);
24+
RTM_EXPORT(memset);
25+
RTM_EXPORT(memchr);
26+
27+
RTM_EXPORT(toupper);
28+
RTM_EXPORT(atoi);
29+
30+
RTM_EXPORT(localtime);
31+
RTM_EXPORT(time);
32+
33+
/* import the full stdio for printf */
34+
#ifdef __MICROLIB
35+
#error "[RT_USING_LIBC] Please use standard libc but not microlib."
36+
#endif
37+
38+
RTM_EXPORT(puts);
39+
RTM_EXPORT(printf);

components/libc/armlibc/mem_std.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,22 @@ void *malloc(int n)
2222
{
2323
return rt_malloc(n);
2424
}
25+
RTM_EXPORT(malloc);
2526

2627
void *realloc(void *rmem, rt_size_t newsize)
2728
{
2829
return rt_realloc(rmem, newsize);
2930
}
31+
RTM_EXPORT(realloc);
3032

3133
void *calloc(rt_size_t nelem, rt_size_t elsize)
3234
{
3335
return rt_calloc(nelem, elsize);
3436
}
37+
RTM_EXPORT(calloc);
3538

3639
void free(void *rmem)
3740
{
3841
rt_free(rmem);
3942
}
43+
RTM_EXPORT(free);

components/libc/newlib/libc_sym.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#include <rtthread.h>
2+
#include <rtm.h>
3+
4+
#include <string.h>
5+
#include <stdio.h>
6+
#include <stdlib.h>
7+
8+
RTM_EXPORT(strcpy);
9+
RTM_EXPORT(strncpy);
10+
RTM_EXPORT(strlen);
11+
RTM_EXPORT(strcat);
12+
RTM_EXPORT(strstr);
13+
RTM_EXPORT(strchr);
14+
RTM_EXPORT(strcmp);
15+
RTM_EXPORT(strtol);
16+
RTM_EXPORT(strtoul);
17+
RTM_EXPORT(strncmp);
18+
19+
RTM_EXPORT(memcpy);
20+
RTM_EXPORT(memcmp);
21+
RTM_EXPORT(memmove);
22+
RTM_EXPORT(memset);
23+
RTM_EXPORT(memchr);
24+
25+
RTM_EXPORT(putchar);
26+
RTM_EXPORT(puts);
27+
RTM_EXPORT(printf);
28+
RTM_EXPORT(sprintf);
29+
RTM_EXPORT(snprintf);
30+
31+
RTM_EXPORT(fwrite);
32+
33+
#include <time.h>
34+
RTM_EXPORT(localtime);
35+
RTM_EXPORT(time);
36+
37+
#include <setjmp.h>
38+
RTM_EXPORT(longjmp);
39+
RTM_EXPORT(setjmp);
40+
41+
RTM_EXPORT(exit);
42+
RTM_EXPORT(abort);
43+
44+
RTM_EXPORT(rand);
45+
46+
#include <assert.h>
47+
RTM_EXPORT(__assert_func);

0 commit comments

Comments
 (0)