summaryrefslogtreecommitdiff
path: root/bsp
diff options
context:
space:
mode:
Diffstat (limited to 'bsp')
-rw-r--r--bsp/libwrap/libwrap.mk1
-rw-r--r--bsp/libwrap/sys/_exit.c4
-rw-r--r--bsp/libwrap/sys/close.c2
-rw-r--r--bsp/libwrap/sys/execve.c2
-rw-r--r--bsp/libwrap/sys/fstat.c2
-rw-r--r--bsp/libwrap/sys/getpid.c2
-rw-r--r--bsp/libwrap/sys/isatty.c2
-rw-r--r--bsp/libwrap/sys/kill.c2
-rw-r--r--bsp/libwrap/sys/link.c2
-rw-r--r--bsp/libwrap/sys/lseek.c2
-rw-r--r--bsp/libwrap/sys/open.c2
-rw-r--r--bsp/libwrap/sys/openat.c2
-rw-r--r--bsp/libwrap/sys/puts.c2
-rw-r--r--bsp/libwrap/sys/read.c2
-rw-r--r--bsp/libwrap/sys/sbrk.c2
-rw-r--r--bsp/libwrap/sys/stat.c2
-rw-r--r--bsp/libwrap/sys/times.c2
-rw-r--r--bsp/libwrap/sys/unlink.c2
-rw-r--r--bsp/libwrap/sys/weak_under_alias.h7
-rw-r--r--bsp/libwrap/sys/write.c2
20 files changed, 45 insertions, 1 deletions
diff --git a/bsp/libwrap/libwrap.mk b/bsp/libwrap/libwrap.mk
index ce224ac..71bba3d 100644
--- a/bsp/libwrap/libwrap.mk
+++ b/bsp/libwrap/libwrap.mk
@@ -42,6 +42,7 @@ LIBWRAP := libwrap.a
LINK_DEPS += $(LIBWRAP)
LDFLAGS += $(foreach s,$(LIBWRAP_SYMS),-Wl,--wrap=$(s))
+LDFLAGS += $(foreach s,$(LIBWRAP_SYMS),-Wl,--wrap=_$(s))
LDFLAGS += -L. -Wl,--start-group -lwrap -lc -Wl,--end-group
CLEAN_OBJS += $(LIBWRAP_OBJS)
diff --git a/bsp/libwrap/sys/_exit.c b/bsp/libwrap/sys/_exit.c
index a548a91..011464f 100644
--- a/bsp/libwrap/sys/_exit.c
+++ b/bsp/libwrap/sys/_exit.c
@@ -2,8 +2,9 @@
#include <unistd.h>
#include "platform.h"
+#include "weak_under_alias.h"
-void __wrap__exit(int code)
+void __wrap_exit(int code)
{
const char message[] = "\nProgam has exited with code:";
@@ -13,3 +14,4 @@ void __wrap__exit(int code)
for (;;);
}
+weak_under_alias(exit);
diff --git a/bsp/libwrap/sys/close.c b/bsp/libwrap/sys/close.c
index e4f8e14..199fe51 100644
--- a/bsp/libwrap/sys/close.c
+++ b/bsp/libwrap/sys/close.c
@@ -2,8 +2,10 @@
#include <errno.h>
#include "stub.h"
+#include "weak_under_alias.h"
int __wrap_close(int fd)
{
return _stub(EBADF);
}
+weak_under_alias(close);
diff --git a/bsp/libwrap/sys/execve.c b/bsp/libwrap/sys/execve.c
index 6178a01..f7be25a 100644
--- a/bsp/libwrap/sys/execve.c
+++ b/bsp/libwrap/sys/execve.c
@@ -2,8 +2,10 @@
#include <errno.h>
#include "stub.h"
+#include "weak_under_alias.h"
int __wrap_execve(const char* name, char* const argv[], char* const env[])
{
return _stub(ENOMEM);
}
+weak_under_alias(execve);
diff --git a/bsp/libwrap/sys/fstat.c b/bsp/libwrap/sys/fstat.c
index 6ea3e6a..ff82bf9 100644
--- a/bsp/libwrap/sys/fstat.c
+++ b/bsp/libwrap/sys/fstat.c
@@ -4,6 +4,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include "stub.h"
+#include "weak_under_alias.h"
int __wrap_fstat(int fd, struct stat* st)
{
@@ -14,3 +15,4 @@ int __wrap_fstat(int fd, struct stat* st)
return _stub(EBADF);
}
+weak_under_alias(fstat);
diff --git a/bsp/libwrap/sys/getpid.c b/bsp/libwrap/sys/getpid.c
index 5aa510b..195fbec 100644
--- a/bsp/libwrap/sys/getpid.c
+++ b/bsp/libwrap/sys/getpid.c
@@ -1,6 +1,8 @@
/* See LICENSE of license details. */
+#include "weak_under_alias.h"
int __wrap_getpid(void)
{
return 1;
}
+weak_under_alias(getpid);
diff --git a/bsp/libwrap/sys/isatty.c b/bsp/libwrap/sys/isatty.c
index 55eab0a..7bb82ab 100644
--- a/bsp/libwrap/sys/isatty.c
+++ b/bsp/libwrap/sys/isatty.c
@@ -1,6 +1,7 @@
/* See LICENSE of license details. */
#include <unistd.h>
+#include "weak_under_alias.h"
int __wrap_isatty(int fd)
{
@@ -9,3 +10,4 @@ int __wrap_isatty(int fd)
return 0;
}
+weak_under_alias(isatty);
diff --git a/bsp/libwrap/sys/kill.c b/bsp/libwrap/sys/kill.c
index 9c56632..18b9bd4 100644
--- a/bsp/libwrap/sys/kill.c
+++ b/bsp/libwrap/sys/kill.c
@@ -2,8 +2,10 @@
#include <errno.h>
#include "stub.h"
+#include "weak_under_alias.h"
int __wrap_kill(int pid, int sig)
{
return _stub(EINVAL);
}
+weak_under_alias(kill);
diff --git a/bsp/libwrap/sys/link.c b/bsp/libwrap/sys/link.c
index 9340cad..0cad551 100644
--- a/bsp/libwrap/sys/link.c
+++ b/bsp/libwrap/sys/link.c
@@ -2,8 +2,10 @@
#include <errno.h>
#include "stub.h"
+#include "weak_under_alias.h"
int __wrap_link(const char *old_name, const char *new_name)
{
return _stub(EMLINK);
}
+weak_under_alias(link);
diff --git a/bsp/libwrap/sys/lseek.c b/bsp/libwrap/sys/lseek.c
index 46f58fa..4131449 100644
--- a/bsp/libwrap/sys/lseek.c
+++ b/bsp/libwrap/sys/lseek.c
@@ -4,6 +4,7 @@
#include <unistd.h>
#include <sys/types.h>
#include "stub.h"
+#include "weak_under_alias.h"
off_t __wrap_lseek(int fd, off_t ptr, int dir)
{
@@ -12,3 +13,4 @@ off_t __wrap_lseek(int fd, off_t ptr, int dir)
return _stub(EBADF);
}
+weak_under_alias(lseek);
diff --git a/bsp/libwrap/sys/open.c b/bsp/libwrap/sys/open.c
index d1871f9..c61415a 100644
--- a/bsp/libwrap/sys/open.c
+++ b/bsp/libwrap/sys/open.c
@@ -2,8 +2,10 @@
#include <errno.h>
#include "stub.h"
+#include "weak_under_alias.h"
int __wrap_open(const char* name, int flags, int mode)
{
return _stub(ENOENT);
}
+weak_under_alias(open);
diff --git a/bsp/libwrap/sys/openat.c b/bsp/libwrap/sys/openat.c
index 7f1c945..227c956 100644
--- a/bsp/libwrap/sys/openat.c
+++ b/bsp/libwrap/sys/openat.c
@@ -2,8 +2,10 @@
#include <errno.h>
#include "stub.h"
+#include "weak_under_alias.h"
int __wrap_openat(int dirfd, const char* name, int flags, int mode)
{
return _stub(ENOENT);
}
+weak_under_alias(openat);
diff --git a/bsp/libwrap/sys/puts.c b/bsp/libwrap/sys/puts.c
index f77f1a3..50d6437 100644
--- a/bsp/libwrap/sys/puts.c
+++ b/bsp/libwrap/sys/puts.c
@@ -7,6 +7,7 @@
#include "platform.h"
#include "stub.h"
+#include "weak_under_alias.h"
int __wrap_puts(const char *s)
{
@@ -24,3 +25,4 @@ int __wrap_puts(const char *s)
return 0;
}
+weak_under_alias(puts);
diff --git a/bsp/libwrap/sys/read.c b/bsp/libwrap/sys/read.c
index 4e35364..3226cdb 100644
--- a/bsp/libwrap/sys/read.c
+++ b/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,4 @@ ssize_t __wrap_read(int fd, void* ptr, size_t len)
return _stub(EBADF);
}
+weak_under_alias(read);
diff --git a/bsp/libwrap/sys/sbrk.c b/bsp/libwrap/sys/sbrk.c
index 6e6b36a..12170b4 100644
--- a/bsp/libwrap/sys/sbrk.c
+++ b/bsp/libwrap/sys/sbrk.c
@@ -1,6 +1,7 @@
/* See LICENSE of license details. */
#include <stddef.h>
+#include "weak_under_alias.h"
void *__wrap_sbrk(ptrdiff_t incr)
{
@@ -14,3 +15,4 @@ void *__wrap_sbrk(ptrdiff_t incr)
curbrk += incr;
return curbrk - incr;
}
+weak_under_alias(sbrk);
diff --git a/bsp/libwrap/sys/stat.c b/bsp/libwrap/sys/stat.c
index 1ccc2f4..1576ca1 100644
--- a/bsp/libwrap/sys/stat.c
+++ b/bsp/libwrap/sys/stat.c
@@ -3,8 +3,10 @@
#include <errno.h>
#include <sys/stat.h>
#include "stub.h"
+#include "weak_under_alias.h"
int __wrap_stat(const char* file, struct stat* st)
{
return _stub(EACCES);
}
+weak_under_alias(stat);
diff --git a/bsp/libwrap/sys/times.c b/bsp/libwrap/sys/times.c
index 26a9566..55969a7 100644
--- a/bsp/libwrap/sys/times.c
+++ b/bsp/libwrap/sys/times.c
@@ -3,8 +3,10 @@
#include <errno.h>
#include <sys/times.h>
#include "stub.h"
+#include "weak_under_alias.h"
clock_t __wrap_times(struct tms* buf)
{
return _stub(EACCES);
}
+weak_under_alias(times);
diff --git a/bsp/libwrap/sys/unlink.c b/bsp/libwrap/sys/unlink.c
index b62b1ba..09f4da7 100644
--- a/bsp/libwrap/sys/unlink.c
+++ b/bsp/libwrap/sys/unlink.c
@@ -2,8 +2,10 @@
#include <errno.h>
#include "stub.h"
+#include "weak_under_alias.h"
int __wrap_unlink(const char* name)
{
return _stub(ENOENT);
}
+weak_under_alias(unlink);
diff --git a/bsp/libwrap/sys/weak_under_alias.h b/bsp/libwrap/sys/weak_under_alias.h
new file mode 100644
index 0000000..7629353
--- /dev/null
+++ b/bsp/libwrap/sys/weak_under_alias.h
@@ -0,0 +1,7 @@
+#ifndef _BSP_LIBWRAP_WEAK_UNDER_ALIAS_H
+#define _BSP_LIBWRAP_WEAK_UNDER_ALIAS_H
+
+#define weak_under_alias(name) \
+ extern __typeof (__wrap_##name) __wrap__##name __attribute__ ((weak, alias ("__wrap_"#name)))
+
+#endif
diff --git a/bsp/libwrap/sys/write.c b/bsp/libwrap/sys/write.c
index d00eb17..b1e9a7e 100644
--- a/bsp/libwrap/sys/write.c
+++ b/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);