diff options
| author | Roland McGrath <[email protected]> | 2006-10-10 00:25:21 +0000 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2006-10-10 00:25:21 +0000 |
| commit | c373d850ec9ca342f4c71d5e287c8d8bf0723cd6 (patch) | |
| tree | c8f9ea814866cdfb30ac9506ccddbc8629ebe345 /libdw/libdw_alloc.c | |
| parent | 1dee360aa30fecd20f403f98fd1cb9e543afcca7 (diff) | |
2006-10-09 Roland McGrath <[email protected]>
* ia64_symbol.c (ia64_reloc_simple_type): Treat SECREL types as simple.
Diffstat (limited to 'libdw/libdw_alloc.c')
| -rw-r--r-- | libdw/libdw_alloc.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c index 1518ef62..917cb309 100644 --- a/libdw/libdw_alloc.c +++ b/libdw/libdw_alloc.c @@ -1,5 +1,5 @@ /* Memory handling for libdw. - Copyright (C) 2003, 2004 Red Hat, Inc. + Copyright (C) 2003, 2004, 2006 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <[email protected]>, 2003. @@ -60,20 +60,24 @@ void * -__libdw_allocate (Dwarf *dbg, size_t minsize) +__libdw_allocate (Dwarf *dbg, size_t minsize, size_t align) { size_t size = MAX (dbg->mem_default_size, - 2 * minsize + offsetof (struct libdw_memblock, mem)); + (align - 1 + + 2 * minsize + offsetof (struct libdw_memblock, mem))); struct libdw_memblock *newp = malloc (size); if (newp == NULL) dbg->oom_handler (); - newp->size = newp->remaining = size - offsetof (struct libdw_memblock, mem); + uintptr_t result = ((uintptr_t) newp->mem + align - 1) & ~(align - 1); + + newp->size = size - offsetof (struct libdw_memblock, mem); + newp->remaining = (uintptr_t) newp + size - (result + minsize); newp->prev = dbg->mem_tail; dbg->mem_tail = newp; - return newp->mem; + return (void *) result; } |
