From aab4d1f2a051e905ceab74790e9f7dc3062e1e32 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 28 Sep 2023 11:51:20 +0200 Subject: [PATCH] adds missing symbols and sources for libwrap --- bare-metal-bsp/libwrap/libwrap.mk | 28 ++++++++++++++++++++++++---- bare-metal-bsp/libwrap/sys/close.c | 4 ++++ bare-metal-bsp/libwrap/sys/fstat.c | 3 +++ bare-metal-bsp/libwrap/sys/lseek.c | 4 ++++ bare-metal-bsp/libwrap/sys/read.c | 3 +++ bare-metal-bsp/libwrap/sys/sbrk.c | 3 +++ bare-metal-bsp/libwrap/sys/write.c | 2 ++ 7 files changed, 43 insertions(+), 4 deletions(-) diff --git a/bare-metal-bsp/libwrap/libwrap.mk b/bare-metal-bsp/libwrap/libwrap.mk index fc5e8da..345e993 100644 --- a/bare-metal-bsp/libwrap/libwrap.mk +++ b/bare-metal-bsp/libwrap/libwrap.mk @@ -24,16 +24,36 @@ LIBWRAP_SRCS := \ sys/times.c \ sys/sbrk.c \ sys/_exit.c \ + sys/puts.c \ misc/write_hex.c \ sys/printf.c LIBWRAP_SRCS := $(foreach f,$(LIBWRAP_SRCS),$(LIBWRAP_DIR)/$(f)) LIBWRAP_OBJS := $(LIBWRAP_SRCS:.c=.o) -LIBWRAP_SYMS := malloc free \ - open lseek read write fstat stat close link unlink \ - execve fork getpid kill wait \ - isatty times sbrk _exit +LIBWRAP_SYMS := \ + malloc \ + open \ + lseek _lseek\ + read _read\ + write _write\ + fstat _fstat\ + stat \ + close _close\ + link \ + unlink \ + execve \ + fork \ + getpid \ + kill \ + wait \ + isatty \ + times \ + sbrk _sbrk\ + _exit \ + puts _puts\ + printf \ + sprintf LIBWRAP := libwrap.a diff --git a/bare-metal-bsp/libwrap/sys/close.c b/bare-metal-bsp/libwrap/sys/close.c index e4f8e14..5f047c8 100644 --- a/bare-metal-bsp/libwrap/sys/close.c +++ b/bare-metal-bsp/libwrap/sys/close.c @@ -2,8 +2,12 @@ #include #include "stub.h" +#include "weak_under_alias.h" int __wrap_close(int fd) { return _stub(EBADF); } + +weak_under_alias(close); + diff --git a/bare-metal-bsp/libwrap/sys/fstat.c b/bare-metal-bsp/libwrap/sys/fstat.c index 6ea3e6a..41ad12c 100644 --- a/bare-metal-bsp/libwrap/sys/fstat.c +++ b/bare-metal-bsp/libwrap/sys/fstat.c @@ -4,6 +4,7 @@ #include #include #include "stub.h" +#include "weak_under_alias.h" int __wrap_fstat(int fd, struct stat* st) { @@ -14,3 +15,5 @@ int __wrap_fstat(int fd, struct stat* st) return _stub(EBADF); } + +weak_under_alias(fstat); diff --git a/bare-metal-bsp/libwrap/sys/lseek.c b/bare-metal-bsp/libwrap/sys/lseek.c index 46f58fa..74488c7 100644 --- a/bare-metal-bsp/libwrap/sys/lseek.c +++ b/bare-metal-bsp/libwrap/sys/lseek.c @@ -4,6 +4,7 @@ #include #include #include "stub.h" +#include "weak_under_alias.h" off_t __wrap_lseek(int fd, off_t ptr, int dir) { @@ -12,3 +13,6 @@ off_t __wrap_lseek(int fd, off_t ptr, int dir) return _stub(EBADF); } + +weak_under_alias(lseek); + diff --git a/bare-metal-bsp/libwrap/sys/read.c b/bare-metal-bsp/libwrap/sys/read.c index 4e57f08..7910756 100644 --- a/bare-metal-bsp/libwrap/sys/read.c +++ b/bare-metal-bsp/libwrap/sys/read.c @@ -7,6 +7,7 @@ #include "platform.h" #include "stub.h" +#include "weak_under_alias.h" ssize_t __wrap_read(int fd, void* ptr, size_t len) { @@ -28,3 +29,5 @@ ssize_t __wrap_read(int fd, void* ptr, size_t len) return _stub(EBADF); } +weak_under_alias(read); + diff --git a/bare-metal-bsp/libwrap/sys/sbrk.c b/bare-metal-bsp/libwrap/sys/sbrk.c index 6e6b36a..a43c191 100644 --- a/bare-metal-bsp/libwrap/sys/sbrk.c +++ b/bare-metal-bsp/libwrap/sys/sbrk.c @@ -1,6 +1,7 @@ /* See LICENSE of license details. */ #include +#include "weak_under_alias.h" void *__wrap_sbrk(ptrdiff_t incr) { @@ -14,3 +15,5 @@ void *__wrap_sbrk(ptrdiff_t incr) curbrk += incr; return curbrk - incr; } + +weak_under_alias(sbrk); diff --git a/bare-metal-bsp/libwrap/sys/write.c b/bare-metal-bsp/libwrap/sys/write.c index d00eb17..b1e9a7e 100644 --- a/bare-metal-bsp/libwrap/sys/write.c +++ b/bare-metal-bsp/libwrap/sys/write.c @@ -7,6 +7,7 @@ #include "platform.h" #include "stub.h" +#include "weak_under_alias.h" ssize_t __wrap_write(int fd, const void* ptr, size_t len) { @@ -27,3 +28,4 @@ ssize_t __wrap_write(int fd, const void* ptr, size_t len) return _stub(EBADF); } +weak_under_alias(write);