lang/ruby/3.0 fails to build on mips64. It looks that the peephole
optimizer still has issues on this architecture. The following patch
disables it.
In addition, there is an alignment problem with the handling of builtins.
compiler.c assumes that bytecode arrays are properly aligned. However,
this assumption does not always hold on mips64, and the interpreter
crashes. The issue is similar to what was recently fixed in perl(1).
#0 ibf_load_setup_bytes () <-- unaligned load
#1 rb_iseq_ibf_load_bytes ()
#2 rb_load_with_builtin_functions ()
#3 Init_builtin_gc ()
#4 rb_call_builtin_inits ()
#5 ruby_opt_init ()
#6 load_file_internal ()
#7 rb_ensure ()
#8 ruby_process_options ()
#9 ruby_options ()
#10 main ()
The patch fixes the problem by forcing 8-byte alignment, though 4-byte
alignment should be enough. However, there probably are better ways to
fix this.
Index: patches/patch-compile_c
===================================================================
RCS file: ports/lang/ruby/3.0/patches/patch-compile_c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-compile_c
--- patches/patch-compile_c 28 Dec 2020 16:45:27 -0000 1.1.1.1
+++ patches/patch-compile_c 21 Mar 2021 13:13:37 -0000
@@ -1,6 +1,7 @@
$OpenBSD: patch-compile_c,v 1.1.1.1 2020/12/28 16:45:27 jeremy Exp $
-Disable peephole optimizer on sparc64, since it occasionally segfaults.
+Disable peephole optimizer on mips64 and sparc64, since it occasionally
+segfaults.
Index: compile.c
--- compile.c.orig
@@ -9,7 +10,7 @@ Index: compile.c
iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcallopt)
{
INSN *const iobj = (INSN *)list;
-+#ifdef __sparc64__
++#if defined(__mips64__) || defined(__sparc64__)
+ return COMPILE_OK;
+
No comments:
Post a Comment