piegen: Implement tool building, v2

Here we simply build piegen tool which gonna be used
to generate parasite code safe to rellocate. The tool
is taking object file as an argument, parses it and
generates C file with rellocations encoded in form
suitable for fast appliance.

Currently only x86-32 x86-64 is supported.

v2 (by ldufour@):
 - Filter PIEGEN

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov 2015-06-05 00:04:02 +03:00 committed by Pavel Emelyanov
parent 7a9813346b
commit b6668af613
7 changed files with 562 additions and 2 deletions

View file

@ -142,6 +142,9 @@ ARCH-LIB := $(ARCH_DIR)/crtools.built-in.o
CRIU-SO := libcriu
CRIU-LIB := lib/$(CRIU-SO).so
CRIU-INC := lib/criu.h include/criu-plugin.h include/criu-log.h protobuf/rpc.proto
ifneq ($(filter i386 ia32 x86_64, $(ARCH)),)
PIEGEN := pie/piegen/piegen
endif
export CC MAKE CFLAGS LIBS SRCARCH DEFINES MAKEFLAGS CRIU-SO
export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD
@ -184,9 +187,20 @@ $(ARCH_DIR)/%:: protobuf config
$(ARCH_DIR): protobuf config
$(Q) $(MAKE) $(build)=$(ARCH_DIR) all
pie/%:: $(ARCH_DIR)
ifneq ($(filter i386 ia32 x86_64, $(ARCH)),)
pie/piegen/%:
$(Q) $(MAKE) $(build)=pie/piegen $@
pie/piegen:
$(Q) $(MAKE) $(build)=pie/piegen all
$(PIEGEN): pie/piegen/built-in.o
$(E) " LINK " $@
$(Q) $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
.PHONY: pie/piegen
endif
pie/%:: $(ARCH_DIR) $(PIEGEN)
$(Q) $(MAKE) $(build)=pie $@
pie: $(ARCH_DIR)
pie: $(ARCH_DIR) $(PIEGEN)
$(Q) $(MAKE) $(build)=pie all
%.o %.i %.s %.d: $(VERSION_HEADER) pie
@ -235,6 +249,7 @@ clean-built:
$(Q) $(RM) $(VERSION_HEADER)
$(Q) $(MAKE) $(build)=$(ARCH_DIR) clean
$(Q) $(MAKE) $(build)=protobuf clean
$(Q) $(MAKE) $(build)=pie/piegen clean
$(Q) $(MAKE) $(build)=pie clean
$(Q) $(MAKE) $(build)=lib clean
$(Q) $(MAKE) $(build-crtools)=. clean