summaryrefslogtreecommitdiff
path: root/components/libc/compilers/newlib/syscalls.c
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2021-02-28 11:09:48 +0800
committerMeco Man <[email protected]>2021-02-28 11:09:48 +0800
commitac275965f2e2d3ff730d06a8962ccaaea4f027ce (patch)
treeaada14e3a4ecffd74d672bf5ebe3b6a05dc7c607 /components/libc/compilers/newlib/syscalls.c
parent8932ffdb96b793031bbc71bb3bd23202939fcb2c (diff)
[libc][newlib] 对syscall中malloc相关桩函数做出编译调整
Diffstat (limited to 'components/libc/compilers/newlib/syscalls.c')
-rw-r--r--components/libc/compilers/newlib/syscalls.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c
index 949d8a61de..444e3960c1 100644
--- a/components/libc/compilers/newlib/syscalls.c
+++ b/components/libc/compilers/newlib/syscalls.c
@@ -189,13 +189,6 @@ _rename_r(struct _reent *ptr, const char *old, const char *new)
#endif
}
-void *
-_sbrk_r(struct _reent *ptr, ptrdiff_t incr)
-{
- /* no use this routine to get memory */
- return RT_NULL;
-}
-
int
_stat_r(struct _reent *ptr, const char *file, struct stat *pstat)
{
@@ -258,7 +251,7 @@ _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes)
#endif
}
-/* Memory routine */
+#ifdef RT_USING_HEAP /* Memory routine */
void *
_malloc_r (struct _reent *ptr, size_t size)
{
@@ -306,6 +299,15 @@ _free_r (struct _reent *ptr, void *addr)
rt_free (addr);
}
+#else
+void *
+_sbrk_r(struct _reent *ptr, ptrdiff_t incr)
+{
+ /* no use this routine to get memory */
+ return RT_NULL;
+}
+#endif /*RT_USING_HEAP*/
+
/* for exit() and abort() */
__attribute__ ((noreturn)) void
_exit (int status)