[Box Backup] x86 and ARM differences results in exception in bbackupquery

Stuart D Gathman stuart at bmsi.com
Sun Nov 14 22:42:11 GMT 2010


On 11/14/2010 07:18 AM, Ben Summers wrote:
> On 13 Nov 2010, at 19:35, Stuart D Gathman wrote:
>> a) The style I usually use in C is to declare another struct with only
>> char fields, and use a little api with stint(),stshort(),stchar(), etc
>> to store various C types.  E.g.
>>
>> typedef char FSHORT[2];
>> typedef char FLONG[4];
> ...
>
> Yes, Box Backup does indeed code things this way, eg
>
>   http://boxbackup.org/trac/browser/box/trunk/lib/backupclient/BackupStoreFileWire.h
>
> and is careful to output all such structs in network byte order.
Using structure packing is much less portable than using the char arrays
I mentioned.
There's also autogenerated 'protocol' code which does this.
> The problem appears to be that the gcc ARM compiler is ignoring the structure alignment directives, probably because they're quite expensive on that platform.
>
> A quick google found this:
>
> http://forums.arm.com/index.php?/topic/12616-struct-packing-gcc/
Sounds like you need to use char arrays (like the FLONG above, e.g.
F_INT32) - or always use the 'protocol' code.




More information about the Boxbackup mailing list