[reprise] PIC and flat shared library support for m68k
Richard Sandiford
richard at codesourcery.com
Fri Oct 27 15:55:34 UTC 2006
Erik Andersen <andersen at codepoet.org> writes:
> On Fri Oct 27, 2006 at 03:15:05PM +0100, Richard Sandiford wrote:
>> (a) MALLOC_HEADER_SIZE == MALLOC_ALIGNMENT
>> (b) the header contains a size value of type size_t
>> (c) sizeof (size_t) is 4 on m68k, but...
>> (d) __alignof__ (double) is only 2 (the largest alignment used on m68k)
>
> Perhaps we could do something like the following:
>
> union malloc_max_size
> {
> int i;
> size_t s;
> double d;
> void *p;
> };
>
> union malloc_alignment
> {
> char c;
> union malloc_max_size u;
> };
>
> #define MALLOC_ALIGNMENT (offsetof(struct fooalign, u))
> #define MALLOC_HEADER_SIZE (sizeof(union malloc_max_size))
Do you mean "struct malloc_alignment" (in both the definition
and in MALLOC_ALIGNMENT)? I don't quite see what you're aiming
for though. Why do want MALLOC_HEADER_SIZE to be 8 (== sizeof (double))
even when MALLOC_ALIGNMENT is 4? I think MALLOC_HEADER_SIZE really
should be the maximum of MALLOC_ALIGNMENT and sizeof (size_t),
as in the patch.
Richard
More information about the uClibc
mailing list