Problem with malloc on PA

Roland McGrath roland@frob.com
Wed Apr 25 15:30:00 GMT 2001


> The PA-RISC architecture requires a lock to be 16-byte aligned.  So we
> add __attribute__((aligned (16))) to our lock type and that aligns it
> to a 16-byte offset within the struct.  But if the struct isn't 16-byte
> aligned, this loses.

That sure confer the 16-byte alignment requirement onto the containing struct.
Then you can replace malloc(sizeof(struct foo)) with
memalign(__alignof(struct foo), sizefo(struct foo)).



More information about the Libc-alpha mailing list