On Fri, May 17, 2013 at 11:17:26AM +0200, Richard Biener wrote:
> Yes - note that it's called MALLOC_*ABI*_ALIGNMENT for a reason - it
> is supposed to be the alignment that is required for conforming to the C ABI
> on the target.  For different allocators I'd rather have a new function
> attribute that tells us the alignment of the allocators allocation function
> (of course replacing the allocator at runtime via ELF interposition makes
> that possibly fragile as well).  We shouldn't assume just because glibc

Most of the allocators I've mentioned, if not all, are providing just
malloc/calloc etc. entrypoints and are being in search scope before -lc,
so it isn't anything you can control with attributes.

I've looked at libasan so far (seems to guarantee either 16, or 64 or 128
bytes depending on flags), valgrind (seems to guarantee 8 bytes on 32-bit
arches except ppc32, and 16 bytes elsewhere), ElectricFence (no guarantees
at all, the default is 4 bytes, but can be overridden with EF_ALIGNMENT
env option to smaller/larger value, I guess let's ignore efence).

        Jakub

Reply via email to