adds wrapping to all clib symbols
This commit is contained in:
parent
acf20a4818
commit
41f204e304
|
@ -50,7 +50,7 @@ LIBWRAP_SYMS := \
|
|||
isatty \
|
||||
times \
|
||||
sbrk _sbrk\
|
||||
_exit \
|
||||
exit _exit \
|
||||
puts _puts\
|
||||
printf \
|
||||
sprintf
|
||||
|
@ -60,6 +60,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)
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
|
||||
#include <unistd.h>
|
||||
#include "platform.h"
|
||||
#include "weak_under_alias.h"
|
||||
|
||||
extern volatile uint32_t tohost;
|
||||
extern volatile uint32_t fromhost;
|
||||
void write_hex(int fd, uint32_t hex);
|
||||
|
||||
void __wrap__exit(int code)
|
||||
void __wrap_exit(int code)
|
||||
{
|
||||
//volatile uint32_t* leds = (uint32_t*) (GPIO_BASE_ADDR + GPIO_OUT_OFFSET);
|
||||
const char message[] = "\nProgam has exited with code:";
|
||||
|
@ -20,3 +21,4 @@ void __wrap__exit(int code)
|
|||
write(STDERR_FILENO, "\x04", 1);
|
||||
for (;;);
|
||||
}
|
||||
weak_under_alias(exit);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/* See LICENSE of license details. */
|
||||
#include "weak_under_alias.h"
|
||||
|
||||
int __wrap_getpid(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
weak_under_alias(getpid);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue