[DRE-maint] Bug#642266: Bug#642266: please help with #642266

Jurij Smakov jurij at wooyd.org
Tue Jan 10 18:09:32 UTC 2012

On Mon, Jan 09, 2012 at 10:09:58PM -0200, Antonio Terceiro wrote:
> Hi Jurij,
> Jurij Smakov escreveu isso aí:
> > On Wed, Jan 04, 2012 at 10:54:07AM -0200, Antonio Terceiro wrote:
> > > Dear sparc porters,
> > > 
> > > I need some help from you to make ruby-ffi build correctly on sparc.
> > > The source actually compiles OK, but the test suite crashes with an
> > > "Illegal instruction" error. Is this a known problem?
> > > 
> > > I managed to create a minimal test script that reproduces the problem
> > > without running the entire test suite. It is attached to this bug
> > > report (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=642266), and
> > > all you need to do is run it from the root of the package source dir (it
> > > will compile everything that's needed before running the actual test
> > > code).
> > > 
> > > I also attached strace output from running the test script against both
> > > ruby1.8 and ruby1.9.1 (a second run, after having the C code built to
> > > remove unecessary cruft): they have similar results.
> > 
> > We used to have a bug in gcc-4.6 on sparc, which resulted in 
> > miscompilation of pack/unpack function in Ruby:
> > 
> > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=635126
> > 
> > The fact that your test case causes a failure in pack-related function 
> > makes me think that this might be the same problem. Last ruby-ffi 
> > package has been built with gcc-4.6 4.6.2-4, according to
> > 
> > https://buildd.debian.org/status/fetch.php?pkg=ruby-ffi&arch=sparc&ver=1.0.11debian-2&stamp=1325143302
> > 
> > The first gcc-4.6 version containing a fix is 4.6.2-6, so the build 
> > still happened with broken gcc. If you can, try either building 
> > the code with older compiler and -fno-tree-sra flag, or newer 
> > compiler, to see whether this fixes the problem. I'm on vacation for 
> > another week and don't have access to my sparc box, so if you will not 
> > be able to confirm this fix, I'll be glad to give it a go once I'm 
> > back.
> I've just tested on smetana.debian.org (where those strace logs
> were obtained before), and the gcc there is way newer than that:
> gcc       4:4.6.2-4
> gcc-4.6   4.6.2-11
> I also tried building with -fno-tree-sra, but got the same results. So,
> it would be very nice if you could look at this issue.

Right, it's a different issue. 'Illegal instruction' error is 
generated when the test code hits 'ta 6' instruction, which 
is generated due to the following code in libtest/NumberTest.c:

#ifdef __sparc
    #define fix_mem_access __asm("ta 6")
    #define fix_mem_access

This instruction means 'software trap 6', which normally invokes some 
action in the kernel from userspace (kind of like 'int' instruction 
on x86). According to a cursory search, this trap is Solaris-specific, 
and its effect is to turn on the unaligned trap handler. In Linux 
userspace unaligned traps are not handled (they just cause program 
termination), so the #ifdef should be adjusted to only trigger on 
Solaris/sparc. This may have unintended side effects (if the tests 
have intentional unaligned accesses, for example), but I've confirmed 
that with the attached patch applied the package builds successfully. 
Note that I have no way to test it on Solaris, but judging by examples 


it should do the trick.

Best regards,
Jurij Smakov                                           jurij at wooyd.org
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ruby-ffi.patch
Type: text/x-diff
Size: 379 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-ruby-extras-maintainers/attachments/20120110/dc52fc8a/attachment.patch>

More information about the Pkg-ruby-extras-maintainers mailing list