fix: Fix LuaJIT on Windows

It turned out that with disabling GC64, LuaJIT would immediately
overflow the stack when opening a Lua state. For now, this reverts to
a version from 2019 that works, but I highly doubt that LuaJIT woould
have been broken on Windows for years.

I'll have to investigate, or rather trial-and-error further.
This commit is contained in:
Lucas Schwiderski 2023-04-09 12:21:29 +02:00
parent 7395cf0d53
commit 24da35e631
Signed by: lucas
GPG key ID: AA12679AAA6DF4D8
2 changed files with 2 additions and 12 deletions

View file

@ -7,12 +7,11 @@ use std::process::{Command, Stdio};
const LIB_NAME: &str = "luajit";
const LUAJIT_HEADERS: [&str; 4] = ["lua.h", "lualib.h", "lauxlib.h", "luajit.h"];
const LUAJIT_SRC: [&str; 69] = [
const LUAJIT_SRC: [&str; 65] = [
// LJCORE_O
// The MSVC toolchain cannot compile this assembler file,
// as it contains GNU-specific directives
// "lj_vm.S",
"lj_assert.c",
"lj_gc.c",
"lj_err.c",
"lj_char.c",
@ -25,7 +24,6 @@ const LUAJIT_SRC: [&str; 69] = [
"lj_udata.c",
"lj_meta.c",
"lj_debug.c",
"lj_prng.c",
"lj_state.c",
"lj_dispatch.c",
"lj_vmevent.c",
@ -33,7 +31,6 @@ const LUAJIT_SRC: [&str; 69] = [
"lj_strscan.c",
"lj_strfmt.c",
"lj_strfmt_num.c",
"lj_serialize.c",
"lj_api.c",
"lj_profile.c",
"lj_lex.c",
@ -80,7 +77,6 @@ const LUAJIT_SRC: [&str; 69] = [
"lib_debug.c",
"lib_jit.c",
"lib_ffi.c",
"lib_buffer.c",
"lib_init.c",
];
@ -90,12 +86,6 @@ fn build_gcc(src_dir: &str) {
buildcmd.stderr(Stdio::inherit());
buildcmd.arg("--no-silent");
// This became enabled by default in https://github.com/LuaJIT/LuaJIT/commit/bd00094c3b50e193fb32aad79b7ea8ea6b78ed25
// but changes the generated bytecode. Bitsquid does not have it currently.
// The documentation changes in the commit mention that the bytecode change might be "rectified"
// in the future, though.
buildcmd.arg("XCFLAGS=-DLUAJIT_DISABLE_GC64");
// We do need to cross-compile even here, so that `lj_vm.o` is created
// for the correct architecture.
if env::var("CARGO_CFG_WINDOWS").is_ok() {

2
luajit

@ -1 +1 @@
Subproject commit 505e2c03de35e2718eef0d2d3660712e06dadf1f
Subproject commit 70f4b15ee45a6137fe6b48b941faea79d72f7159