"H.J. Lu" <hjl.to...@gmail.com> writes:

>> For that matter, don't we have a problem on x86 GNU/Linux, where
>> malloc returns an 8-byte alignment but attribute((aligned)) is a 16
>> byte alignment?
>
> I don't think it is the same as MALLOC_ABI_ALIGNMENT.
> attribute((aligned)) is something determined by compiler,
> which used to be a constant.

The compiler knows about malloc and new.  It should presumably assume
that memory allocated by those operations should have some alignment.
One might naïvely expect that the alignment of malloc would in fact by
MALLOC_ABI_ALIGNMENT.  Perhaps MALLOC_ABI_ALIGNMENT is simply
misnamed, or perhaps attribute((aligned)) should align to some other
value.


>>>> any new __attribute ((aligned (XXX))) options?
>>>>
>>>
>>> I don't think we need new __attribute ((aligned (XXX))) options.
>>
>> Are we sure we don't need __attribute__ ((aligned(max)))?
>>
>
> I don't see how it can be used safely without breaking ABI.

There are many ways to align data without exposing it in the
ABI--e.g., the alignment of a global array is not part of the ABI, in
that nothing breaks if the alignment is increased.  Also, there are
many programs which simply don't care about an external ABI.

Ian

Reply via email to