From 3db440f5a19ca8d46c2c5d5ec029dbae73cc34f9 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Thu, 13 Feb 2025 21:08:20 -0800 Subject: [PATCH] merge revision(s) f7059af50a31a4d27a04ace0beadb60616f3f971: [Backport #21046] Use no-inline version `rb_current_ec` on Arm64 The TLS across .so issue seems related to Arm64, but not Darwin. --- thread_pthread.h | 4 ++-- version.h | 2 +- vm.c | 2 +- vm_core.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/thread_pthread.h b/thread_pthread.h index dfc8ad4272..b632668a2a 100644 --- a/thread_pthread.h +++ b/thread_pthread.h @@ -133,8 +133,8 @@ struct rb_thread_sched { #ifdef RB_THREAD_LOCAL_SPECIFIER NOINLINE(void rb_current_ec_set(struct rb_execution_context_struct *)); - # ifdef __APPLE__ - // on Darwin, TLS can not be accessed across .so + # if defined(__arm64__) || defined(__aarch64__) + // on Arm64, TLS can not be accessed across .so NOINLINE(struct rb_execution_context_struct *rb_current_ec(void)); # else RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec; diff --git a/version.h b/version.h index 1c7cd992fc..f8d79f53d3 100644 --- a/version.h +++ b/version.h @@ -11,7 +11,7 @@ # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 1 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 16 +#define RUBY_PATCHLEVEL 17 #include "ruby/version.h" #include "ruby/internal/abi.h" diff --git a/vm.c b/vm.c index db168e62c0..cff159a663 100644 --- a/vm.c +++ b/vm.c @@ -571,7 +571,7 @@ rb_current_ec_set(rb_execution_context_t *ec) } -#ifdef __APPLE__ +#if defined(__arm64__) || defined(__aarch64__) rb_execution_context_t * rb_current_ec(void) { diff --git a/vm_core.h b/vm_core.h index 8cbf999e3e..961cc3967c 100644 --- a/vm_core.h +++ b/vm_core.h @@ -1977,7 +1977,7 @@ static inline rb_execution_context_t * rb_current_execution_context(bool expect_ec) { #ifdef RB_THREAD_LOCAL_SPECIFIER - #ifdef __APPLE__ + #if defined(__arm64__) || defined(__aarch64__) rb_execution_context_t *ec = rb_current_ec(); #else rb_execution_context_t *ec = ruby_current_ec;