LuaJIT: update to 2.1.0-beta3, add patches

The patches enable support on ppc64 targets and some other things,
taken from Ubuntu, plus a bcsave.lua patch made by myself.
This commit is contained in:
q66 2018-12-14 18:30:27 +01:00 committed by maxice8
parent b78b4e21e8
commit f642382ad7
7 changed files with 3721 additions and 18 deletions

View file

@ -0,0 +1,29 @@
From: Jason Teplitz <jason@tensyr.com>
Date: Mon, 9 Oct 2017 23:03:09 +0000
Subject: Fix register allocation bug in arm64
---
src/lj_asm_arm64.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git src/lj_asm_arm64.h src/lj_asm_arm64.h
index 8fd92e7..549f8a6 100644
--- src/lj_asm_arm64.h
+++ src/lj_asm_arm64.h
@@ -871,7 +871,7 @@ static void asm_hrefk(ASMState *as, IRIns *ir)
int bigofs = !emit_checkofs(A64I_LDRx, ofs);
RegSet allow = RSET_GPR;
Reg dest = (ra_used(ir) || bigofs) ? ra_dest(as, ir, RSET_GPR) : RID_NONE;
- Reg node = ra_alloc1(as, ir->op1, allow);
+ Reg node = ra_alloc1(as, ir->op1, ra_hasreg(dest) ? rset_clear(allow, dest) : allow);
Reg key = ra_scratch(as, rset_clear(allow, node));
Reg idx = node;
uint64_t k;
@@ -879,7 +879,6 @@ static void asm_hrefk(ASMState *as, IRIns *ir)
rset_clear(allow, key);
if (bigofs) {
idx = dest;
- rset_clear(allow, dest);
kofs = (int32_t)offsetof(Node, key);
} else if (ra_hasreg(dest)) {
emit_opk(as, A64I_ADDx, dest, node, ofs, allow);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,24 @@
From: =?utf-8?q?Ond=C5=99ej_Sur=C3=BD?= <ondrej@sury.org>
Date: Tue, 17 Nov 2015 16:27:11 +0100
Subject: Enable debugging symbols in the build
---
src/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git src/Makefile src/Makefile
index 8a38efd..6b73a89 100644
--- src/Makefile
+++ src/Makefile
@@ -54,9 +54,9 @@ CCOPT_arm64=
CCOPT_ppc=
CCOPT_mips=
#
-CCDEBUG=
+#CCDEBUG=
# Uncomment the next line to generate debug information:
-#CCDEBUG= -g
+CCDEBUG= -g
#
CCWARN= -Wall
# Uncomment the next line to enable more warnings:

View file

@ -0,0 +1,33 @@
--- src/jit/bcsave.lua.orig 2018-12-17 19:06:27.215042417 +0100
+++ src/jit/bcsave.lua 2018-12-17 19:17:12.982477945 +0100
@@ -64,7 +64,7 @@
local map_arch = {
x86 = true, x64 = true, arm = true, arm64 = true, arm64be = true,
- ppc = true, mips = true, mipsel = true,
+ ppc = true, ppc64 = true, ppc64le = true, mips = true, mipsel = true,
}
local map_os = {
@@ -200,9 +200,10 @@
]]
local symname = LJBC_PREFIX..ctx.modname
local is64, isbe = false, false
- if ctx.arch == "x64" or ctx.arch == "arm64" or ctx.arch == "arm64be" then
+ if ctx.arch == "x64" or ctx.arch == "arm64" or ctx.arch == "arm64be" or ctx.arch == "ppc64" or ctx.arch == "ppc64le" then
is64 = true
- elseif ctx.arch == "ppc" or ctx.arch == "mips" then
+ end
+ if ctx.arch == "ppc" or ctx.arch == "ppc64" or ctx.arch == "mips" then
isbe = true
end
@@ -237,7 +238,7 @@
hdr.eendian = isbe and 2 or 1
hdr.eversion = 1
hdr.type = f16(1)
- hdr.machine = f16(({ x86=3, x64=62, arm=40, arm64=183, arm64be=183, ppc=20, mips=8, mipsel=8 })[ctx.arch])
+ hdr.machine = f16(({ x86=3, x64=62, arm=40, arm64=183, arm64be=183, ppc=20, ppc64=21, ppc64le=21, mips=8, mipsel=8 })[ctx.arch])
if ctx.arch == "mips" or ctx.arch == "mipsel" then
hdr.flags = f32(0x50001006)
end

View file

