[CRIU] Reply

Yicheng Qin yichengq at google.com
Thu Aug 15 14:19:40 EDT 2013


> It's not just "first step". Once someone starts using it, we'll not be able to roll this step back.
As long as criu can be run as binary, we could ensure that criu_main() function runs well. It is
maintained as CRIU goes.
However, if you don't want to see such API, it is a problem.

> What problems do you see?
I have tried to build .so with patch below, but stuck at assembly part.
Error met:
/usr/bin/ld: arch/x86/syscalls.built-in.o: relocation R_X86_64_PC32 against symbol `__syscall_common' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
I am unclear about where to put the flag.

---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index fecc7f5..2546dbb 100644
--- a/Makefile
+++ b/Makefile
@@ -99,6 +99,7 @@ else
 endif
 
 CFLAGS		+= $(WARNINGS) $(DEFINES)
+CFLAGS		+= -fPIC
 SYSCALL-LIB	:= arch/$(ARCH)/syscalls.built-in.o
 ARCH-LIB	:= arch/$(ARCH)/crtools.built-in.o
 CRIU-LIB	:= lib/libcriu.so
@@ -163,6 +164,7 @@ PROGRAM-BUILTINS	+= $(ARCH_DIR)/vdso-pie.o
 $(PROGRAM): $(SYSCALL-LIB) $(ARCH-LIB) $(PROGRAM-BUILTINS)
 	$(E) "  LINK    " $@
 	$(Q) $(CC) $(CFLAGS) $^ $(LIBS) $(LDFLAGS) -o $@
+	$(Q) $(CC) $(CFLAGS) -shared -o libcriu.a $(SYSCALL-LIB) $(ARCH-LIB) $(PROGRAM-BUILTINS)
 
 zdtm: all
 	$(Q) $(MAKE) -C test/zdtm all
-- 
1.8.3



More information about the CRIU mailing list