[CRIU] [PATCH 4/6] Makefile: add AddressSanitizer to CFLAGS
Andrey Ryabinin
aryabinin at virtuozzo.com
Mon Feb 6 02:14:15 PST 2017
This allows to build criu with AddressSanitizer enabled:
make ASAN=1 -j<N>
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
Makefile | 6 ++++++
compel/plugins/Makefile | 2 ++
criu/pie/Makefile | 1 +
criu/pie/Makefile.library | 2 ++
4 files changed, 11 insertions(+)
diff --git a/Makefile b/Makefile
index 9a7901b..92e94eb 100644
--- a/Makefile
+++ b/Makefile
@@ -111,6 +111,12 @@ ifneq ($(GCOV),)
CFLAGS += $(CFLAGS-GCOV)
endif
+ifeq ($(ASAN),1)
+ CFLAGS-ASAN := -fsanitize=address
+ export CFLAGS-ASAN
+ CFLAGS += $(CFLAGS-ASAN)
+endif
+
ifneq ($(WERROR),0)
WARNINGS += -Werror
endif
diff --git a/compel/plugins/Makefile b/compel/plugins/Makefile
index 5873240..ebae812 100644
--- a/compel/plugins/Makefile
+++ b/compel/plugins/Makefile
@@ -1,6 +1,8 @@
.PHONY: .FORCE
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) -DCR_NOGLIBC
+CFLAGS := $(filter-out $(CFLAGS-ASAN),$(CFLAGS))
+
PLUGIN_ARCH_DIR := compel/arch/$(ARCH)/plugins
#
diff --git a/criu/pie/Makefile b/criu/pie/Makefile
index 74c59b3..f6e9ff2 100644
--- a/criu/pie/Makefile
+++ b/criu/pie/Makefile
@@ -21,6 +21,7 @@ endif
# project.
#
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS))
+CFLAGS := $(filter-out $(CFLAGS-ASAN),$(CFLAGS))
CFLAGS += -iquote $(SRC_DIR)/criu/arch/$(ARCH)/include
CFLAGS += -iquote $(SRC_DIR)/criu/include
CFLAGS += -iquote $(SRC_DIR)/include
diff --git a/criu/pie/Makefile.library b/criu/pie/Makefile.library
index f6a1b42..dc23c81 100644
--- a/criu/pie/Makefile.library
+++ b/criu/pie/Makefile.library
@@ -41,6 +41,8 @@ iquotes := -iquote $(SRC_DIR)/$(PIE_DIR)/piegen
iquotes += -iquote $(SRC_DIR)/$(ARCH_DIR)/include
iquotes += -iquote $(SRC_DIR) -iquote $(SRC_DIR)/criu/include -iquote $(SRC_DIR)/include
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) $(iquotes)
+CFLAGS := $(filter-out $(CFLAGS-ASAN),$(CFLAGS))
+
asflags-y := -D__ASSEMBLY__ $(iquotes)
ccflags-y += $(COMPEL_UAPI_INCLUDES)
--
2.10.2
More information about the CRIU
mailing list