gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Alignment issue?


From: Laurent Michel
Subject: Alignment issue?
Date: Fri, 5 Jul 2013 09:09:34 -0400

Good morning!

I have ported an application to GNUstep (from MacOS) and everything works very well on a ubuntu 12.04 LTS (32-bit). 

However, the same port fails under 12.04 LTS (64-bit) for a simple reason:

On GNUstep the NSAllocateObject function (and therefore all the alloc methods) do _not_ return 
16 bytes aligned objects. On Linux, the objects are always 8 bytes aligned. I checked, and my code on Cocoa (MacOS 10.8.4) [the same call to NSAllocateObject] returns 16 bytes aligned objects.

Either this is a bug, or I'm missing a macro/define somewhere to tell GNUstep I'd like to have 16 bytes aligned objects. 

Naturally, I can redefine a new method for the meta-class whose instances require a 16 byte alignment, but this is ad-hoc and would be required for every object susceptible of storing a structure expecting 16 bytes alignments. 

Note that the structure whose field require a 16 byte alignment and which is hosted in instances of that specific class is correctly tagged with a clang attribute to require that the structure start address be correctly aligned. Of course, that _assumes_ that the object itself is 16 bytes aligned which is not the case here. 

Is there a suitable incantation to get a 16-byte alignment on Linux64 ?  Do you agree that this is a bug ? 

Thanks for your help,

All the best,


--
  Laurent


reply via email to

[Prev in Thread] Current Thread [Next in Thread]