This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Problem with malloc on PA
- To: willy at ldl dot fc dot hp dot com (Matthew Wilcox)
- Subject: Re: Problem with malloc on PA
- From: Roland McGrath <roland at frob dot com>
- Date: Wed, 25 Apr 2001 18:29:28 -0400 (EDT)
- Cc: libc-alpha at sources dot redhat dot com
> 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)).