[CRIU] [PATCH] ppc64: crtools no more use builtin mem operation

Laurent Dufour ldufour at linux.vnet.ibm.com
Thu Oct 15 08:20:44 PDT 2015


Since crtools is no more linked with object build for the
parasite/restorer blob, it no more needs the builtin memory services.

Signed-off-by: Laurent Dufour <ldufour at linux.vnet.ibm.com>
---
 arch/ppc64/Makefile             |  1 -
 arch/ppc64/include/asm/string.h |  9 ++++++++-
 arch/ppc64/memcpy_power7.S      |  5 +++++
 arch/ppc64/vdso-pie.c           | 14 --------------
 4 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile
index 6a5f8fdedde8..c5d332364aa2 100644
--- a/arch/ppc64/Makefile
+++ b/arch/ppc64/Makefile
@@ -6,7 +6,6 @@ SYS-ASM		:= syscalls.S
 syscalls-asm-y	+= $(SYS-ASM:.S=).o
 crtools-obj-y	+= crtools.o
 crtools-obj-y	+= cpu.o
-crtools-asm-y	+= memcpy_power7.o memcmp_64.o
 
 SYS-DEF		:= syscall-ppc64.def
 SYS-ASM-COMMON	:= syscall-common-ppc64.S
diff --git a/arch/ppc64/include/asm/string.h b/arch/ppc64/include/asm/string.h
index 097b1ca5be94..4531b3ba6c26 100644
--- a/arch/ppc64/include/asm/string.h
+++ b/arch/ppc64/include/asm/string.h
@@ -8,6 +8,7 @@
 
 #include "asm-generic/string.h"
 
+#ifdef CR_NOGLIBC
 extern void memcpy_power7(void *to, const void *from, unsigned long n);
 static inline void *builtin_memcpy(void *to, const void *from, unsigned long n)
 {
@@ -15,7 +16,13 @@ static inline void *builtin_memcpy(void *to, const void *from, unsigned long n)
 		memcpy_power7(to, from, n);
 	return to;
 }
-
 extern int builtin_memcmp(const void *cs, const void *ct, size_t count);
+#else
+/*
+ * When building with the C library, call its services
+ */
+#define builtin_memcpy memcpy
+#define builtin_memcmp memcmp
+#endif
 
 #endif /* __CR_ASM_STRING_H__ */
diff --git a/arch/ppc64/memcpy_power7.S b/arch/ppc64/memcpy_power7.S
index bd2833bc54d0..a29d0e8f2ada 100644
--- a/arch/ppc64/memcpy_power7.S
+++ b/arch/ppc64/memcpy_power7.S
@@ -23,6 +23,11 @@
  */
 #include "asm/linkage.h"
 
+/*
+ * When building the parasite code, the compiler may rely on the C library
+ * service memcpy to initialise big local variable in the stack.
+ */
+ENTRY(memcpy)
 ENTRY(memcpy_power7)
 	cmpldi	r5,16
 	std	r3,-STACKFRAMESIZE+STK_REG(R31)(r1)
diff --git a/arch/ppc64/vdso-pie.c b/arch/ppc64/vdso-pie.c
index cab61cca3e74..30437d5cc686 100644
--- a/arch/ppc64/vdso-pie.c
+++ b/arch/ppc64/vdso-pie.c
@@ -16,20 +16,6 @@
 /* This symbols are defined in vdso-trampoline.S */
 extern char *vdso_trampoline, *vdso_trampoline_end;
 
-/*
- * When building the parasite code, the compiler may rely on the C library
- * service memcpy to initialise big local variable in the stack.
- * Since we are not linked with the C library, we have to remap this service
- * to the builtin one we are using.
- * Note this cannot be done through macro since the compiler is creating the
- * memcpy call in our back. So we have to define a *real* symbol.
- */
-void *memcpy(void *to, const void *from, unsigned long n)
-{
-    return builtin_memcpy(to, from, n);
-}
-
-
 static inline void invalidate_caches(unsigned long at)
 {
     asm volatile("isync		\n"	\
-- 
1.9.1



More information about the CRIU mailing list