From cd4579d1064014f7f83b6dc65e6051a50944deda Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 1 Nov 2023 04:30:34 +0100 Subject: [PATCH] Add MemorySanitizer support --- Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 419a3a4..9f84859 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,8 @@ prefix=/usr/local #CONFIG_PROFILE=y # use address sanitizer #CONFIG_ASAN=y +# use memory sanitizer +#CONFIG_MSAN=y # include the code for BigInt/BigFloat/BigDecimal and math mode CONFIG_BIGNUM=y @@ -127,6 +129,10 @@ ifdef CONFIG_ASAN CFLAGS+=-fsanitize=address -fno-omit-frame-pointer LDFLAGS+=-fsanitize=address -fno-omit-frame-pointer endif +ifdef CONFIG_MSAN +CFLAGS+=-fsanitize=memory -fno-omit-frame-pointer +LDFLAGS+=-fsanitize=memory -fno-omit-frame-pointer +endif ifdef CONFIG_WIN32 LDEXPORT= else @@ -155,15 +161,15 @@ endif # examples ifeq ($(CROSS_PREFIX),) -ifdef CONFIG_ASAN -PROGS+= -else +ifndef CONFIG_ASAN +ifndef CONFIG_MSAN PROGS+=examples/hello examples/hello_module examples/test_fib ifndef CONFIG_DARWIN PROGS+=examples/fib.so examples/point.so endif endif endif +endif all: $(OBJDIR) $(OBJDIR)/quickjs.check.o $(OBJDIR)/qjs.check.o $(PROGS)