buglibffcall - foreign function call libraries - Bugs: bug #52510, mips (32-bit): please upgrade to...

 
 

bug #52510: mips (32-bit): please upgrade to O32 FPXX ABI

Submitted by:  Sébastien Villemot <svillemot>
Submitted on:  Sun 26 Nov 2017 05:18:51 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Confirmed
Privacy: PublicAssigned to: Bruno Haible <haible>
Open/Closed: Open

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 26 Nov 2017 06:59:58 PM UTC, comment #4:

Wow! Kudos.

> an alternative fix is to do something with "space", like writing to it with "*space=0;"


I'll experiment with a source code change, like this. Thanks.

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Sun 26 Nov 2017 06:53:24 PM UTC, comment #3:

Basically here is how I figured it out: using gdb, it became clear that the crash was coming from a stack corruption. Then I look at the generated assembly for avcall-mips.c, and I realized that the instruction decreasing the stack pointer by 1032 bytes had disappeared.

Sébastien Villemot <svillemot>
Sun 26 Nov 2017 06:47:21 PM UTC, comment #2:

Indeed I was getting a crash in avcall before adding -fno-tree-dce (an alternative fix is to do something with "space", like writing to it with "*space=0;").

Sébastien Villemot <svillemot>
Sun 26 Nov 2017 06:36:05 PM UTC, comment #1:

Hi Sébastien,

This is great work! I had already attempted to overcome the "float register should be even" error that I got when using the cross toolchain on Ubuntu, but that required me to upgrade to a gcc-5.x, and that in turn caused avcall to crash.

Are you saying that libffcall passes "make check" with your patch, and thus '-fno-tree-dce' is the fix to the avcall crash?

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Sun 26 Nov 2017 05:18:51 PM UTC, original submission:

Hi,

Since GCC 5, the ABI for the Debian 32-bit mips ports has changed: it is now using the FPXX extension of the O32 ABI (see [1], [2] and [3] for some background).

As a consequence, the assembly files shipped for the O32 ABI (on both little- and big-endian) fail to compile, because they try to access odd-numbered floating point registers.

Here on a Debian unstable/sid system:

So basically what is needed (at least for Debian 32-bit mips ports) is to regenerate all the assembly files (using a version of gcc that defaults to the FPXX extension).

Also note that, for avcall, I had to add the -fno-tree-dce optimization flag, otherwise the call to __builtin_alloca() in avcall-mips.c is optimized out (because the variable "space" is not explicitly used).

For information, I attach the patch that I am going to apply to the Debian package. The resulting code compiles on both little- and big-endian 32-bit mips, and passes all the tests.

Best,

Sébastien

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825342
[2] https://gcc.gnu.org/gcc-5/changes.html
[3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=789612

Sébastien Villemot <svillemot>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #42489:  mips-fpxx.patch added by svillemot (76KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by haible (Posted a comment)
  • -unavailable- added by svillemot (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 26 Nov 2017 06:36:05 PM UTChaibleStatusNone=>Confirmed
      Assigned toNone=>haible
    Sun 26 Nov 2017 05:18:51 PM UTCsvillemotAttached File-=>Added mips-fpxx.patch, #42489

    Back to the top


    Powered by Savane 3.1-cleanup1