From 659245acc7dcc28e345b8dfa50571102f4f07728 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 8 Apr 2020 20:14:08 +0200 Subject: 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 --- src/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/CMakeLists.txt') 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) -- cgit v1.2.3