void-packages/srcpkgs/texlive/patches/luajit-arch-fixes.patch

51 lines
2.0 KiB
Diff

Have texluajit recognize ppc64 ELFv2 ABI and therefore emit correct dynasm
stuff.
Also, fix luajittex crashing on non-x86 64-bit systems (MAP_32BIT only exists
on x86 and defining it on other systems will activate a codepath in luajit
that segfaults).
Author: q66 <daniel@octaforge.org>
--- libs/luajit/configure
+++ libs/luajit/configure
@@ -14243,7 +14243,7 @@ else
fi
if grep 'LJ_ARCH_BITS 64' conftest.i >/dev/null 2>&1; then :
echo '-D P64' >>dynasm_flags
- if test "x$LJHOST" = xLinux; then :
+ if test "x$LJHOST" = xLinux -a "x$LJARCH" = xx64; then :
LUAJIT_DEFINES="$LUAJIT_DEFINES -DMAP_32BIT=0x40"
fi
fi
@@ -14294,6 +14294,9 @@ fi
fi
if grep 'LJ_ARCH_PPC32ON64 1' conftest.i >/dev/null 2>&1; then :
echo '-D GPR64' >>dynasm_flags
+fi
+ if grep 'LJ_ARCH_PPC_ELFV2 1' conftest.i >/dev/null 2>&1; then :
+ echo '-D ELFV2' >>dynasm_flags
fi
if grep 'LJ_ARCH_PPC64 ' conftest.i >/dev/null 2>&1; then :
DASM_ARCH=ppc64
--- libs/luajit/m4/lj-system.m4
+++ libs/luajit/m4/lj-system.m4
@@ -52,7 +52,7 @@ AS_IF([grep 'LJ_LE' conftest.i >/dev/null 2>&1],
[echo '-D ENDIAN_BE' >>dynasm_flags])
AS_IF([grep 'LJ_ARCH_BITS 64' conftest.i >/dev/null 2>&1],
[echo '-D P64' >>dynasm_flags
- AS_IF([test "x$LJHOST" = xLinux],
+ AS_IF([test "x$LJHOST" = xLinux -a "x$LJARCH" = xx64],
[LUAJIT_DEFINES="$LUAJIT_DEFINES -DMAP_32BIT=0x40"])])
AS_IF([grep 'LJ_HASJIT 1' conftest.i >/dev/null 2>&1],
[echo '-D JIT' >>dynasm_flags])
@@ -84,6 +84,8 @@ AS_CASE([$LJARCH],
[echo '-D ROUND' >>dynasm_flags])
AS_IF([grep 'LJ_ARCH_PPC32ON64 1' conftest.i >/dev/null 2>&1],
[echo '-D GPR64' >>dynasm_flags])
+ AS_IF([grep 'LJ_ARCH_PPC_ELFV2 1' conftest.i >/dev/null 2>&1],
+ [echo '-D ELFV2' >>dynasm_flags])
AS_IF([grep 'LJ_ARCH_PPC64 ' conftest.i >/dev/null 2>&1],
[DASM_ARCH=ppc64])
AS_IF([test "x$LJHOST" = xPS3],