Omar Polo <o...@openbsd.org> writes:

> George Koehler <kern...@gmail.com> writes:
>
>>> [..]
>>
>> I have a problem: if devel/capstone/main is installed, then sbcl fails
>> to build on powerpc.  This happens with sbcl-2.1.11 or sbcl-2.2.1.
>>
>> sbcl doesn't depend on capstone, and doesn't need capstone to build
>> contrib/sb-capstone, but does try to test sb-capstone during the
>> build.  If libcapstone.so is missing, then sbcl skips the test.  If
>> libcapstone.so is found, then the test crashes, so the build fails.
>> An installed capstone broke sbcl-2.1.11 in the ongoing powerpc bulk;
>> I told the bulk to retry sbcl; it succeeded after removing capstone.
>>
>> [...]
>>
>> Doing 3 pending tests of 3 tests total.
>> CORRUPTION WARNING in SBCL pid 41036:
>> Memory fault at 0x0 (pc=0xb96bb61c)
>> The integrity of this image is possibly compromised.
>> Exiting.
>>    0: [I*]0x9361bda0 pc=0xb96bb61c {0x50c37288+68a84394} {code_serialno=9970}
>>    1: [*] 0x9361bd80 pc=0x50c374b8 {0x50c37288+0230} SB-CAPSTONE::CS-OPEN
>
> could this be an issue in capstone itself on powerpc?
> SB-CAPSTONE::CS-OPEN is "just"
>
> (define-alien-routine cs-open int (arch int) (mode (integer 64)) (handle 
> unsigned :out))
>
> but I don't know how sbcl calls into c.  To be fair the `integer 64`
> looks wrong, cs_open takes an enum as second argument which should be
> just an `int' and the fault at 0x0 could be that 32 bits of mode are
> read as the next argument which should be a pointer; I'm probably
> talking crap tho.  I'll do a build on i386 out of curiosity thought :)

for once, I think I was right! :D

I've sort of unbroken the build on i386 (using ecl instead of clisp
makes it, even thought it's slooooowww) and can reproduce the error.
Changing the cs-open declaration to specify `mode' as int makes the test
fail (excerpt attached), but not crash, which is a huge improvement :D

I'm doing yet another build this time without capstone so I can obtain a
working executable to debug the test but it'll take a while, my hardware
is old and slow, and ecl slows it down even more, I just wanted to give
a quick follow up.

Hopefully I can understand why it fails so we can properly add capstone
as build dependency and re-enable the build on i386 :)

Cheers



Test SB-CAPSTONE-TESTS::X86-64 failed
Form: (SB-CAPSTONE-TESTS::CAPSTONE-CHECK '(143 69 8 72 139 240)
                                         '(:X86-64 :LITTLE-ENDIAN)
                                         '("MOV RSI, RAX"
                                           "POP QWORD PTR [RBP + 8]"))
Expected value: T
Actual value: NIL.
Test SB-CAPSTONE-TESTS::PPC-LITTLE-ENDIAN failed
Form: (SB-CAPSTONE-TESTS::CAPSTONE-CHECK '(3 16 64 60 0 113 66 56)
                                         '(:PPC64 :LITTLE-ENDIAN)
                                         '("LIS R2, 0X1003"
                                           "ADDI R2, R2, 0X7100"))
Expected value: T
Actual value: NIL.
Test SB-CAPSTONE-TESTS::PPC-BIG-ENDIAN failed
Form: (SB-CAPSTONE-TESTS::CAPSTONE-CHECK '(124 8 2 166) '(:PPC64 :BIG-ENDIAN)
                                         '("MFLR R0"))
Expected value: T
Actual value: #<TYPE-ERROR expected-type: (SIGNED-BYTE 32) datum: 2147483656>.
The value
  2147483656
is not of type
  (SIGNED-BYTE 32)
when binding SB-ALIEN::VALUE

Reply via email to