Skip to content

Commit cd4579d

Browse files
committed
Add MemorySanitizer support
1 parent f8b3a2e commit cd4579d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ prefix=/usr/local
4848
#CONFIG_PROFILE=y
4949
# use address sanitizer
5050
#CONFIG_ASAN=y
51+
# use memory sanitizer
52+
#CONFIG_MSAN=y
5153
# include the code for BigInt/BigFloat/BigDecimal and math mode
5254
CONFIG_BIGNUM=y
5355

@@ -127,6 +129,10 @@ ifdef CONFIG_ASAN
127129
CFLAGS+=-fsanitize=address -fno-omit-frame-pointer
128130
LDFLAGS+=-fsanitize=address -fno-omit-frame-pointer
129131
endif
132+
ifdef CONFIG_MSAN
133+
CFLAGS+=-fsanitize=memory -fno-omit-frame-pointer
134+
LDFLAGS+=-fsanitize=memory -fno-omit-frame-pointer
135+
endif
130136
ifdef CONFIG_WIN32
131137
LDEXPORT=
132138
else
@@ -155,15 +161,15 @@ endif
155161

156162
# examples
157163
ifeq ($(CROSS_PREFIX),)
158-
ifdef CONFIG_ASAN
159-
PROGS+=
160-
else
164+
ifndef CONFIG_ASAN
165+
ifndef CONFIG_MSAN
161166
PROGS+=examples/hello examples/hello_module examples/test_fib
162167
ifndef CONFIG_DARWIN
163168
PROGS+=examples/fib.so examples/point.so
164169
endif
165170
endif
166171
endif
172+
endif
167173

168174
all: $(OBJDIR) $(OBJDIR)/quickjs.check.o $(OBJDIR)/qjs.check.o $(PROGS)
169175

0 commit comments

Comments
 (0)