diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-03-06 07:30:01 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2006-03-06 07:30:01 +0000 |
commit | b3643a38588a0d7217ef933735b9cf142ccdbf2d (patch) | |
tree | dfd2d46a4adfdb376f8a8632289e117055f0e039 /malloc | |
parent | 51d2f6dd7f5c5a2838e864f7d5795f3110536b6d (diff) | |
download | glibc-b3643a38588a0d7217ef933735b9cf142ccdbf2d.tar glibc-b3643a38588a0d7217ef933735b9cf142ccdbf2d.tar.gz glibc-b3643a38588a0d7217ef933735b9cf142ccdbf2d.tar.bz2 glibc-b3643a38588a0d7217ef933735b9cf142ccdbf2d.zip |
Updated to fedora-glibc-20060306T0720
Diffstat (limited to 'malloc')
-rw-r--r-- | malloc/arena.c | 13 | ||||
-rw-r--r-- | malloc/malloc.c | 10 |
2 files changed, 20 insertions, 3 deletions
diff --git a/malloc/arena.c b/malloc/arena.c index d0d223e94e..4d95462f26 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -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; diff --git a/malloc/malloc.c b/malloc/malloc.c index 99b55c8639..da230d3493 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -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,16 @@ 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 */ |