[CRIU] [PATCH 05/23] Makefiles: move -Wa, --noexecstack out of CFLAGS

Kir Kolyshkin kir at openvz.org
Tue Oct 11 18:46:43 PDT 2016


The problem is, -Wa is a flag for assembler, but CFLAGS are also used
to generate dependencies, and clang complains loudly when it is used
for deps:

>   DEP      compel/arch/x86/plugins/std/syscalls-64.d
>  clang-3.8: error: argument unused during compilation:
> '-Wa,--noexecstack'

This patch moved the noexecflag from assembler to linker. I am not
100% sure but the end result seems to be the same.

This fixes dependency generation when using clang instead of gcc.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 compel/plugins/Makefile   | 3 ++-
 criu/pie/Makefile.library | 3 ++-
 lib/c/Makefile            | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/compel/plugins/Makefile b/compel/plugins/Makefile
index 09587d1..ac54f7c 100644
--- a/compel/plugins/Makefile
+++ b/compel/plugins/Makefile
@@ -22,9 +22,10 @@ asflags-y		+= -iquote $(PLUGIN_ARCH_DIR)/include
 asflags-y		+= -iquote $(PLUGIN_ARCH_DIR)
 
 # General flags for assembly
-asflags-y		+= -fpie -Wstrict-prototypes -Wa,--noexecstack
+asflags-y		+= -fpie -Wstrict-prototypes
 asflags-y		+= -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
 asflags-y		+= -fno-stack-protector
+ldflags-y		+= -z noexecstack
 
 #
 # Fds plugin
diff --git a/criu/pie/Makefile.library b/criu/pie/Makefile.library
index c00877f..ea72c28 100644
--- a/criu/pie/Makefile.library
+++ b/criu/pie/Makefile.library
@@ -1,7 +1,8 @@
 target			:= native
 
 CFLAGS			:= $(filter-out -DCONFIG_X86_64,$(CFLAGS))
-CFLAGS			+= -Wa,--noexecstack -fno-stack-protector -DCR_NOGLIBC
+CFLAGS			+= -fno-stack-protector -DCR_NOGLIBC
+LDFLAGS			+= -z noexecstack
 
 CFLAGS_native		+= -fpie
 
diff --git a/lib/c/Makefile b/lib/c/Makefile
index 21bf856..68cf2b9 100644
--- a/lib/c/Makefile
+++ b/lib/c/Makefile
@@ -4,4 +4,5 @@ obj-y			+= $(SRC_DIR)/images/rpc.pb-c.o
 ccflags-y		+= -iquote $(SRC_DIR)/criu/$(ARCH_DIR)/include
 ccflags-y		+= -iquote $(SRC_DIR)/criu/include -iquote $(obj)/..
 ccflags-y		+= -iquote $(SRC_DIR)/images
-ccflags-y		+= -fPIC -Wa,--noexecstack -fno-stack-protector
+ccflags-y		+= -fPIC -fno-stack-protector
+ldflags-y		+= -z noexecstack
-- 
2.7.4



More information about the CRIU mailing list