Skip to content

Commit 83e6fca

Browse files
committed
Add UndefinedBehaviorSanitizer support
1 parent a9957cd commit 83e6fca

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ prefix=/usr/local
5050
#CONFIG_ASAN=y
5151
# use memory sanitizer
5252
#CONFIG_MSAN=y
53+
# use UB sanitizer
54+
#CONFIG_UBSAN=y
5355
# include the code for BigInt/BigFloat/BigDecimal and math mode
5456
CONFIG_BIGNUM=y
5557

@@ -133,6 +135,10 @@ ifdef CONFIG_MSAN
133135
CFLAGS+=-fsanitize=memory -fno-omit-frame-pointer
134136
LDFLAGS+=-fsanitize=memory -fno-omit-frame-pointer
135137
endif
138+
ifdef CONFIG_UBSAN
139+
CFLAGS+=-fsanitize=undefined -fno-omit-frame-pointer
140+
LDFLAGS+=-fsanitize=undefined -fno-omit-frame-pointer
141+
endif
136142
ifdef CONFIG_WIN32
137143
LDEXPORT=
138144
else
@@ -163,13 +169,15 @@ endif
163169
ifeq ($(CROSS_PREFIX),)
164170
ifndef CONFIG_ASAN
165171
ifndef CONFIG_MSAN
172+
ifndef CONFIG_UBSAN
166173
PROGS+=examples/hello examples/hello_module examples/test_fib
167174
ifndef CONFIG_DARWIN
168175
PROGS+=examples/fib.so examples/point.so
169176
endif
170177
endif
171178
endif
172179
endif
180+
endif
173181

174182
all: $(OBJDIR) $(OBJDIR)/quickjs.check.o $(OBJDIR)/qjs.check.o $(PROGS)
175183

0 commit comments

Comments
 (0)