From ff90d2da505c30d0b053d44c3c7187a2aaee80df Mon Sep 17 00:00:00 2001 From: YingJie Fu Date: Wed, 17 Jul 2024 20:44:05 -0700 Subject: [PATCH] Build the built-in luajit for s390x Signed-off-by: YingJie Fu --- README.md | 2 +- cmake/s390x.cmake | 2 -- lib/luajit-cmake/Bundle.cmake | 2 ++ lib/luajit-cmake/LuaJIT.cmake | 8 +++++++- lib/luajit-cmake/Modules/FindUnwind.cmake | 2 ++ lib/luajit-cmake/host/buildvm/CMakeLists.txt | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a6ba08be9e8..c7e7e6ae8e9 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ Fluent Bit is fully supported on Windows environments, get started with [these i #### Running on s390x -Fluent Bit is supported on Linux on IBM Z(s390x), but the WASM and LUA filter plugins are not. +Fluent Bit is supported on Linux on IBM Z(s390x), but the WASM is not. ### Plugins: Inputs, Filters and Outputs diff --git a/cmake/s390x.cmake b/cmake/s390x.cmake index af70127ceb4..a570319c240 100644 --- a/cmake/s390x.cmake +++ b/cmake/s390x.cmake @@ -3,6 +3,4 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(SystemZ|s390x)") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsigned-char") message(STATUS "Cannot build WAMR on this platform, so WASM support is disabled.") set(FLB_WASM OFF) - message(STATUS "This platform does not support LuaJIT, so it's disabled.") - set(FLB_LUAJIT OFF) endif () diff --git a/lib/luajit-cmake/Bundle.cmake b/lib/luajit-cmake/Bundle.cmake index bb477985cd8..d8431d4a2ec 100644 --- a/lib/luajit-cmake/Bundle.cmake +++ b/lib/luajit-cmake/Bundle.cmake @@ -138,6 +138,8 @@ else() else() set(LJ_TARGET_ARCH "ppc") endif() + elseif("${LJ_DETECTED_ARCH}" STREQUAL "SystemZ") + set(LJ_TARGET_ARCH "s390x") else() message(FATAL_ERROR "Unsupported target architecture: '${LJ_DETECTED_ARCH}'") endif() diff --git a/lib/luajit-cmake/LuaJIT.cmake b/lib/luajit-cmake/LuaJIT.cmake index c0dee5830c5..036ef199e6c 100644 --- a/lib/luajit-cmake/LuaJIT.cmake +++ b/lib/luajit-cmake/LuaJIT.cmake @@ -122,6 +122,11 @@ elseif("${LJ_DETECTED_ARCH}" STREQUAL "AArch64") endif() elseif("${LJ_DETECTED_ARCH}" STREQUAL "ARM") set(LJ_TARGET_ARCH "arm") +elseif("${LJ_DETECTED_ARCH}" STREQUAL "SystemZ") + set(LJ_TARGET_ARCH "s390x") + if(LJ_BIG_ENDIAN) + set(TARGET_ARCH -DLJ_ARCH_ENDIAN=LUAJIT_BE) + endif() elseif("${LJ_DETECTED_ARCH}" STREQUAL "Mips64") set(LJ_TARGET_ARCH "mips64") if(NOT LJ_BIG_ENDIAN) @@ -248,7 +253,7 @@ if(LUAJIT_DISABLE_FFI) endif() set(LJ_JIT 1) -if(LUAJIT_DISABLE_JIT) +if(LUAJIT_DISABLE_JIT OR ("${LJ_TARGET_ARCH}" STREQUAL "s390x")) set(LJ_JIT 0) endif() @@ -282,6 +287,7 @@ endif() if(("${LJ_TARGET_ARCH}" STREQUAL "arm") OR ("${LJ_TARGET_ARCH}" STREQUAL "arm64") OR ("${LJ_TARGET_ARCH}" STREQUAL "mips") OR + ("${LJ_TARGET_ARCH}" STREQUAL "s390x") OR ("${LJ_TARGET_ARCH}" STREQUAL "mips64")) set(LJ_ARCH_NUMMODE ${LJ_NUMMODE_DUAL}) endif() diff --git a/lib/luajit-cmake/Modules/FindUnwind.cmake b/lib/luajit-cmake/Modules/FindUnwind.cmake index a3649a5e895..b27bb759089 100644 --- a/lib/luajit-cmake/Modules/FindUnwind.cmake +++ b/lib/luajit-cmake/Modules/FindUnwind.cmake @@ -26,6 +26,8 @@ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64") set(LIBUNWIND_ARCH "ppc64") elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc") set(LIBUNWIND_ARCH "ppc32") +elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^s390x") + set(LIBUNWIND_ARCH "s390x") elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") set(LIBUNWIND_ARCH "mips") elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^hppa") diff --git a/lib/luajit-cmake/host/buildvm/CMakeLists.txt b/lib/luajit-cmake/host/buildvm/CMakeLists.txt index 68dfb11b264..af92d385969 100755 --- a/lib/luajit-cmake/host/buildvm/CMakeLists.txt +++ b/lib/luajit-cmake/host/buildvm/CMakeLists.txt @@ -12,7 +12,7 @@ else() endif() include(CheckTypeSize) -if("${EXTRA_COMPILER_FLAGS}" MATCHES "LUAJIT_ARCH_.*64") +if("${EXTRA_COMPILER_FLAGS}" MATCHES "LUAJIT_ARCH_.*(64|s390x)") set(TARGET_SIZE_OF_P 8) else() set(TARGET_SIZE_OF_P 4)