criu: restrict archs and fix build

This commit is contained in:
q66 2019-12-17 17:30:03 +01:00
parent 1718fb8b5f
commit d378891ea0
2 changed files with 152 additions and 4 deletions

View File

@ -0,0 +1,148 @@
Get rid of some header conflicts and glibc specific things.
--- compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h
+++ compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h
@@ -1,6 +1,8 @@
#ifndef UAPI_COMPEL_ASM_TYPES_H__
#define UAPI_COMPEL_ASM_TYPES_H__
+#include <asm/types.h>
+#include <asm/elf.h>
#include <stdbool.h>
#include <signal.h>
#include <stdint.h>
@@ -55,8 +57,8 @@ typedef struct {
#define MSR_TM_ACTIVE(x) ((((x) & MSR_TM) && ((x)&(MSR_TMA|MSR_TMS))) != 0)
typedef struct {
- uint64_t fpregs[NFPREG];
- __vector128 vrregs[NVRREG];
+ uint64_t fpregs[ELF_NFPREG];
+ __vector128 vrregs[ELF_NVRREG];
uint64_t vsxregs[NVSXREG];
int flags;
@@ -66,8 +68,8 @@ typedef struct {
uint64_t tfhar, texasr, tfiar;
} tm_spr_regs;
user_regs_struct_t regs;
- uint64_t fpregs[NFPREG];
- __vector128 vrregs[NVRREG];
+ uint64_t fpregs[ELF_NFPREG];
+ __vector128 vrregs[ELF_NVRREG];
uint64_t vsxregs[NVSXREG];
} tm;
} user_fpregs_struct_t;
--- compel/arch/ppc64/src/lib/infect.c
+++ compel/arch/ppc64/src/lib/infect.c
@@ -1,7 +1,6 @@
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/uio.h>
-#include <sys/user.h>
#include <sys/mman.h>
#include <stdint.h>
#include <errno.h>
@@ -57,15 +56,15 @@ static void put_fpu_regs(mcontext_t *mc, uint64_t *fpregs)
{
uint64_t *mcfp = (uint64_t *)mc->fp_regs;
- memcpy(mcfp, fpregs, sizeof(*fpregs) * NFPREG);
+ memcpy(mcfp, fpregs, sizeof(*fpregs) * ELF_NFPREG);
}
static void put_altivec_regs(mcontext_t *mc, __vector128 *vrregs)
{
vrregset_t *v_regs = (vrregset_t *)(((unsigned long)mc->vmx_reserve + 15) & ~0xful);
- memcpy(&v_regs->vrregs[0][0], vrregs, sizeof(uint64_t) * 2 * (NVRREG - 1));
- v_regs->vrsave = *((uint32_t *)&vrregs[NVRREG - 1]);
+ memcpy(&v_regs->vrregs[0][0], vrregs, sizeof(uint64_t) * 2 * (ELF_NVRREG - 1));
+ v_regs->vrsave = *((uint32_t *)&vrregs[ELF_NVRREG - 1]);
mc->v_regs = v_regs;
}
--- criu/arch/ppc64/crtools.c
+++ criu/arch/ppc64/crtools.c
@@ -1,7 +1,6 @@
#include <string.h>
#include <unistd.h>
#include <elf.h>
-#include <sys/user.h>
#include <asm/unistd.h>
#include <sys/uio.h>
@@ -33,7 +32,7 @@ static UserPpc64FpstateEntry *copy_fp_regs(uint64_t *fpregs)
return NULL;
user_ppc64_fpstate_entry__init(fpe);
- fpe->n_fpregs = NFPREG;
+ fpe->n_fpregs = ELF_NFPREG;
fpe->fpregs = xmalloc(fpe->n_fpregs * sizeof(fpe->fpregs[0]));
if (!fpe->fpregs) {
xfree(fpe);
@@ -41,7 +40,7 @@ static UserPpc64FpstateEntry *copy_fp_regs(uint64_t *fpregs)
}
/* FPSRC is the last (33th) register in the set */
- for (i = 0; i < NFPREG; i++)
+ for (i = 0; i < ELF_NFPREG; i++)
fpe->fpregs[i] = fpregs[i];
return fpe;
@@ -69,7 +68,7 @@ static UserPpc64VrstateEntry *copy_altivec_regs(__vector128 *vrregs)
user_ppc64_vrstate_entry__init(vse);
/* protocol buffer store only 64bit entries and we need 128bit */
- vse->n_vrregs = (NVRREG-1) * 2;
+ vse->n_vrregs = (ELF_NVRREG-1) * 2;
vse->vrregs = xmalloc(vse->n_vrregs * sizeof(vse->vrregs[0]));
if (!vse->vrregs) {
xfree(vse);
@@ -77,13 +76,13 @@ static UserPpc64VrstateEntry *copy_altivec_regs(__vector128 *vrregs)
}
/* Vectors are 2*64bits entries */
- for (i = 0; i < (NVRREG-1); i++) {
+ for (i = 0; i < (ELF_NVRREG-1); i++) {
p64 = (uint64_t*) &vrregs[i];
vse->vrregs[i*2] = p64[0];
vse->vrregs[i*2 + 1] = p64[1];
}
- p32 = (uint32_t*) &vrregs[NVRREG-1];
+ p32 = (uint32_t*) &vrregs[ELF_NVRREG-1];
vse->vrsave = *p32;
return vse;
@@ -95,7 +94,7 @@ static int put_altivec_regs(mcontext_t *mc, UserPpc64VrstateEntry *vse)
pr_debug("Restoring Altivec registers\n");
- if (vse->n_vrregs != (NVRREG-1)*2) {
+ if (vse->n_vrregs != (ELF_NVRREG-1)*2) {
pr_err("Corrupted Altivec dump data\n");
return -1;
}
@@ -104,7 +103,7 @@ static int put_altivec_regs(mcontext_t *mc, UserPpc64VrstateEntry *vse)
* this is not a big deal to do that in all cases.
*/
memcpy(&v_regs->vrregs[0][0], vse->vrregs,
- sizeof(uint64_t) * 2 * (NVRREG-1));
+ sizeof(uint64_t) * 2 * (ELF_NVRREG-1));
/* vscr has been restored with the previous memcpy which copied 32
* 128bits registers + a 128bits field containing the vscr value in
* the low part.
--- include/common/arch/ppc64/asm/cmpxchg.h
+++ include/common/arch/ppc64/asm/cmpxchg.h
@@ -1,6 +1,10 @@
#ifndef __CR_CMPXCHG_H__
#define __CR_CMPXCHG_H__
+#ifndef __always_inline
+#define __always_inline __inline __attribute__ ((__always_inline__))
+#endif
+
/*
* Copied from kernel header file arch/powerpc/include/asm/cmpxchg.h
*/

View File

@ -2,8 +2,12 @@
pkgname=criu pkgname=criu
version=3.13 version=3.13
revision=2 revision=2
# i686 unsupported upstream: https://criu.org/32bit_tasks_C/R#Compatible_applications
# ppc64 big endian not supported upstream
archs="x86_64* aarch64* ppc64le* armv7l*"
build_style=gnu-makefile build_style=gnu-makefile
make_use_env=compliant make_use_env=compliant
make_build_args="WERROR=0"
hostmakedepends="asciidoc pkg-config xmlto protobuf" hostmakedepends="asciidoc pkg-config xmlto protobuf"
makedepends="libcap-devel libnet-devel libnl3-devel protobuf-c-devel makedepends="libcap-devel libnet-devel libnl3-devel protobuf-c-devel
protobuf-devel" protobuf-devel"
@ -15,10 +19,6 @@ distfiles="https://download.openvz.org/criu/criu-${version}.tar.bz2"
checksum=ea027f2acb55c62d47aec0c7776c723e5a877978e60d3574961b6f4c538fc9fa checksum=ea027f2acb55c62d47aec0c7776c723e5a877978e60d3574961b6f4c538fc9fa
nocross="fails to run protobuf internals" nocross="fails to run protobuf internals"
case "$XBPS_TARGET_MACHINE" in
i686*) broken="unsupported upstream https://criu.org/32bit_tasks_C/R#Compatible_applications"
esac
do_install() { do_install() {
make DESTDIR=${DESTDIR} PREFIX=/usr LOGROTATEDIR=/etc/logrotate.d \ make DESTDIR=${DESTDIR} PREFIX=/usr LOGROTATEDIR=/etc/logrotate.d \
LIBDIR=/usr/lib SBINDIR=/usr/bin install LIBDIR=/usr/lib SBINDIR=/usr/bin install