Skip to content

Commit 931e94d

Browse files
Mike Palligormunkin
authored andcommitted
OSX/iOS: Handle iOS simulator and ARM64 Macs.
(cherry picked from commit 2e2fb8f) After Apple released Macs working on ARM64, the previous recipe in lj_arch.h for detecting various Apple platforms is not valid anymore. Fortunately, there is a system header (namely, TargetConditionals.h), provided by SDK with the proper defines to be set. Starting from this patch, LuaJIT identifies Apple hosts via this header. Since testing machinery assumes that LuaJIT is built with JIT support being enabled unconditionally, a smoke test for it is also added alongside with this patch. Igor Munkin: * added the description and the test for the problem * backported the original patch to tarantool/luajit repo Resolves tarantool/tarantool#6065 Part of tarantool/tarantool#5629 Relates to tarantool/tarantool#5983 Reviewed-by: Sergey Kaplun <[email protected]> Reviewed-by: Sergey Ostanevich <[email protected]> Signed-off-by: Igor Munkin <[email protected]>
1 parent 228f981 commit 931e94d

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/lj_arch.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
#elif defined(__linux__)
7070
#define LUAJIT_OS LUAJIT_OS_LINUX
7171
#elif defined(__MACH__) && defined(__APPLE__)
72+
#include "TargetConditionals.h"
7273
#define LUAJIT_OS LUAJIT_OS_OSX
7374
#elif (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
7475
defined(__NetBSD__) || defined(__OpenBSD__) || \
@@ -103,10 +104,15 @@
103104
#define LJ_TARGET_WINDOWS (LUAJIT_OS == LUAJIT_OS_WINDOWS)
104105
#define LJ_TARGET_LINUX (LUAJIT_OS == LUAJIT_OS_LINUX)
105106
#define LJ_TARGET_OSX (LUAJIT_OS == LUAJIT_OS_OSX)
106-
#define LJ_TARGET_IOS (LJ_TARGET_OSX && (LUAJIT_TARGET == LUAJIT_ARCH_ARM || LUAJIT_TARGET == LUAJIT_ARCH_ARM64))
107107
#define LJ_TARGET_POSIX (LUAJIT_OS > LUAJIT_OS_WINDOWS)
108108
#define LJ_TARGET_DLOPEN LJ_TARGET_POSIX
109109

110+
#if TARGET_OS_IPHONE
111+
#define LJ_TARGET_IOS 1
112+
#else
113+
#define LJ_TARGET_IOS 0
114+
#endif
115+
110116
#ifdef __CELLOS_LV2__
111117
#define LJ_TARGET_PS3 1
112118
#define LJ_TARGET_CONSOLE 1
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
local tap = require('tap')
2+
3+
local test = tap.test('gh-6065-jit-library-smoke-tests')
4+
test:plan(1)
5+
6+
-- Just check whether LuaJIT is built with JIT support. Otherwise,
7+
-- <jit.on> raises an error that is handled via <pcall> and passed
8+
-- as a second argument to the assertion.
9+
test:ok(pcall(jit.on))
10+
11+
os.exit(test:check() and 0 or 1)

0 commit comments

Comments
 (0)