summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2016-01-31 16:08:21 +0100
committerClifford Wolf <clifford@clifford.at>2016-01-31 16:08:21 +0100
commitfe97110be0179b522ec03f942f47c4cc4174c590 (patch)
tree123ea4bbf77e11f267b956ee83456daf0fbd2752
parent8b3f8cd22076aede76682eec0bbd57aae0c8c657 (diff)
Addedd clang sanitizers
-rw-r--r--Makefile21
1 files changed, 21 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 3dff837f..c20d8024 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,14 @@ ENABLE_LIBYOSYS := 0
ENABLE_GPROF := 0
ENABLE_NDEBUG := 0
+# clang sanitizers
+SANITIZER =
+# SANITIZER = address
+# SANITIZER = memory
+# SANITIZER = undefined
+# SANITIZER = cfi
+
+
PREFIX ?= /usr/local
INSTALL_SUDO :=
@@ -88,6 +96,19 @@ ifeq ($(CONFIG),clang)
CXX = clang
CXXFLAGS += -std=c++11 -Os
+ifneq ($(SANITIZER),)
+$(info [Clang Sanitizer] $(SANITIZER))
+CXXFLAGS += -g -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=$(SANITIZER)
+LDFLAGS += -g -fsanitize=$(SANITIZER)
+ifeq ($(SANITIZER),address)
+ENABLE_COVER := 0
+endif
+ifeq ($(SANITIZER),cfi)
+CXXFLAGS += -flto
+LDFLAGS += -flto
+endif
+endif
+
else ifeq ($(CONFIG),gcc)
CXX = gcc
CXXFLAGS += -std=gnu++0x -Os