summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBen Smith <binji@chromium.org>2015-09-24 21:58:40 -0700
committerBen Smith <binji@chromium.org>2015-09-24 21:58:40 -0700
commit86233e707d3015003756a173ca9c1efd5e6f21d6 (patch)
tree7da5ce327fdd8d271a35342b8e2222028682dd72 /Makefile
parent622b090e62bcc7f33e0ac6c63427972d2e801537 (diff)
downloadwabt-86233e707d3015003756a173ca9c1efd5e6f21d6.tar.gz
wabt-86233e707d3015003756a173ca9c1efd5e6f21d6.tar.bz2
wabt-86233e707d3015003756a173ca9c1efd5e6f21d6.zip
add LSAN and fix memory leaks
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 14 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 542e7006..98c8ab55 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,18 @@
.SUFFIXES:
ALL = sexpr-wasm
-EVERYHING = $(ALL) sexpr-wasm-asan sexpr-wasm-msan
+EVERYHING = $(ALL) sexpr-wasm-asan sexpr-wasm-msan sexpr-wasm-lsan
CFLAGS = -Wall -Werror -g
DEPEND_FLAGS = -MMD -MP -MF $(patsubst %.o,%.d,$@)
ASAN_FLAGS = -fsanitize=address
MSAN_FLAGS = -fsanitize=memory
+LSAN_FLAGS = -fsanitize=leak
SRCS = sexpr-wasm.c wasm-parse.c wasm-gen.c
OBJS = $(addprefix out/,$(patsubst %.c,%.o,$(SRCS)))
ASAN_OBJS = $(addprefix out/,$(patsubst %.c,%.asan.o,$(SRCS)))
MSAN_OBJS = $(addprefix out/,$(patsubst %.c,%.msan.o,$(SRCS)))
+LSAN_OBJS = $(addprefix out/,$(patsubst %.c,%.lsan.o,$(SRCS)))
.PHONY: all
all: $(addprefix out/,$(ALL))
@@ -38,10 +40,16 @@ $(MSAN_OBJS): out/%.msan.o: src/%.c | out
out/sexpr-wasm-msan: $(MSAN_OBJS) | out
clang $(MSAN_FLAGS) -o $@ $^
+# LSAN
+$(LSAN_OBJS): out/%.lsan.o: src/%.c | out
+ clang $(LSAN_FLAGS) $(CFLAGS) -c -o $@ $(DEPEND_FLAGS) $<
+out/sexpr-wasm-lsan: $(LSAN_OBJS) | out
+ clang $(LSAN_FLAGS) -o $@ $^
+
src/hash.h: src/hash.txt
gperf --compare-strncmp --readonly-tables --struct-type $< --output-file $@
--include $(OBJS:.o=.d) $(ASAN_OBJS:.o=.d) $(MSAN_OBJS:.o=.d)
+-include $(OBJS:.o=.d) $(ASAN_OBJS:.o=.d) $(MSAN_OBJS:.o=.d) $(LSAN_OBJS:.o=.d)
#### TESTS ####
.PHONY: test
@@ -56,6 +64,10 @@ test-asan: out/sexpr-wasm-asan
test-msan: out/sexpr-wasm-msan
@python test/run-tests.py -e $<
+.PHONY: test-lsan
+test-lsan: out/sexpr-wasm-lsan
+ @python test/run-tests.py -e $<
+
#### CLEAN ####
.PHONY: clean
clean: