From c8696293a975b57ef7af2957dfce209be6574e2a Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Tue, 4 Feb 2020 08:52:13 -0600 Subject: [PATCH] libc: fix build issue with posix fs APIs on xtensa On xtensa we always need to implement the reentrant fs syscall functions. So remove the #ifndef CONFIG_POSIX_API protection around them and add needed externs. Signed-off-by: Kumar Gala --- lib/libc/newlib/libc-hooks.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/libc/newlib/libc-hooks.c b/lib/libc/newlib/libc-hooks.c index 0cb4de68e54..bb551c6ed59 100644 --- a/lib/libc/newlib/libc-hooks.c +++ b/lib/libc/newlib/libc-hooks.c @@ -272,10 +272,14 @@ __weak int *__errno(void) } #if CONFIG_XTENSA +extern int _read(int fd, char *buf, int nbytes); +extern int _open(const char *name, int mode); +extern int _close(int file); +extern int _lseek(int file, int ptr, int dir); + /* The Newlib in xtensa toolchain has a few missing functions for the * reentrant versions of the syscalls. */ -#ifndef CONFIG_POSIX_API _ssize_t _read_r(struct _reent *r, int fd, void *buf, size_t nbytes) { ARG_UNUSED(r); @@ -311,7 +315,6 @@ _off_t _lseek_r(struct _reent *r, int file, _off_t ptr, int dir) return _lseek(file, ptr, dir); } -#endif int _isatty_r(struct _reent *r, int file) {