patchmldonkey, a multi-networks file-sharing client - Patches: patch #7319, EDK: Fix CryptoPP on mips64 abi n32

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #7319: EDK: Fix CryptoPP on mips64 abi n32

Submitter:  Lluís Batlle <viric>
Submitted:  Sun 19 Sep 2010 10:10:54 AM UTC
   
 
Category:  Bug fixes Priority:  7 - High
Status:  Done Assigned to:  None
Open/Closed:  Closed

Jump to the original submission

Sat 23 Oct 2010 06:23:38 PM UTC, comment #8: 

committed 2010/10/23

spiralvoice <spiralvoice>
Group administrator
Mon 20 Sep 2010 03:41:21 PM UTC, comment #7: 

I do not have access to Mips hardware nor is Ocaml, afaik, cross-compilable so I am talking about native compilation here.

spiralvoice <spiralvoice>
Group administrator
Sun 19 Sep 2010 09:37:28 PM UTC, comment #6: 

I imagine you talk about a gcc 3.4.4 cross compiler to mips; otherwise you would test little of the patch content.

Lluís Batlle <viric>
Sun 19 Sep 2010 09:22:46 PM UTC, comment #5: 

The oldest platform I am using is Debian Sarge@x86 which uses gcc-3.4.4 where I have yet to test your patch. I leave the question up for discussion but I doubt we should support gcc-2.x.

spiralvoice <spiralvoice>
Group administrator
Sun 19 Sep 2010 09:09:09 PM UTC, comment #4: 

The code produced after the patch may not build in gcc versions older than 3.0 (I'm not sure of this), due to the usage of __uint128_t. Do you think this can be a problem?

Lluís Batlle <viric>
Sun 19 Sep 2010 10:10:54 AM UTC, comment #3: 

This item has been reassigned from the project mldonkey, a multi-networks file-sharing client bugs tracker to your tracker.

The original report is still available at bugs #31063

Following are the information included in the original report:

[field #0]                  Item ID: 31063
[field #1]                 Group ID: 1409
[field #2]              Open/Closed: Open
[field #3]                 Severity: 3 - Normal
[field #4]                  Privacy: Public
[field #8]                         : Unknown bugs Field Display Type
[field #9]                 Category: Core
[field #10]             Submitted by: viric
[field #11]              Assigned to: None
[field #12]             Submitted on: Sa 18 Sep 2010 18:23:49 CEST
[field #13]                  Summary: EDK: Fix CryptoPP on mips64 abi n32
[field #14]      Original Submission: Hello,

I had problems building mldonkey for mips64, and I came up with a patch I attach for review. The problem was in the CryptoPP.cc file, related to multiplication of double words.
Since gcc 4.4, the asm constraint 'h' is not there, and I was using gcc 4.5.1.

Once I could build mldonkey, I tried to run it, and some division code in CryptoPP.cc failed an assertion:

mlnet: src/utils/lib/CryptoPP.cc:3745: void CryptoPP::Divide(CryptoPP::word*, CryptoPP::word*, CryptoPP::word*, const CryptoPP::word*, unsigned int, const CryptoPP::word*, unsigned int): Assertion `shiftBits < WORD_BITS' failed.


The gdb session:
(gdb) f 3
#3  0x100983cc in CryptoPP::Divide (R=0x1022ba30, Q=0x1022bac0, T=0x1022bae8, A=0x1022ba78,
    NA=6, B=0x1022b910, NB=4) at src/utils/lib/CryptoPP.cc:3745
3745            assert(shiftBits < WORD_BITS);
(gdb) print shiftBits
$1 = 64
(gdb) print WORD_BITS
$2 = 64


Any idea of what can be wrong in that code? I can debug further if you need.
[field #16]               Item Group: Compilation problem
[field #17]                   Status: None
[field #18]        Component Version: None
[field #19]         Operating System: Linux
[field #20]          Reproducibility: None
[field #21]               Size (loc): None
[field #22]            Fixed Release: None
[field #23]          Planned Release: None
[field #24]                   Effort: 0.00
[field #28]                 Priority: 5 - Normal
[field #31]         Percent Complete: 0%
[field #33]                  Release: 3.0.4
[field #58]          Binaries Origin: CVS / Self compiled
[field #59]                 CPU type: None
[field #60]                      CPU: None
[field #61]     Custom Select Box #4: None
[field #62]     Custom Select Box #5: None
[field #63]     Custom Select Box #6: None
[field #64]     Custom Select Box #7: None
[field #65]     Custom Select Box #8: None
[field #66]     Custom Select Box #9: None
[field #67]    Custom Select Box #10: None

spiralvoice <spiralvoice>
Group administrator
Sat 18 Sep 2010 11:54:41 PM UTC, comment #2: 

I compared the files, and I narrowed down the trouble to lack of templated BitPrecision() function.

The mldonkey code had them for 'unsigned long' data type (32-bits in mips64), while words were 64bits long. Using a templated BitPrecision function made the assertion check go fine.

With this patch I attach (gcc44mips64.patch), mldonkey starts fine. I included also some refinements over the first patch I posted, thanks to a review by Zhang Le in the loongson-dev mailing list.

(The first incomplete patch had the sufix _2; this may look confusing. The complete patch sits in gcc44mips64.patch, not gcc44mips64_2.patch).

Just to note, this works with gcc 4.5.1 for abi n32. I haven't tried other configurations.

(file #21490)

Lluís Batlle <viric>
Sat 18 Sep 2010 08:06:03 PM UTC, comment #1: 

Try comparing integer.cpp from cryptopp561.zip (http://www.cryptopp.com/#download) with src/utils/lib/CryptoPP.cc.

spiralvoice <spiralvoice>
Group administrator
Sun 19 Sep 2010 10:10:54 AM UTC, original submission:  

Hello,

I had problems building mldonkey for mips64, and I came up with a patch I attach for review. The problem was in the CryptoPP.cc file, related to multiplication of double words.
Since gcc 4.4, the asm constraint 'h' is not there, and I was using gcc 4.5.1.

Once I could build mldonkey, I tried to run it, and some division code in CryptoPP.cc failed an assertion:

mlnet: src/utils/lib/CryptoPP.cc:3745: void CryptoPP::Divide(CryptoPP::word*, CryptoPP::word*, CryptoPP::word*, const CryptoPP::word*, unsigned int, const CryptoPP::word*, unsigned int): Assertion `shiftBits < WORD_BITS' failed.


The gdb session:
(gdb) f 3
#3  0x100983cc in CryptoPP::Divide (R=0x1022ba30, Q=0x1022bac0, T=0x1022bae8, A=0x1022ba78,
    NA=6, B=0x1022b910, NB=4) at src/utils/lib/CryptoPP.cc:3745
3745            assert(shiftBits < WORD_BITS);
(gdb) print shiftBits
$1 = 64
(gdb) print WORD_BITS
$2 = 64


Any idea of what can be wrong in that code? I can debug further if you need.

Lluís Batlle <viric>

 

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

Attached Files
file #21490:  gcc44mips64.patch added by viric (3KiB - application/octet-stream - Patch fixing both the build problem and the assertion check failure.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by spiralvoice (Posted a comment)
  • -email is unavailable- added by viric (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-10-23 spiralvoice StatusReady For Test Done
        Open/ClosedOpen Closed
    2010-09-19 spiralvoice CategoryNone Bug fixes
        Priority5 - Normal 7 - High
        StatusNone Ready For Test
    2010-09-19 spiralvoice Reassign itemmldonkey, a multi-networks file-sharing client, bug #31063 mldonkey, a multi-networks file-sharing client, patch #7319

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code