aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2020-04-21 15:22:50 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2020-04-22 06:12:49 +0000
commit3c82796fd36ef7e1ca5252967a3ddcb70cfb1a33 (patch)
tree343f4eaa7dd6b847a3d1211e9d6fde615d660f94
parentf7ce4fe25def225c1c1a96b7304bed0b3c1ae97e (diff)
downloadaports-3c82796fd36ef7e1ca5252967a3ddcb70cfb1a33.tar.bz2
aports-3c82796fd36ef7e1ca5252967a3ddcb70cfb1a33.tar.xz
main/ruby: backport upstream fix for coroutines on arm32
-rw-r--r--main/ruby/APKBUILD4
-rw-r--r--main/ruby/arm-coroutines.patch103
2 files changed, 106 insertions, 1 deletions
diff --git a/main/ruby/APKBUILD b/main/ruby/APKBUILD
index 538f9819eb..bf3bf6bf12 100644
--- a/main/ruby/APKBUILD
+++ b/main/ruby/APKBUILD
@@ -72,6 +72,7 @@ source="https://cache.ruby-lang.org/pub/ruby/${pkgver%.*}/ruby-$pkgver.tar.gz
test_insns-lower-recursion-depth.patch
fix-get_main_stack.patch
openssl-config-support-include-directive.patch
+ arm-coroutines.patch
"
replaces="ruby-gems"
@@ -347,4 +348,5 @@ sha512sums="d54ec78d46644269a200cc64c84beed1baaea74189e0ffc167f90f4b9540bb6d9e7b
cfdc5ea3b2e2ea69c51f38e8e2180cb1dc27008ca55cc6301f142ebafdbab31c3379b3b6bba9ff543153876dd98ed2ad194df3255b7ea77a62e931c935f80538 rubygems-avoid-platform-specific-gems.patch
814fe6359505b70d8ff680adf22f20a74b4dbd3fecc9a63a6c2456ee9824257815929917b6df5394ed069a6869511b8c6dce5b95b4acbbb7867c1f3a975a0150 test_insns-lower-recursion-depth.patch
8d730f02f76e53799f1c220eb23e3d2305940bb31216a7ab1e42d3256149c0721c7d173cdbfe505023b1af2f5cb3faa233dcc1b5d560fa8f980c17c2d29a9d81 fix-get_main_stack.patch
-a67813d7aa3553ed336f04b17461c5129546afb71a2a7cca6d1b1c860f8dd5839ca2f7695c971369f295aced3580687a28881ccd6c305f6dbdfe6b0ecf584d0e openssl-config-support-include-directive.patch"
+a67813d7aa3553ed336f04b17461c5129546afb71a2a7cca6d1b1c860f8dd5839ca2f7695c971369f295aced3580687a28881ccd6c305f6dbdfe6b0ecf584d0e openssl-config-support-include-directive.patch
+eaee5cd1b11506df5d28d6ac909b0eae55d88e7fbb471a0cee1be7293934980a36616603a5bcb5cf8bf8518e5f313e2bba566c52bd57afe62505c8e02b0a7b87 arm-coroutines.patch"
diff --git a/main/ruby/arm-coroutines.patch b/main/ruby/arm-coroutines.patch
new file mode 100644
index 0000000000..8df9d995d7
--- /dev/null
+++ b/main/ruby/arm-coroutines.patch
@@ -0,0 +1,103 @@
+Upstream: https://github.com/ruby/ruby/pull/2995
+
+From 9ce598b91e6ec8a146eec57c751d18dbebd2db60 Mon Sep 17 00:00:00 2001
+From: Paul Jordan <paullj1@gmail.com>
+Date: Wed, 1 Apr 2020 02:13:49 +0100
+Subject: [PATCH 1/3] ucontext doesn't exist in a musl-libc env; use native
+ assembly
+
+---
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5bc93800efd1..a054d163b316 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2353,8 +2353,8 @@ AS_CASE([$rb_cv_coroutine], [yes|''], [
+ [*86-mingw32], [
+ rb_cv_coroutine=win32
+ ],
+- [armv7*-linux*], [
+- rb_cv_coroutine=ucontext
++ [arm*-linux*], [
++ rb_cv_coroutine=arm32
+ ],
+ [aarch64-linux*], [
+ rb_cv_coroutine=arm64
+
+From e2f04a9a9684ea3575546cc317dd16dba54ecbaf Mon Sep 17 00:00:00 2001
+From: Paul Jordan <paullj1@gmail.com>
+Date: Wed, 1 Apr 2020 02:15:20 +0100
+Subject: [PATCH 2/3] Patch assembly so that it aligns properly
+
+---
+ coroutine/arm32/Context.S | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/coroutine/arm32/Context.S b/coroutine/arm32/Context.S
+index 195364fb655f..b66db29622a4 100644
+--- a/coroutine/arm32/Context.S
++++ b/coroutine/arm32/Context.S
+@@ -5,9 +5,13 @@
+ ## Copyright, 2018, by Samuel Williams.
+ ##
+
++.file "Context.S"
+ .text
+-
+ .globl coroutine_transfer
++.align 2
++.type coroutine_transfer,%function
++.syntax unified
++
+ coroutine_transfer:
+ # Save caller state (8 registers + return address)
+ push {r4-r11,lr}
+
+From 360904b97e0f1012855cd150a59cc0074cfa7453 Mon Sep 17 00:00:00 2001
+From: Paul Jordan <paullj1@gmail.com>
+Date: Wed, 1 Apr 2020 02:18:23 +0100
+Subject: [PATCH 3/3] Fix helper to not assume glibc
+
+---
+ test/fiddle/helper.rb | 19 ++++++++++++++++---
+ 1 file changed, 16 insertions(+), 3 deletions(-)
+
+diff --git a/test/fiddle/helper.rb b/test/fiddle/helper.rb
+index 348131e4480f..f5c7bd2ca6c7 100644
+--- a/test/fiddle/helper.rb
++++ b/test/fiddle/helper.rb
+@@ -32,7 +32,11 @@
+ # libc.so and libm.so are installed to /lib/arm-linux-gnu*.
+ # It's not installed to /lib32.
+ dirs = Dir.glob('/lib/arm-linux-gnu*')
+- libdir = dirs[0] if dirs && File.directory?(dirs[0])
++ if dirs.length > 0
++ libdir = dirs[0] if dirs && File.directory?(dirs[0])
++ else # handle alpine environment
++ libdir = '/lib' if File.directory? '/lib'
++ end
+ else
+ libdir = '/lib32' if File.directory? '/lib32'
+ end
+@@ -40,8 +44,17 @@
+ # 64-bit ruby
+ libdir = '/lib64' if File.directory? '/lib64'
+ end
+- libc_so = File.join(libdir, "libc.so.6")
+- libm_so = File.join(libdir, "libm.so.6")
++
++ # Handle musl libc
++ libc = Dir.glob(File.join(libdir, "libc.musl*.so*"))
++ if libc && libc.length > 0
++ libc_so = libc[0]
++ libm_so = libc[0]
++ else
++ # glibc
++ libc_so = File.join(libdir, "libc.so.6")
++ libm_so = File.join(libdir, "libm.so.6")
++ end
+ when /mingw/, /mswin/
+ require "rbconfig"
+ crtname = RbConfig::CONFIG["RUBY_SO_NAME"][/msvc\w+/] || 'ucrtbase'