commit f1d331615d645e29bc719d7f81ad54ed46f9207b
parent e901c096cd5049ed59211d75eddb96ec512801fe
Author: Ben Noordhuis <info@bnoordhuis.nl>
Date: Wed, 1 Nov 2023 05:00:43 +0100
Add UndefinedBehaviorSanitizer support
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/quickjs/Makefile b/quickjs/Makefile
@@ -46,6 +46,8 @@ PREFIX?=/usr/local
# use memory sanitizer
#CONFIG_MSAN=y
# include the code for BigFloat/BigDecimal, math mode and faster large integers
+# use UB sanitizer
+#CONFIG_UBSAN=y
CONFIG_BIGNUM=y
OBJDIR=.obj
@@ -149,6 +151,10 @@ ifdef CONFIG_MSAN
CFLAGS+=-fsanitize=memory -fno-omit-frame-pointer
LDFLAGS+=-fsanitize=memory -fno-omit-frame-pointer
endif
+ifdef CONFIG_UBSAN
+CFLAGS+=-fsanitize=undefined -fno-omit-frame-pointer
+LDFLAGS+=-fsanitize=undefined -fno-omit-frame-pointer
+endif
ifdef CONFIG_WIN32
LDEXPORT=
else
@@ -185,6 +191,7 @@ endif
ifeq ($(CROSS_PREFIX),)
ifndef CONFIG_ASAN
ifndef CONFIG_MSAN
+ifndef CONFIG_UBSAN
PROGS+=examples/hello examples/hello_module examples/test_fib
ifdef CONFIG_SHARED_LIBS
PROGS+=examples/fib.so examples/point.so
@@ -192,6 +199,7 @@ endif
endif
endif
endif
+endif
all: $(OBJDIR) $(OBJDIR)/quickjs.check.o $(OBJDIR)/qjs.check.o $(PROGS)