diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include index efa7ccaef..75e729250 100644 --- a/boards/native/Makefile.include +++ b/boards/native/Makefile.include @@ -90,6 +90,9 @@ all-debug: export CFLAGS += -g all-cachegrind: export CFLAGS += -g all-gprof: export CFLAGS += -pg all-gprof: export LINKFLAGS += -pg +all-asan: export CFLAGS += -fsanitize=address -fno-omit-frame-pointer -g +all-asan: export CFLAGS += -DNATIVE_IN_CALLOC +all-asan: export LINKFLAGS += -fsanitize=address -fno-omit-frame-pointer -g export INCLUDES += $(NATIVEINCLUDES) @@ -121,6 +124,8 @@ all-debug: all all-gprof: all +all-asan: all + all-valgrind: all all-cachegrind: all diff --git a/cpu/native/syscalls.c b/cpu/native/syscalls.c index a9852dc8b..4c5b9df87 100644 --- a/cpu/native/syscalls.c +++ b/cpu/native/syscalls.c @@ -149,7 +149,11 @@ void free(void *ptr) _native_syscall_leave(); } +#ifdef NATIVE_IN_CALLOC +int _native_in_calloc = 1; +#else int _native_in_calloc = 0; +#endif void *calloc(size_t nmemb, size_t size) { /* dynamically load calloc when it's needed - this is necessary to