summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/Makefile
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2019-08-27 17:09:18 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-09-09 15:16:08 +0200
commit22f38edf93da46f5149849666df64beeb5d973fe (patch)
tree59288c2198637b412b148d5346d4ef190370416a /arch/sandbox/Makefile
parente098835f87dc56f6fa4399d7000af8e1f413bf1d (diff)
downloadbarebox-22f38edf93da46f5149849666df64beeb5d973fe.tar.gz
barebox-22f38edf93da46f5149849666df64beeb5d973fe.tar.xz
sandbox: support Address and UndefinedBehavior sanitizers
For the hosted implementation, we just need to pass the appropriate options at compile and link time. No further arch-specific code needed. Because we define our own handlers in lib/ubsan.c, linking against libubsan isn't strictly required. We do it anyway on sandbox, so we can use the backtrace functionality within. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/Makefile')
-rw-r--r--arch/sandbox/Makefile12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index ee6fcf3951..52ad4850cb 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -45,9 +45,19 @@ ifeq ($(CONFIG_GPIO_LIBFTDI1),y)
FTDI1_LIBS := $(shell pkg-config libftdi1 --libs)
endif
+ifeq ($(CONFIG_KASAN),y)
+CPPFLAGS += -fsanitize=address
+SANITIZER_LIBS += -fsanitize=address
+endif
+
+ifeq ($(CONFIG_UBSAN),y)
+SANITIZER_LIBS += -fsanitize=undefined
+endif
+
cmd_barebox__ = $(CC) -o $@ -Wl,-T,$(barebox-lds) \
-Wl,--start-group $(barebox-common) -Wl,--end-group \
- -lrt -lpthread $(SDL_LIBS) $(FTDI1_LIBS)
+ -lrt -lpthread $(SDL_LIBS) $(FTDI1_LIBS) \
+ $(SANITIZER_LIBS)
common-y += $(BOARD) arch/sandbox/os/ arch/sandbox/lib/