[CRIU] [PATCH 03/10] build: Move __ASSEMBLY__ define to the top Makefile

Dmitry Safonov dima at arista.com
Sat May 18 01:53:02 MSK 2019


__ASSEMBLY__ is used to guard C-related code in headers from
asm-compatible defines. We actually want every .S file to be assembled
with -D__ASSEMBLY__ not to burst with C in asm file.

Move __ASSEMBLY__ from all local asflags to top Makefile's AFLAGS.

Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 Makefile                   | 3 ++-
 compel/plugins/Makefile    | 2 +-
 criu/arch/aarch64/Makefile | 1 -
 criu/arch/arm/Makefile     | 1 -
 criu/arch/x86/Makefile     | 2 +-
 criu/pie/Makefile          | 2 --
 criu/pie/Makefile.library  | 1 -
 7 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 50948787ae35..84fc0841fca2 100644
--- a/Makefile
+++ b/Makefile
@@ -129,9 +129,10 @@ ifeq ($(GMON),1)
 export GMON GMONLDOPT
 endif
 
+AFLAGS			+= -D__ASSEMBLY__
 CFLAGS			+= $(USERCFLAGS) $(WARNINGS) $(DEFINES) -iquote include/
 HOSTCFLAGS		+= $(WARNINGS) $(DEFINES) -iquote include/
-export CFLAGS USERCLFAGS HOSTCFLAGS
+export AFLAGS CFLAGS USERCLFAGS HOSTCFLAGS
 
 # Default target
 all: criu lib crit
diff --git a/compel/plugins/Makefile b/compel/plugins/Makefile
index 60b78473c4ea..8f44ba86db8e 100644
--- a/compel/plugins/Makefile
+++ b/compel/plugins/Makefile
@@ -29,7 +29,7 @@ asflags-y		+= -iquote $(PLUGIN_ARCH_DIR)
 
 # General flags for assembly
 asflags-y		+= -fpie -Wstrict-prototypes
-asflags-y		+= -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
+asflags-y		+= -nostdlib -fomit-frame-pointer
 asflags-y		+= -fno-stack-protector
 ldflags-y		+= -z noexecstack
 
diff --git a/criu/arch/aarch64/Makefile b/criu/arch/aarch64/Makefile
index 49ef6a480ef4..fd721d12fead 100644
--- a/criu/arch/aarch64/Makefile
+++ b/criu/arch/aarch64/Makefile
@@ -3,7 +3,6 @@ builtin-name		:= crtools.built-in.o
 ccflags-y		+= -iquote $(obj)/include -iquote criu/include
 ccflags-y		+= -iquote include
 ccflags-y		+= $(COMPEL_UAPI_INCLUDES)
-asflags-y		+= -D__ASSEMBLY__
 ldflags-y		+= -r
 
 obj-y			+= cpu.o
diff --git a/criu/arch/arm/Makefile b/criu/arch/arm/Makefile
index d01c69a16536..5142fbe12859 100644
--- a/criu/arch/arm/Makefile
+++ b/criu/arch/arm/Makefile
@@ -4,7 +4,6 @@ ccflags-y		+= -iquote $(obj)/include
 ccflags-y		+= -iquote criu/include -iquote include
 ccflags-y		+= $(COMPEL_UAPI_INCLUDES)
 
-asflags-y		+= -D__ASSEMBLY__
 ldflags-y		+= -r -z noexecstack
 
 obj-y			+= cpu.o
diff --git a/criu/arch/x86/Makefile b/criu/arch/x86/Makefile
index 20a40e4ae7be..ca92a241c160 100644
--- a/criu/arch/x86/Makefile
+++ b/criu/arch/x86/Makefile
@@ -5,7 +5,7 @@ ccflags-y		+= -iquote criu/include -iquote include
 ccflags-y		+= $(COMPEL_UAPI_INCLUDES)
 
 asflags-y		+= -Wstrict-prototypes
-asflags-y		+= -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
+asflags-y		+= -nostdlib -fomit-frame-pointer
 asflags-y		+= -iquote $(obj)/include
 ldflags-y		+= -r -z noexecstack
 
diff --git a/criu/pie/Makefile b/criu/pie/Makefile
index c9e8a3d82286..5c06067861eb 100644
--- a/criu/pie/Makefile
+++ b/criu/pie/Makefile
@@ -17,8 +17,6 @@ ifneq ($(filter-out clean mrproper,$(MAKECMDGOALS)),)
 	compel_plugins	:= $(shell $(COMPEL_BIN) plugins)
 endif
 
-asflags-y	+= -D__ASSEMBLY__
-
 LDS		:= compel/arch/$(SRCARCH)/scripts/compel-pack.lds.S
 
 restorer-obj-y	+= ./$(ARCH_DIR)/restorer.o
diff --git a/criu/pie/Makefile.library b/criu/pie/Makefile.library
index b7918438bb1f..577497f5af43 100644
--- a/criu/pie/Makefile.library
+++ b/criu/pie/Makefile.library
@@ -35,6 +35,5 @@ endif
 
 CFLAGS		:= $(filter-out -pg $(CFLAGS-GCOV) $(CFLAGS-ASAN),$(CFLAGS))
 
-asflags-y		:= -D__ASSEMBLY__
 ccflags-y		+= $(COMPEL_UAPI_INCLUDES)
 ccflags-y		+= $(CFLAGS_PIE)
-- 
2.21.0



More information about the CRIU mailing list