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.
This commit is contained in:
q66 2019-10-11 12:07:41 +02:00 committed by Helmut Pozimski
parent 83bf8389e1
commit da1f946705
4 changed files with 23 additions and 10 deletions

View file

@ -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))

View file

@ -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