[CRIU] [PATCH 10/15] pie.lib: generate compatible pie object files

Dmitry Safonov dsafonov at virtuozzo.com
Tue Apr 12 04:18:20 PDT 2016


On 04/11/2016 10:57 PM, Cyrill Gorcunov wrote:
> On Mon, Apr 11, 2016 at 03:19:24PM +0300, Dmitry Safonov wrote:
>> Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
> Please create symlinks for the files needed to be compiled with
> different flags, so we won't have a mees with nmk variables
> (there are already hard to read ;)
Hmm, there are two variants to build it with symlinks:
1. Add CFLAGS/AFLAGS inheriting for obj-y, like
I did for obj-uniq before, so you may specify flags
for whole target with all it's objects, like:
CFLAGS_native    += -fpie -DCONFIG_X86_64
CFLAGS_compat    += -fno-pic -m32 -DCONFIG_X86_32

2. Form a list of target objects and map flags/obj-y on
it, like:
NATIVE_OBJS := log-simple.o util-fd.o util.o
COMPAT_OBJS := log-simple-compat.o util-fd-compat.o util-compat.o
ifeq ($(VDSO),y)
NATIVE_OBJS += util-vdso.o parasite-vdso.o ./$(ARCH_DIR)/vdso-pie.o
COMPAT_OBJS += util-vdso-compat.o parasite-vdso-compat.o 
./$(ARCH_DIR)/vdso-pie-compat.o
#...
define gen-native-rule
native-obj-y += $(1)
CFLAGS_$(1) := #...
AFLAGS_$(1) := #...
endef
#...
$(call map,gen-native-rule,$(NATIVE_OBJS))
$(call map,gen-compat-rule,$(COMPAT_OBJS))

So, which way you find preferable?

-- 
Regards,
Dmitry Safonov



More information about the CRIU mailing list