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: Define MALLOC_ALIGNMENT as 16 for x32


On 05/18/2012 10:55 PM, H.J. Lu wrote:
On Tue, May 15, 2012 at 10:04 AM, Roland McGrath<roland@hack.frob.com> wrote:
I don't think that's the right way to do it.
How about this instead?

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 79cdc52..0000000 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -337,16 +337,20 @@ __malloc_assert (const char *assertion,


#ifndef MALLOC_ALIGNMENT -/* XXX This is the correct definition. It differs from 2*SIZE_SZ only on - powerpc32. For the time being, changing this is causing more - compatibility problems due to malloc_get_state/malloc_set_state than - will returning blocks not adequately aligned for long double objects - under -mlong-double-128. +# if !SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_16) +/* This is the correct definition when there is no past ABI to constrain it.

-#define MALLOC_ALIGNMENT       (2 * SIZE_SZ<  __alignof__ (long double) \
-                               ? __alignof__ (long double) : 2 * SIZE_SZ)
-*/
-#define MALLOC_ALIGNMENT       (2 * SIZE_SZ)
+   Among configurations with a past ABI constraint, it differs from
+   2*SIZE_SZ only on powerpc32.  For the time being, changing this is
+   causing more compatibility problems due to malloc_get_state and
+   malloc_set_state than will returning blocks not adequately aligned for
+   long double objects under -mlong-double-128.  */
+
+#  define MALLOC_ALIGNMENT       (2 * SIZE_SZ<  __alignof__ (long double) \
+                                 ? __alignof__ (long double) : 2 * SIZE_SZ)
+# else
+#  define MALLOC_ALIGNMENT       (2 * SIZE_SZ)
+# endif
  #endif

/* The corresponding bit mask value */

Hi Roland,


I verified that it works for x32. Can you check it in?

this fails for me on Linux/x86-64, it needs an include <shlib-compat.h>.


I'll commit the following as obvious now,

Andreas
2012-05-21  Andreas Jaeger  <aj@suse.de>

* malloc/malloc.c: Include shlib-compat.h for SHLIB_COMPAT.

diff --git a/malloc/malloc.c b/malloc/malloc.c
index c216d26..7115287 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -228,6 +228,8 @@
 #include <stdio.h>    /* needed for malloc_stats */
 #include <errno.h>

+#include <shlib-compat.h>
+
 /* For uintptr_t.  */
 #include <stdint.h>


-- Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126


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