Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Ostanevich <sergos@tarantool.org>,
	Sergey Kaplun <skaplun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH luajit 2/3] OSX/iOS: Handle iOS simulator and ARM64 Macs.
Date: Tue, 11 May 2021 01:09:06 +0300	[thread overview]
Message-ID: <c5998b63c1e8600d9452a6388ace179c28662b60.1620678384.git.imun@tarantool.org> (raw)
In-Reply-To: <cover.1620678384.git.imun@tarantool.org>

From: Mike Pall <mike>

(cherry picked from commit 2e2fb8f6b5118e1a7996b76600c6ee98bfd5f203)

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 (i.e. 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

Part of tarantool/tarantool#5629
Relates to tarantool/tarantool#5983

Signed-off-by: Igor Munkin <imun@tarantool.org>
---
 src/lj_arch.h                                         |  8 +++++++-
 .../gh-5983-jit-library-smoke-tests.test.lua          | 11 +++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 test/tarantool-tests/gh-5983-jit-library-smoke-tests.test.lua

diff --git a/src/lj_arch.h b/src/lj_arch.h
index d8676e92..5bf0afb8 100644
--- a/src/lj_arch.h
+++ b/src/lj_arch.h
@@ -69,6 +69,7 @@
 #elif defined(__linux__)
 #define LUAJIT_OS	LUAJIT_OS_LINUX
 #elif defined(__MACH__) && defined(__APPLE__)
+#include "TargetConditionals.h"
 #define LUAJIT_OS	LUAJIT_OS_OSX
 #elif (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
        defined(__NetBSD__) || defined(__OpenBSD__) || \
@@ -103,10 +104,15 @@
 #define LJ_TARGET_WINDOWS	(LUAJIT_OS == LUAJIT_OS_WINDOWS)
 #define LJ_TARGET_LINUX		(LUAJIT_OS == LUAJIT_OS_LINUX)
 #define LJ_TARGET_OSX		(LUAJIT_OS == LUAJIT_OS_OSX)
-#define LJ_TARGET_IOS		(LJ_TARGET_OSX && (LUAJIT_TARGET == LUAJIT_ARCH_ARM || LUAJIT_TARGET == LUAJIT_ARCH_ARM64))
 #define LJ_TARGET_POSIX		(LUAJIT_OS > LUAJIT_OS_WINDOWS)
 #define LJ_TARGET_DLOPEN	LJ_TARGET_POSIX
 
+#if TARGET_OS_IPHONE
+#define LJ_TARGET_IOS		1
+#else
+#define LJ_TARGET_IOS		0
+#endif
+
 #ifdef __CELLOS_LV2__
 #define LJ_TARGET_PS3		1
 #define LJ_TARGET_CONSOLE	1
diff --git a/test/tarantool-tests/gh-5983-jit-library-smoke-tests.test.lua b/test/tarantool-tests/gh-5983-jit-library-smoke-tests.test.lua
new file mode 100644
index 00000000..b23dd712
--- /dev/null
+++ b/test/tarantool-tests/gh-5983-jit-library-smoke-tests.test.lua
@@ -0,0 +1,11 @@
+local tap = require('tap')
+
+local test = tap.test('gh-5983-jit-library-smoke-tests')
+test:plan(1)
+
+-- Just check whether LuaJIT is built with JIT support. Otherwise,
+-- <jit.on> raises an error that is handled via <pcall> and passed
+-- as a second argument to the assertion.
+test:ok(pcall(jit.on))
+
+os.exit(test:check() and 0 or 1)
-- 
2.25.0


  parent reply	other threads:[~2021-05-10 22:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 22:09 [Tarantool-patches] [PATCH luajit 0/3] Basic fixes for LuaJIT on " Igor Munkin via Tarantool-patches
2021-05-10 22:09 ` [Tarantool-patches] [PATCH luajit 1/3] build: pass sysroot to MacOS SDK Igor Munkin via Tarantool-patches
2021-05-11  9:49   ` Sergey Kaplun via Tarantool-patches
2021-05-12 21:55     ` Igor Munkin via Tarantool-patches
2021-05-14 16:07       ` Sergey Kaplun via Tarantool-patches
2021-05-17 17:21         ` Igor Munkin via Tarantool-patches
2021-05-18  5:50           ` Sergey Kaplun via Tarantool-patches
2021-05-18 18:47             ` Igor Munkin via Tarantool-patches
2021-05-19 11:38               ` Igor Munkin via Tarantool-patches
2021-05-19 12:40                 ` Sergey Ostanevich via Tarantool-patches
2021-05-19 13:23                   ` Igor Munkin via Tarantool-patches
2021-05-19 16:06                     ` Sergey Kaplun via Tarantool-patches
2021-05-10 22:09 ` Igor Munkin via Tarantool-patches [this message]
2021-05-11 11:02   ` [Tarantool-patches] [PATCH luajit 2/3] OSX/iOS: Handle iOS simulator and ARM64 Macs Sergey Kaplun via Tarantool-patches
2021-05-11 11:03     ` Igor Munkin via Tarantool-patches
2021-05-14 11:36       ` Sergey Ostanevich via Tarantool-patches
2021-05-14 11:27         ` Igor Munkin via Tarantool-patches
2021-05-10 22:09 ` [Tarantool-patches] [PATCH luajit 3/3] FFI/ARM64/OSX: Fix vararg call handling Igor Munkin via Tarantool-patches
2021-05-11 11:07   ` Sergey Kaplun via Tarantool-patches
2021-05-11 11:31     ` Igor Munkin via Tarantool-patches
2021-05-12 16:11       ` Sergey Ostanevich via Tarantool-patches
2021-05-12 21:59         ` Igor Munkin via Tarantool-patches
2021-05-13  9:50           ` Sergey Ostanevich via Tarantool-patches
2021-05-13 10:44             ` Igor Munkin via Tarantool-patches
2021-05-14 10:10               ` Sergey Ostanevich via Tarantool-patches
2021-05-14 10:31                 ` Igor Munkin via Tarantool-patches
2021-05-19 15:38 ` [Tarantool-patches] [PATCH luajit 0/3] Basic fixes for LuaJIT on ARM64 Macs Igor Munkin via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5998b63c1e8600d9452a6388ace179c28662b60.1620678384.git.imun@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=sergos@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 2/3] OSX/iOS: Handle iOS simulator and ARM64 Macs.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox