[CRIU] [PATCH] build: gcov -- Don't gen gcov on blobs and syscalls

Cyrill Gorcunov gorcunov at openvz.org
Thu Feb 25 00:41:30 PST 2016


They are running inside dumpee space so should not
be injected with Gcov instructions.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 Makefile                            | 5 ++++-
 criu/arch/aarch64/Makefile.syscalls | 2 ++
 criu/arch/arm/Makefile.syscalls     | 2 ++
 criu/arch/ppc64/Makefile.syscalls   | 2 ++
 criu/arch/x86/Makefile.syscalls     | 2 ++
 criu/pie/Makefile                   | 2 +-
 criu/pie/Makefile.library           | 2 +-
 7 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 99d40eedf04d..da793b88aacf 100644
--- a/Makefile
+++ b/Makefile
@@ -81,10 +81,13 @@ CFLAGS			+= $(USERCFLAGS)
 
 WARNINGS		:= -Wall
 
+CFLAGS-GCOV		:= --coverage -fno-exceptions -fno-inline
+export CFLAGS-GCOV
+
 ifeq ($(GCOV),1)
         LDFLAGS         += -lgcov
         DEBUG           := 1
-        CFLAGS          += --coverage -fno-exceptions -fno-inline
+        CFLAGS          += $(CFLAGS-GCOV)
 endif
 
 ifneq ($(WERROR),0)
diff --git a/criu/arch/aarch64/Makefile.syscalls b/criu/arch/aarch64/Makefile.syscalls
index 9b3b5387bd41..4fc185bf559e 100644
--- a/criu/arch/aarch64/Makefile.syscalls
+++ b/criu/arch/aarch64/Makefile.syscalls
@@ -1,5 +1,7 @@
 builtin-name		:= syscalls.built-in.o
 
+CFLAGS			:= $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS))
+
 SYS-TYPES		:= ../../include/syscall-types.h
 SYS-CODES		:= ../../include/syscall-codes.h
 SYS-PROTO		:= ../../include/syscall.h
diff --git a/criu/arch/arm/Makefile.syscalls b/criu/arch/arm/Makefile.syscalls
index 527960602c79..431d69005f85 100644
--- a/criu/arch/arm/Makefile.syscalls
+++ b/criu/arch/arm/Makefile.syscalls
@@ -1,5 +1,7 @@
 builtin-name		:= syscalls.built-in.o
 
+CFLAGS			:= $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS))
+
 SYS-TYPES		:= ../../include/syscall-types.h
 SYS-CODES		:= ../../include/syscall-codes.h
 SYS-PROTO		:= ../../include/syscall.h
diff --git a/criu/arch/ppc64/Makefile.syscalls b/criu/arch/ppc64/Makefile.syscalls
index 1b28ce7dc0df..76e4caf72fc6 100644
--- a/criu/arch/ppc64/Makefile.syscalls
+++ b/criu/arch/ppc64/Makefile.syscalls
@@ -1,5 +1,7 @@
 builtin-name		:= syscalls.built-in.o
 
+CFLAGS			:= $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS))
+
 SYS-TYPES		:= ../../include/syscall-types.h
 SYS-CODES		:= ../../include/syscall-codes.h
 SYS-PROTO		:= ../../include/syscall.h
diff --git a/criu/arch/x86/Makefile.syscalls b/criu/arch/x86/Makefile.syscalls
index 99087842c231..6c1a56af57a3 100644
--- a/criu/arch/x86/Makefile.syscalls
+++ b/criu/arch/x86/Makefile.syscalls
@@ -1,6 +1,8 @@
 include $(__nmk_dir)msg.mk
 builtin-name		:= syscalls.built-in.o
 
+CFLAGS			:= $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS))
+
 SYS-TYPES		:= ../../include/syscall-types.h
 SYS-CODES		:= ../../include/syscall-codes.h
 SYS-PROTO		:= ../../include/syscall.h
diff --git a/criu/pie/Makefile b/criu/pie/Makefile
index 5197e1b2d442..b455a02a6331 100644
--- a/criu/pie/Makefile
+++ b/criu/pie/Makefile
@@ -15,7 +15,7 @@ restorer-obj-e		+= ./$(ARCH_DIR)/syscalls.built-in.o
 # applications, which is not the target of the
 # project.
 #
-CFLAGS			:= $(filter-out -pg,$(CFLAGS)) -iquote pie/piegen -iquote arch/$(ARCH)/include -iquote $(SRC_DIR) -iquote $(SRC_DIR)/criu/include
+CFLAGS			:= $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) -iquote pie/piegen -iquote arch/$(ARCH)/include -iquote $(SRC_DIR) -iquote $(SRC_DIR)/criu/include
 
 ifneq ($(filter-out ia32,$(ARCH)),)
         ccflags-y	+= -DCR_NOGLIBC -fpie -Wa,--noexecstack -fno-stack-protector
diff --git a/criu/pie/Makefile.library b/criu/pie/Makefile.library
index b96d2f05b578..e1a6acccf3b8 100644
--- a/criu/pie/Makefile.library
+++ b/criu/pie/Makefile.library
@@ -29,7 +29,7 @@ endif
 # project.
 #
 iquotes			:= -iquote pie/piegen -iquote arch/$(ARCH)/include -iquote $(SRC_DIR) -iquote $(SRC_DIR)/criu/include
-ccflags-y		:= $(filter-out -pg,$(CFLAGS)) $(iquotes)
+CFLAGS			:= $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) $(iquotes)
 asflags-y		:= -D__ASSEMBLY__ $(iquotes)
 
 ifeq ($(SRCARCH),arm)
-- 
2.5.0



More information about the CRIU mailing list