]> sourceware.org Git - glibc.git/commitdiff
* malloc/malloc.c (MALLOC_ALIGNMENT): Revert to (2 * SIZE_SZ) value. cvs/fedora-glibc-20060306T0720
authorRoland McGrath <roland@gnu.org>
Mon, 6 Mar 2006 06:18:43 +0000 (06:18 +0000)
committerRoland McGrath <roland@gnu.org>
Mon, 6 Mar 2006 06:18:43 +0000 (06:18 +0000)
The correct value differs only on powerpc32, and for now changing it
there is causing more trouble than it's worth.

* malloc/arena.c: Add compile-time sanity check on padding calculation.

2006-03-05  Jakub Jelinek  <jakub@redhat.com>

* malloc/arena.c (heap_info): Adjust the padding size if
MALLOC_ALIGNMENT > 2 * SIZE_SZ.

ChangeLog
malloc/arena.c
malloc/malloc.c
sysdeps/posix/sysconf.c

index 0130676a67e9fdc21c1b81daefbeb021b02131ef..18d6f49f1feaa60d70834561eaa4eb9aa509161b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-03-05  Roland McGrath  <roland@redhat.com>
+
+       * malloc/malloc.c (MALLOC_ALIGNMENT): Revert to (2 * SIZE_SZ) value.
+       The correct value differs only on powerpc32, and for now changing it
+       there is causing more trouble than it's worth.
+
+       * malloc/arena.c: Add compile-time sanity check on padding calculation.
+
+2006-03-05  Jakub Jelinek  <jakub@redhat.com>
+
+       * malloc/arena.c (heap_info): Adjust the padding size if
+       MALLOC_ALIGNMENT > 2 * SIZE_SZ.
+
 2006-03-05  Roland McGrath  <roland@frob.com>
 
        * sysdeps/posix/sysconf.c (__sysconf): Use #if _POSIX_FOO > 0
index d0d223e94e42a8972c6acbe17c2c2f28a7499dcf..4d95462f26fae87f15c0db1515b49c05d452ed14 100644 (file)
@@ -1,5 +1,5 @@
 /* Malloc implementation for multiple threads without lock contention.
-   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
 
@@ -55,9 +55,18 @@ typedef struct _heap_info {
   mstate ar_ptr; /* Arena for this heap. */
   struct _heap_info *prev; /* Previous heap. */
   size_t size;   /* Current size in bytes. */
-  size_t pad;    /* Make sure the following data is properly aligned. */
+  /* Make sure the following data is properly aligned, particularly
+     that sizeof (heap_info) + 2 * SIZE_SZ is a multiple of
+     MALLOG_ALIGNMENT. */
+  char pad[-5 * SIZE_SZ & MALLOC_ALIGN_MASK];
 } heap_info;
 
+/* Get a compile-time error if the heap_info padding is not correct
+   to make alignment work as expected in sYSMALLOc.  */
+extern int sanity_check_heap_info_alignment[(sizeof (heap_info)
+                                            + 2 * SIZE_SZ) % MALLOC_ALIGNMENT
+                                           ? -1 : 1];
+
 /* Thread specific data */
 
 static tsd_key_t arena_key;
index 99b55c8639401a01b6dfcf565b3b74ab47e6e85e..5fbd268fed3b752159ef48ec7af5677be8e51177 100644 (file)
@@ -1,5 +1,5 @@
 /* Malloc implementation for multiple threads without lock contention.
-   Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1996-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Wolfram Gloger <wg@malloc.de>
    and Doug Lea <dl@cs.oswego.edu>, 2001.
@@ -381,8 +381,15 @@ extern "C" {
 
 
 #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.  */
 #define MALLOC_ALIGNMENT       (2 * SIZE_SZ < __alignof__ (long double) \
                                ? __alignof__ (long double) : 2 * SIZE_SZ)
+*/
+#define MALLOC_ALIGNMENT       (2 * SIZE_SZ)
 #endif
 
 /* The corresponding bit mask value */
index 5a355925daa4a66435a2faf406a352491b86f6d2..0c0d7d141880867678060e28cd5740e8157c8f26 100644 (file)
@@ -816,25 +816,25 @@ __sysconf (name)
 #endif
 
     case _SC_V6_ILP32_OFF32:
-#if _POSIX_V6_ILP32_OFF32 > 0
+#ifdef _POSIX_V6_ILP32_OFF32
       return _POSIX_V6_ILP32_OFF32;
 #else
       return __sysconf_check_spec ("ILP32_OFF32");
 #endif
     case _SC_V6_ILP32_OFFBIG:
-#if _POSIX_V6_ILP32_OFFBIG > 0
+#ifdef _POSIX_V6_ILP32_OFFBIG
       return _POSIX_V6_ILP32_OFFBIG;
 #else
       return __sysconf_check_spec ("ILP32_OFFBIG");
 #endif
     case _SC_V6_LP64_OFF64:
-#if _POSIX_V6_LP64_OFF64 > 0
+#ifdef _POSIX_V6_LP64_OFF64
       return _POSIX_V6_LP64_OFF64;
 #else
       return __sysconf_check_spec ("LP64_OFF64");
 #endif
     case _SC_V6_LPBIG_OFFBIG:
-#if _POSIX_V6_LPBIG_OFFBIG > 0
+#ifdef _POSIX_V6_LPBIG_OFFBIG
       return _POSIX_V6_LPBIG_OFFBIG;
 #else
       return __sysconf_check_spec ("LPBIG_OFFBIG");
This page took 0.07577 seconds and 5 git commands to generate.