summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2020-04-08 20:14:08 +0200
committerGitHub <noreply@github.com>2020-04-08 20:14:08 +0200
commit659245acc7dcc28e345b8dfa50571102f4f07728 (patch)
treea0bcb88e12627c01e1858c9dc52ecff0326d7675 /src/CMakeLists.txt
parentde73f989eb1397b1103236031fd91309b294583c (diff)
downloadminetest-659245acc7dcc28e345b8dfa50571102f4f07728.tar.gz
minetest-659245acc7dcc28e345b8dfa50571102f4f07728.tar.bz2
minetest-659245acc7dcc28e345b8dfa50571102f4f07728.zip
Work around LuaJIT issues on aarch64 (#9614)
- Move the text segment below the 47-bit limit, needed for script_exception_wrapper which must be lightuserdata - Replace CUSTOM_RIDX_SCRIPTAPI with full userdata
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6afa5b8fe..d579bb965 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -661,7 +661,7 @@ endif()
# Set some optimizations and tweaks
-include(CheckCXXCompilerFlag)
+include(CheckCSourceCompiles)
if(MSVC)
# Visual Studio
@@ -695,13 +695,19 @@ else()
else()
set(RELEASE_WARNING_FLAGS "")
endif()
-
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(WARNING_FLAGS "${WARNING_FLAGS} -Wsign-compare")
endif()
+
if(APPLE AND USE_LUAJIT)
# required per http://luajit.org/install.html
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000")
+ elseif(UNIX AND USE_LUAJIT)
+ check_c_source_compiles("#ifndef __aarch64__\n#error\n#endif\nint main(){}" IS_AARCH64)
+ if(IS_AARCH64)
+ # Move text segment below LuaJIT's 47-bit limit (see issue #9367)
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Ttext-segment=0x200000000")
+ endif()
endif()
if(MINGW)