FS#39470 - [ruby] Compiled with SSE2 instructions

Attached to Project: Arch Linux
Opened by Grzegorz Antoniak (antekone) - Saturday, 15 March 2014, 22:24 GMT
Last edited by Anatol Pomozov (anatolik) - Monday, 24 March 2014, 19:07 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Thomas Dziedzic (tomd123)
Anatol Pomozov (anatolik)
Architecture i686
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

It seems that ruby 2.1.1-1 was compiled with SSE2 instructions enabled. ArchLinux is targeted to i686, so I guess SSE2 aren't allowed here?

(2:522)$ objdump -d /usr/lib/libruby.so | grep movapd | head
2c743: 66 0f 28 c8 movapd %xmm0,%xmm1
2c7e5: 66 0f 28 9b 10 89 f4 movapd -0xb76f0(%ebx),%xmm3
2c800: 66 0f 28 f3 movapd %xmm3,%xmm6
2c808: 66 0f 28 fb movapd %xmm3,%xmm7
32676: 66 0f 28 c8 movapd %xmm0,%xmm1
765d5: 66 0f 28 8b 10 89 f4 movapd -0xb76f0(%ebx),%xmm1
[...]

Additional info:

(2:521)$ pacman -Qo /usr/lib/libruby.so.2.1.0
/usr/lib/libruby.so.2.1.0 jest własnością ruby 2.1.1-1

Steps to reproduce:

I can reproduce it by e.g. installing 'weechat', and running 'weechat'. Weechat will load its ruby.so extension, which in turn is dynamically linked to current libruby.so. It will pull libruby.so.2.1.0, resulting in SIGILL.
This task depends upon

Closed by  Anatol Pomozov (anatolik)
Monday, 24 March 2014, 19:07 GMT
Reason for closing:  Fixed
Additional comments about closing:  ruby-2.1.1-2
Comment by Rob Cornish (12qu) - Monday, 17 March 2014, 10:59 GMT
I can confirm this for ruby 2.1.1-1. Any execution of ruby or irb immediately gives me the following output:

$ ruby
[1] 2564 illegal hardware instruction (core dumped) ruby

Running from gdb also gives me this:

$ gdb -q /usr/bin/ruby
Reading symbols from /usr/bin/ruby...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/ruby
warning: Could not load shared library symbols for linux-gate.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0xb7dce5d5 in ?? () from /usr/lib/libruby.so.2.1


Not sure how helpful this is but it all seems to agree with antekone's post.
Comment by Anatol Pomozov (anatolik) - Monday, 17 March 2014, 16:09 GMT Comment by Anatol Pomozov (anatolik) - Tuesday, 18 March 2014, 14:44 GMT
Revering that upstream change ("RUBY_TRY_CFLAGS(-msse2 -mfpmath=sse ....") fixes the problem. I do not see sse2 instructions in i686 code, but it is present in 64-bit code as expected.

I still want to hear what upstream thinks about this change https://bugs.ruby-lang.org/issues/8358#note-21
Comment by Anatol Pomozov (anatolik) - Thursday, 20 March 2014, 14:13 GMT
Upstream is still silent. I bite the bullet and release a new ruby with proposed patch. It removes SSE2 instructions from 32bit package, but 64bit package still uses SSE2, as expected.

Please check ruby-2.1.1-2 from [testing].
Comment by Grzegorz Antoniak (antekone) - Thursday, 20 March 2014, 15:09 GMT
ruby-2.1.1-2 from [testing] seems to work OK.

However I'm wondering about upstream, because their fix to a failed testcase by adding SSE2 seems a bit odd. Only by looking at excerpts of the configure script they've posted (in /issues/8358) it can be seen that they're adding SSE2 even for i486 architecture, which probably doesn't make much sense (or I'm missing something obvious). This also implies that you will need to reapply this patch in every release of Ruby.

I hope they will answer soon.

Thank you Anatol!
Comment by Anatol Pomozov (anatolik) - Monday, 24 March 2014, 19:06 GMT
Yeah, forcing SSE2 for 486 CPU does not make any sense. We already specify CPU features by flag "-march=". I'll work with upstream on this bug.

Ok, this bug is resolved in stable now.

Loading...