[CRIU] [PATCH 10/15] pie.lib: generate compatible pie object files
Dmitry Safonov
dsafonov at virtuozzo.com
Mon Apr 11 05:19:24 PDT 2016
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
criu/pie/Makefile.library | 50 +++++++++++++++++++++++++++++------------------
1 file changed, 31 insertions(+), 19 deletions(-)
diff --git a/criu/pie/Makefile.library b/criu/pie/Makefile.library
index 947bcb5f6df0..36754275caa8 100644
--- a/criu/pie/Makefile.library
+++ b/criu/pie/Makefile.library
@@ -1,28 +1,45 @@
-target := native
+target := native
-$(target)-lib-uniq += log-simple.o
-$(target)-lib-uniq += util-fd.o
-$(target)-lib-uniq += util.o
+CFLAGS := $(filter-out -DCONFIG_X86_64,$(CFLAGS))
+CFLAGS += -Wa,--noexecstack -fno-stack-protector -DCR_NOGLIBC
+
+CFLAGS_native += -fpie
+
+ifeq ($(ARCH),x86)
+ CFLAGS_native += -DCONFIG_X86_64
+
+ target += compat
+ CFLAGS_compat += -fno-pic -m32 -DCONFIG_X86_32
+endif
+
+# $1 - target
+define gen-target-rule
+$(1)-lib-uniq += log-simple.o
+$(1)-lib-uniq += util-fd.o
+$(1)-lib-uniq += util.o
ifeq ($(VDSO),y)
- $(target)-lib-uniq += util-vdso.o
- $(target)-lib-uniq += parasite-vdso.o
- $(target)-lib-uniq += ./$(ARCH_DIR)/vdso-pie.o
+ $(1)-lib-uniq += util-vdso.o
+ $(1)-lib-uniq += parasite-vdso.o
+ $(1)-lib-uniq += ./$(ARCH_DIR)/vdso-pie.o
ifeq ($(SRCARCH),aarch64)
- $(target)-lib-y += ./$(ARCH_DIR)/intraprocedure.o
+ $(1)-lib-y += ./$(ARCH_DIR)/intraprocedure.o
endif
ifeq ($(SRCARCH),ppc64)
- $(target)-lib-y += ./$(ARCH_DIR)/vdso-trampoline.o
+ $(1)-lib-y += ./$(ARCH_DIR)/vdso-trampoline.o
endif
endif
ifeq ($(SRCARCH),ppc64)
- $(target)-lib-y += ./$(ARCH_DIR)/memcpy_power7.o
- $(target)-lib-y += ./$(ARCH_DIR)/memcmp_64.o
- $(target)-lib-y += ./$(ARCH_DIR)/misc.o
+ $(1)-lib-y += ./$(ARCH_DIR)/memcpy_power7.o
+ $(1)-lib-y += ./$(ARCH_DIR)/memcmp_64.o
+ $(1)-lib-y += ./$(ARCH_DIR)/misc.o
endif
+endef # target-rule
+
+$(eval $(call map,gen-target-rule,$(target)))
#
# We can't provide proper mount implementation
@@ -30,16 +47,11 @@ endif
# applications, which is not the target of the
# project.
#
-iquotes := -iquote pie/piegen -iquote arch/$(ARCH)/include -iquote $(SRC_DIR) -iquote $(SRC_DIR)/criu/include
+iquotes := -iquote pie/piegen -iquote arch/$(ARCH)/include
+iquotes += -iquote $(SRC_DIR) -iquote $(SRC_DIR)/criu/include
CFLAGS := $(filter-out -pg $(CFLAGS-GCOV),$(CFLAGS)) $(iquotes)
asflags-y := -D__ASSEMBLY__ $(iquotes)
ifeq ($(SRCARCH),arm)
ccflags-y += -marm
endif
-
-ifneq ($(filter-out ia32,$(ARCH)),)
- ccflags-y += -DCR_NOGLIBC -fpie -Wa,--noexecstack -fno-stack-protector
-else
- ccflags-y += -DCR_NOGLIBC -fno-pic -Wa,--noexecstack -fno-stack-protector
-endif
--
2.8.0
More information about the CRIU
mailing list