This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] elf: dl-minimal malloc needs to respect fundamental alignment


On 06/23/2016 06:15 PM, H.J. Lu wrote:

Malloc alignment has been an isssie.  GCC defines
MALLOC_ABI_ALIGNMENT as

#ifndef MALLOC_ABI_ALIGNMENT
#define MALLOC_ABI_ALIGNMENT BITS_PER_WORD
#endif

which is incorrect for Linux and unusable:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36159

I'd like to see a reasonable solution to address malloc alignment
on Linux, not just in ld.so.

But this glibc bug is fixed:

  https://sourceware.org/bugzilla/show_bug.cgi?id=6527

As far as I know, we know match or exceed the C11 max_align_t requirements. What we cannot do is to bump max_align_t alignment because it affects ABI. Overall, this entire concept of fundamental alignment is somewhat ill-defined.

Over-aligned allocations with default operator new in C++ are a different matter and require C++ ABI changes, so that the C++ runtime can call the appropriate aligned allocation function.

There are popular interposed mallocs which do not provide sufficient alignment, matching max_align_t, as well.

Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]