@ -0,0 +1,51 @@
From: =?utf-8?q?Ond=C5=99ej_Sur=C3=BD?= <ondrej@sury.org>
Date: Thu, 19 Nov 2015 16:29:02 +0200
Subject: Get rid of LUAJIT_VERSION_SYM that changes ABI on every patch release
---
src/lj_dispatch.c | 5 -----
src/luajit.c | 2 --
src/luajit.h | 3 ---
3 files changed, 10 deletions(-)
diff --git src/lj_dispatch.c src/lj_dispatch.c
index 5d6795f..e865a78 100644
--- src/lj_dispatch.c
+++ src/lj_dispatch.c
@@ -319,11 +319,6 @@ int luaJIT_setmode(lua_State *L, int idx, int mode)
return 1; /* OK. */
}
-/* Enforce (dynamic) linker error for version mismatches. See luajit.c. */
-LUA_API void LUAJIT_VERSION_SYM(void)
-{
-}
-
/* -- Hooks --------------------------------------------------------------- */
/* This function can be called asynchronously (e.g. during a signal). */
diff --git src/luajit.c src/luajit.c
index 1ca2430..ccf425e 100644
--- src/luajit.c
+++ src/luajit.c
@@ -516,8 +516,6 @@ static int pmain(lua_State *L)
globalL = L;
if (argv[0] && argv[0][0]) progname = argv[0];
- LUAJIT_VERSION_SYM(); /* Linker-enforced version check. */
-
argn = collectargs(argv, &flags);
if (argn < 0) { /* Invalid args? */
print_usage();
diff --git src/luajit.h src/luajit.h
index 708a5a1..35ae02c 100644
--- src/luajit.h
+++ src/luajit.h
@@ -73,7 +73,4 @@ LUA_API void luaJIT_profile_stop(lua_State *L);
LUA_API const char *luaJIT_profile_dumpstack(lua_State *L, const char *fmt,
int depth, size_t *len);
-/* Enforce (dynamic) linker error for version mismatches. Call from main. */
-LUA_API void LUAJIT_VERSION_SYM(void);
-
#endif

View file

@ -0,0 +1,21 @@
From: =?utf-8?q?Ond=C5=99ej_Sur=C3=BD?= <ondrej@sury.org>
Date: Wed, 11 Oct 2017 08:42:41 +0000
Subject: Make ccall_copy_struct static to unpollute global library namespace
---
src/lj_ccall.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/lj_ccall.c src/lj_ccall.c
index b891591..a7dcc1b 100644
--- src/lj_ccall.c
+++ src/lj_ccall.c
@@ -960,7 +960,7 @@ noth: /* Not a homogeneous float/double aggregate. */
return 0; /* Struct is in GPRs. */
}
-void ccall_copy_struct(CCallState *cc, CType *ctr, void *dp, void *sp, int ft)
+static void ccall_copy_struct(CCallState *cc, CType *ctr, void *dp, void *sp, int ft)
{
if (LJ_ABI_SOFTFP ? ft :
((ft & 3) == FTYPE_FLOAT || (ft >> 2) == FTYPE_FLOAT)) {

View file

@ -1,35 +1,58 @@
# Template file for 'LuaJIT'
pkgname=LuaJIT
version=2.0.5
revision=2
version=2.1.0beta3
revision=1
_so_version=2.1.0
_dist_version=${_so_version}-beta3
wrksrc="${pkgname}-${_dist_version}"
hostmakedepends="lua52-BitOp"
short_desc="A Just-In-Time Compiler for Lua"
maintainer="Juan RP <xtraeme@voidlinux.org>"
homepage="http://www.luajit.org"
short_desc="Just-In-Time Compiler for Lua"
maintainer="q66 <daniel@octaforge.org>"
license="MIT"
distfiles="http://luajit.org/download/$pkgname-$version.tar.gz"
checksum=874b1f8297c697821f561f9b73b57ffd419ed8f4278c82e05b48806d30c1e979
case "$XBPS_TARGET_MACHINE" in
arm*-musl) broken="https://build.voidlinux.eu/builders/armv7l-musl_builder/builds/6139/steps/shell_3/logs/stdio" ;;
aarch64*) broken="unsupported";;
esac
homepage="http://www.luajit.org"
distfiles="http://luajit.org/download/${pkgname}-${_dist_version}.tar.gz"
checksum=1ad2e34b111c802f9d0cdf019e986909123237a28c746b21295b63c9e785d9c3
if [ "$CROSS_BUILD" -a "$XBPS_MACHINE" = "x86_64" ]; then
hostmakedepends+=" gcc-multilib"
fi
_cross_cc="cc"
if [ "$CROSS_BUILD" ]; then
# cross toolchains are only for x86_64, ppc64 and i686 hosts
# luajit needs matching bitness for host and target
# on x86_64 we can multilib, on others we can't
case "$XBPS_MACHINE" in
x86_64)
case "$XBPS_TARGET_MACHINE" in
ppc64*) ;;
arm*|i686*|mips*|ppc*) _cross_cc="cc -m32";;
esac
;;
ppc64*|x86_64-musl)
case "$XBPS_TARGET_MACHINE" in
ppc64*) ;;
arm*|i686*|mips*|ppc*)
broken="Mismatched bitness on non-multilib host"
;;
esac
;;
i686*)
case "$XBPS_TARGET_MACHINE" in
x86_64*|ppc64*|aarch64*)
broken="Mismatched bitness on non-multilib host"
;;
esac
;;
esac
fi
do_build() {
local _cflags=$CFLAGS
local _ldflags=$LDFLAGS
local _cross_cc=cc
if [ "$CROSS_BUILD" ]; then
local cross="CROSS=${XBPS_CROSS_TRIPLET}-"
case "$XBPS_MACHINE" in
x86_64) _cross_cc="cc -m32";;
*) _cross_cc="cc";;
esac
fi
unset CFLAGS LDFLAGS
@ -42,7 +65,8 @@ do_install() {
make DPREFIX=${DESTDIR}/usr DESTDIR=${DESTDIR} \
INSTALL_SHARE=${DESTDIR}/usr/share PREFIX=/usr install
ln -fs libluajit-5.1.so.${version} ${DESTDIR}/usr/lib/libluajit-5.1.so.2
mv ${DESTDIR}/usr/bin/luajit-* ${DESTDIR}/usr/bin/luajit
ln -fs libluajit-5.1.so.${_so_version} ${DESTDIR}/usr/lib/libluajit-5.1.so.2
vlicense COPYRIGHT
}