Skip to content

Commit

Permalink
Add MemorySanitizer support
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Nov 1, 2023
1 parent f8b3a2e commit cd4579d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit cd4579d

Please sign in to comment.