From 2bb3dd53600391f6329c3bbbdbb6980b0438a085 Mon Sep 17 00:00:00 2001 From: q66 Date: Fri, 11 Oct 2019 12:07:41 +0200 Subject: [PATCH] LuaJIT: don't apply ppc64 patchset for ppc (breaks JIT) There is something in the ppc64 patch that breaks 32-bit ppc in some scenarios (it appears to work but segfaults e.g. when building neovim). So until that is investigated and fixed, conditionalize this. --- .../patches/ppc}/musl-ppc-secureplt.patch | 16 ++++++---------- .../patches/ppc64}/add-ppc64-support.patch | 0 .../patches/ppc64}/fix-vm-jit-ppc64.patch | 0 srcpkgs/LuaJIT/template | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 10 deletions(-) rename srcpkgs/LuaJIT/{patches => files/patches/ppc}/musl-ppc-secureplt.patch (89%) rename srcpkgs/LuaJIT/{patches => files/patches/ppc64}/add-ppc64-support.patch (100%) rename srcpkgs/LuaJIT/{patches => files/patches/ppc64}/fix-vm-jit-ppc64.patch (100%) diff --git a/srcpkgs/LuaJIT/patches/musl-ppc-secureplt.patch b/srcpkgs/LuaJIT/files/patches/ppc/musl-ppc-secureplt.patch similarity index 89% rename from srcpkgs/LuaJIT/patches/musl-ppc-secureplt.patch rename to srcpkgs/LuaJIT/files/patches/ppc/musl-ppc-secureplt.patch index 2b0578f9c58..b7304474f77 100644 --- a/srcpkgs/LuaJIT/patches/musl-ppc-secureplt.patch +++ b/srcpkgs/LuaJIT/files/patches/ppc/musl-ppc-secureplt.patch @@ -33,8 +33,6 @@ This fixes crashes on ppc-musl, as musl only supports secureplt. } #if LJ_HASJIT -diff --git a/src/lj_dispatch.h b/src/lj_dispatch.h -index 5bda51a..23f937f 100644 --- src/lj_dispatch.h +++ src/lj_dispatch.h @@ -66,6 +66,21 @@ GOTDEF(GOTENUM) @@ -68,14 +66,12 @@ index 5bda51a..23f937f 100644 ASMFunction got[LJ_GOT__MAX]; /* Global offset table. */ #endif #if LJ_HASJIT -diff --git a/src/vm_ppc.dasc b/src/vm_ppc.dasc -index 14a35d2..c239006 100644 --- src/vm_ppc.dasc +++ src/vm_ppc.dasc -@@ -51,7 +51,12 @@ - |.macro blex, target; bl extern target; nop; .endmacro - |.macro .toc, a, b; a, b; .endmacro - |.else +@@ -59,7 +59,12 @@ + |.define ENV_OFS, 8 + |.endif + |.else // No TOC. -|.macro blex, target; bl extern target@plt; .endmacro +|.macro blex, target +| lwz TMP0, DISPATCH_GOT(target)(DISPATCH) @@ -85,8 +81,8 @@ index 14a35d2..c239006 100644 +|.endmacro |.macro .toc, a, b; .endmacro |.endif - |.if OPD -@@ -540,6 +545,8 @@ + |.macro .tocenv, a, b; .if TOCENV; a, b; .endif; .endmacro +@@ -448,6 +453,8 @@ |// Assumes DISPATCH is relative to GL. #define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field)) #define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field)) diff --git a/srcpkgs/LuaJIT/patches/add-ppc64-support.patch b/srcpkgs/LuaJIT/files/patches/ppc64/add-ppc64-support.patch similarity index 100% rename from srcpkgs/LuaJIT/patches/add-ppc64-support.patch rename to srcpkgs/LuaJIT/files/patches/ppc64/add-ppc64-support.patch diff --git a/srcpkgs/LuaJIT/patches/fix-vm-jit-ppc64.patch b/srcpkgs/LuaJIT/files/patches/ppc64/fix-vm-jit-ppc64.patch similarity index 100% rename from srcpkgs/LuaJIT/patches/fix-vm-jit-ppc64.patch rename to srcpkgs/LuaJIT/files/patches/ppc64/fix-vm-jit-ppc64.patch diff --git a/srcpkgs/LuaJIT/template b/srcpkgs/LuaJIT/template index b204c21811f..313404defe1 100644 --- a/srcpkgs/LuaJIT/template +++ b/srcpkgs/LuaJIT/template @@ -47,6 +47,23 @@ if [ "$CROSS_BUILD" ]; then esac fi +# the ppc64 patchset subtly breaks ppc, needs investigation; for +# now apply patches conditionally, separately for ppc64 and ppc +post_patch() { + local patchdir + + case "$XBPS_TARGET_MACHINE" in + ppc64*) patchdir="ppc64";; + ppc*) patchdir="ppc";; + *) return;; + esac + + for i in ${FILESDIR}/patches/${patchdir}/*.patch; do + msg_normal "patching: $i\n" + patch -sNp0 -i ${i} + done +} + do_build() { local _cflags=$CFLAGS local _ldflags=$LDFLAGS