dev-lang/ruby: avoid UB with coroutines for 4.0.x

Define RB_THREAD_CURRENT_EC_NOINLINE to always make a function call to
get the coroutine execution context. Without it, GCC 16's x86 CSE pass
will (with TLS descriptors at least) cache the value.

971174054a26be0a4becbe7c67a7cc980158abf2 added the convenient macro
in 4.0.0, so for older releases, we'll have to patch instead.

Bug: https://bugs.ruby-lang.org/issues/20243
Bug: https://gcc.gnu.org/PR124995
Closes: https://bugs.gentoo.org/972696
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2026-04-23 03:28:07 +01:00
parent 690eaf6a55
commit f5d6088c5a
2 changed files with 4 additions and 0 deletions

View File

@@ -209,6 +209,8 @@ src_configure() {
append-flags -fno-strict-aliasing
# Fails to link (gcc PR124865, gcc PR50676)
filter-flags -flto-partition=cache
# bug #972696
append-cppflags -DRB_THREAD_CURRENT_EC_NOINLINE
# Workaround for bug #938302
if use systemtap && has_version "dev-debug/systemtap[-dtrace-symlink(+)]" ; then

View File

@@ -209,6 +209,8 @@ src_configure() {
append-flags -fno-strict-aliasing
# Fails to link (gcc PR124865, gcc PR50676)
filter-flags -flto-partition=cache
# bug #972696
append-cppflags -DRB_THREAD_CURRENT_EC_NOINLINE
# Workaround for bug #938302
if use systemtap && has_version "dev-debug/systemtap[-dtrace-symlink(+)]" ; then