For the hosted implementation, we just need to pass the appropriate options at compile and link time. No further arch-specific code needed. Signed-off-by: Ahmad Fatoum <ahmad@xxxxxx> --- arch/sandbox/Kconfig | 2 ++ arch/sandbox/Makefile | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index 5227cb624f2b..254ae9a5d30c 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -2,6 +2,8 @@ config SANDBOX bool select OFTREE select GPIOLIB + select ARCH_HAS_UBSAN_SANITIZE_ALL + select HAVE_ARCH_KASAN default y config ARCH_TEXT_BASE diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile index 85c70b5e8059..1504b2390ddd 100644 --- a/arch/sandbox/Makefile +++ b/arch/sandbox/Makefile @@ -45,9 +45,20 @@ ifeq ($(CONFIG_GPIO_LIBFTDI1),y) FTDI1_LIBS := $(shell pkg-config libftdi1 --libs) endif +ifeq ($(CONFIG_KASAN),y) +SANITIZERS += -fsanitize=address +endif + +ifeq ($(CONFIG_UBSAN),y) +SANITIZERS += $(CFLAGS_UBSAN) +endif + +CPPFLAGS += $(SANITIZERS) + 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) \ + $(SANITIZERS) common-y += $(BOARD) arch/sandbox/os/ -- 2.20.1 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox