[CRIU] [PATCH 3/3] criu: Drop builtin_ helpers

Cyrill Gorcunov gorcunov at openvz.org
Fri Jan 27 09:14:20 PST 2017


No longer needed, shipped with compel.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/arch/aarch64/include/asm/string.h |  1 -
 criu/arch/aarch64/restorer.c           |  1 -
 criu/arch/aarch64/vdso-pie.c           |  1 -
 criu/arch/arm/include/asm/string.h     |  1 -
 criu/arch/arm/restorer.c               |  1 -
 criu/arch/ppc64/include/asm/string.h   | 28 ------------
 criu/arch/ppc64/vdso-pie.c             |  1 -
 criu/arch/x86/include/asm/parasite.h   |  1 -
 criu/arch/x86/include/asm/string.h     | 21 ---------
 criu/arch/x86/memcpy.S                 | 30 -------------
 criu/arch/x86/restorer.c               |  1 -
 criu/arch/x86/sigaction_compat.c       |  1 -
 criu/arch/x86/vdso-pie.c               |  1 -
 criu/include/asm-generic/string.h      | 82 ----------------------------------
 criu/include/string.h                  |  1 -
 criu/pie/restorer.c                    |  1 -
 criu/pie/util-fd.c                     |  1 -
 criu/pie/util-vdso.c                   |  1 -
 criu/protobuf.c                        |  1 -
 19 files changed, 176 deletions(-)
 delete mode 100644 criu/arch/ppc64/include/asm/string.h
 delete mode 100644 criu/arch/x86/include/asm/string.h
 delete mode 100644 criu/arch/x86/memcpy.S
 delete mode 100644 criu/include/asm-generic/string.h

diff --git a/criu/arch/aarch64/include/asm/string.h b/criu/arch/aarch64/include/asm/string.h
index 020a8eccda41..8343dc2f6a17 100644
--- a/criu/arch/aarch64/include/asm/string.h
+++ b/criu/arch/aarch64/include/asm/string.h
@@ -2,6 +2,5 @@
 #define __CR_ASM_STRING_H__
 
 #include "common/compiler.h"
-#include "asm-generic/string.h"
 
 #endif /* __CR_ASM_STRING_H__ */
diff --git a/criu/arch/aarch64/restorer.c b/criu/arch/aarch64/restorer.c
index d9fbeadd9554..ce9c1b410047 100644
--- a/criu/arch/aarch64/restorer.c
+++ b/criu/arch/aarch64/restorer.c
@@ -2,7 +2,6 @@
 
 #include "restorer.h"
 #include "asm/restorer.h"
-#include "asm/string.h"
 
 #include <compel/plugins/std/syscall.h>
 #include "log.h"
diff --git a/criu/arch/aarch64/vdso-pie.c b/criu/arch/aarch64/vdso-pie.c
index e2dd2536f0cb..55de8cb08a88 100644
--- a/criu/arch/aarch64/vdso-pie.c
+++ b/criu/arch/aarch64/vdso-pie.c
@@ -1,6 +1,5 @@
 #include <unistd.h>
 
-#include "asm/string.h"
 #include "asm/types.h"
 
 #include <compel/plugins/std/syscall.h>
diff --git a/criu/arch/arm/include/asm/string.h b/criu/arch/arm/include/asm/string.h
index 020a8eccda41..8343dc2f6a17 100644
--- a/criu/arch/arm/include/asm/string.h
+++ b/criu/arch/arm/include/asm/string.h
@@ -2,6 +2,5 @@
 #define __CR_ASM_STRING_H__
 
 #include "common/compiler.h"
-#include "asm-generic/string.h"
 
 #endif /* __CR_ASM_STRING_H__ */
diff --git a/criu/arch/arm/restorer.c b/criu/arch/arm/restorer.c
index 73fa307d1de7..21234b95d33e 100644
--- a/criu/arch/arm/restorer.c
+++ b/criu/arch/arm/restorer.c
@@ -2,7 +2,6 @@
 
 #include "restorer.h"
 #include "asm/restorer.h"
-#include "asm/string.h"
 
 #include <compel/plugins/std/syscall.h>
 #include "log.h"
diff --git a/criu/arch/ppc64/include/asm/string.h b/criu/arch/ppc64/include/asm/string.h
deleted file mode 100644
index 93eb4281348a..000000000000
--- a/criu/arch/ppc64/include/asm/string.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef __CR_ASM_STRING_H__
-#define __CR_ASM_STRING_H__
-
-#include "common/compiler.h"
-
-#define HAS_BUILTIN_MEMCPY
-#define HAS_BUILTIN_MEMCMP
-
-#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)
-{
-	if (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/criu/arch/ppc64/vdso-pie.c b/criu/arch/ppc64/vdso-pie.c
index 781c063fd4d9..ab0a6ef3ef7f 100644
--- a/criu/arch/ppc64/vdso-pie.c
+++ b/criu/arch/ppc64/vdso-pie.c
@@ -1,6 +1,5 @@
 #include <unistd.h>
 
-#include "asm/string.h"
 #include "asm/types.h"
 
 #include <compel/plugins/std/syscall.h>
diff --git a/criu/arch/x86/include/asm/parasite.h b/criu/arch/x86/include/asm/parasite.h
index 64e04861b8fa..372a836e2942 100644
--- a/criu/arch/x86/include/asm/parasite.h
+++ b/criu/arch/x86/include/asm/parasite.h
@@ -1,7 +1,6 @@
 #ifndef __ASM_PARASITE_H__
 #define __ASM_PARASITE_H__
 
-#include "asm-generic/string.h"
 #include <compel/plugins/std/syscall-codes.h>
 #include <compel/plugins/std/string.h>
 #include "asm/compat.h"
diff --git a/criu/arch/x86/include/asm/string.h b/criu/arch/x86/include/asm/string.h
deleted file mode 100644
index 415bf5ce32bd..000000000000
--- a/criu/arch/x86/include/asm/string.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __CR_ASM_STRING_H__
-#define __CR_ASM_STRING_H__
-
-#define HAS_BUILTIN_MEMCPY
-
-#include "common/compiler.h"
-#include "asm-generic/string.h"
-
-#ifdef CR_NOGLIBC
-extern void *memcpy_x86(void *to, const void *from, size_t n);
-static inline void *builtin_memcpy(void *to, const void *from, size_t n)
-{
-	if (n)
-		memcpy_x86(to, from, n);
-	return to;
-}
-#else
-#define builtin_memcpy memcpy
-#endif /* CR_NOGLIBC */
-
-#endif /* __CR_ASM_STRING_H__ */
diff --git a/criu/arch/x86/memcpy.S b/criu/arch/x86/memcpy.S
deleted file mode 100644
index c8f7555fc2ea..000000000000
--- a/criu/arch/x86/memcpy.S
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "common/asm/linkage.h"
-
-/* The following code is taken from Linux kernel (arch/x86/lib/memcpy_64.S).
- * There are 3 implementations in there, we use the one that relies on
- * X86_FEATURE_REP_GOOD ("rep microcode works well").
- */
-
-/*
- * memcpy - Copy a memory block.
- *
- * Input:
- *  rdi destination
- *  rsi source
- *  rdx count
- *
- * Output:
- * rax original destination
- */
-ENTRY(memcpy_x86)
-ENTRY(memcpy)
-	movq %rdi, %rax
-	movq %rdx, %rcx
-	shrq $3, %rcx
-	andl $7, %edx
-	rep movsq
-	movl %edx, %ecx
-	rep movsb
-	ret
-END(memcpy)
-END(memcpy_x86)
diff --git a/criu/arch/x86/restorer.c b/criu/arch/x86/restorer.c
index 295cf31b1308..885bc103997c 100644
--- a/criu/arch/x86/restorer.c
+++ b/criu/arch/x86/restorer.c
@@ -5,7 +5,6 @@
 #include "restorer.h"
 #include "asm/restorer.h"
 #include <compel/asm/fpu.h>
-#include "asm/string.h"
 
 #include <compel/plugins/std/syscall.h>
 #include <compel/plugins/std/string.h>
diff --git a/criu/arch/x86/sigaction_compat.c b/criu/arch/x86/sigaction_compat.c
index f8565a70411a..116900639e85 100644
--- a/criu/arch/x86/sigaction_compat.c
+++ b/criu/arch/x86/sigaction_compat.c
@@ -1,7 +1,6 @@
 #include "log.h"
 #include "asm/restorer.h"
 #include <compel/asm/fpu.h>
-#include "asm/string.h"
 #include "asm/compat.h"
 
 #include <compel/plugins/std/string.h>
diff --git a/criu/arch/x86/vdso-pie.c b/criu/arch/x86/vdso-pie.c
index 6f454c9153ab..fd755954d7d5 100644
--- a/criu/arch/x86/vdso-pie.c
+++ b/criu/arch/x86/vdso-pie.c
@@ -1,6 +1,5 @@
 #include <unistd.h>
 
-#include "asm/string.h"
 #include "asm/types.h"
 
 #include <compel/plugins/std/syscall.h>
diff --git a/criu/include/asm-generic/string.h b/criu/include/asm-generic/string.h
deleted file mode 100644
index ff91968a0dfe..000000000000
--- a/criu/include/asm-generic/string.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef __CR_ASM_GENERIC_STRING_H__
-#define __CR_ASM_GENERIC_STRING_H__
-
-#include "common/compiler.h"
-
-/* C compiler may generate calls to memcmp, memset, memcpy and memmove,
- * so it relies on those to be available during linking.
- * In case we are not linking our code against glibc, we set CR_NOGLIBC
- * and have to provide our own implementations of mem*() functions.
- *
- * For now, not having memmove() seems OK for both gcc and clang.
- */
-
-#ifndef HAS_BUILTIN_MEMCPY
-static __maybe_unused void *builtin_memcpy(void *to, const void *from, size_t n)
-{
-	size_t i;
-	unsigned char *cto = to;
-	const unsigned char *cfrom = from;
-
-	for (i = 0; i < n; ++i, ++cto, ++cfrom) {
-		*cto = *cfrom;
-	}
-
-	return to;
-}
-#ifdef CR_NOGLIBC
-void *memcpy(void *to, const void *from, size_t n)	\
-	     __attribute__ ((weak, alias ("builtin_memcpy")));
-#endif
-#endif
-
-#ifndef HAS_BUILTIN_MEMCMP
-static __maybe_unused int builtin_memcmp(const void *cs, const void *ct, size_t count)
-{
-	const unsigned char *su1, *su2;
-	int res = 0;
-
-	for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
-		if ((res = *su1 - *su2) != 0)
-			break;
-	return res;
-}
-#ifdef CR_NOGLIBC
-int memcmp(const void *cs, const void *ct, size_t count)	\
-	     __attribute__ ((weak, alias ("builtin_memcmp")));
-#endif
-#endif
-
-#ifndef HAS_BUILTIN_STRNCMP
-static always_inline int builtin_strncmp(const char *cs, const char *ct, size_t count)
-{
-	size_t i;
-
-	for (i = 0; i < count; i++) {
-		if (cs[i] != ct[i])
-			return cs[i] < ct[i] ? -1 : 1;
-		if (!cs[i])
-			break;
-	}
-	return 0;
-}
-#endif
-
-#ifndef HAS_BUILTIN_MEMSET
-static __maybe_unused void *builtin_memset(void *s, const int c, size_t count)
-{
-	char *dest = s;
-	size_t i = 0;
-
-	while (i < count)
-		dest[i++] = (char) c;
-
-	return s;
-}
-#ifdef CR_NOGLIBC
-void *memset(void *s, const int c, size_t count)	\
-	     __attribute__ ((weak, alias ("builtin_memset")));
-#endif
-#endif
-
-#endif /* __CR_ASM_GENERIC_STRING_H__ */
diff --git a/criu/include/string.h b/criu/include/string.h
index 53c009866856..b469bfe55a84 100644
--- a/criu/include/string.h
+++ b/criu/include/string.h
@@ -3,7 +3,6 @@
 
 #include <sys/types.h>
 #include <string.h>
-#include "asm/string.h"
 
 #ifdef CONFIG_HAS_LIBBSD
 # include <bsd/string.h>
diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index d6b76d10b325..0833896583a8 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -22,7 +22,6 @@
 #include "int.h"
 #include "types.h"
 #include "common/compiler.h"
-#include "string.h"
 #include <compel/plugins/std/syscall.h>
 #include <compel/plugins/std/string.h>
 #include <compel/plugins/std/log.h>
diff --git a/criu/pie/util-fd.c b/criu/pie/util-fd.c
index 933fa17b1cda..3c56cc867a56 100644
--- a/criu/pie/util-fd.c
+++ b/criu/pie/util-fd.c
@@ -8,7 +8,6 @@
 #include "types.h"
 #include "common/compiler.h"
 #include "log.h"
-#include "string.h"
 
 #ifdef CR_NOGLIBC
 # include <compel/plugins/std/syscall.h>
diff --git a/criu/pie/util-vdso.c b/criu/pie/util-vdso.c
index 73f66d6c44d4..1305d18aaa2c 100644
--- a/criu/pie/util-vdso.c
+++ b/criu/pie/util-vdso.c
@@ -10,7 +10,6 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 
-#include "string.h"
 #include "image.h"
 #include "util-vdso.h"
 #include "vma.h"
diff --git a/criu/protobuf.c b/criu/protobuf.c
index 3db829de91dc..11b43e060061 100644
--- a/criu/protobuf.c
+++ b/criu/protobuf.c
@@ -13,7 +13,6 @@
 #include "common/compiler.h"
 #include "log.h"
 #include "rst-malloc.h"
-#include "string.h"
 #include "sockets.h"
 #include "cr_options.h"
 #include "bfd.h"
-- 
2.7.4



More information about the CRIU mailing list