This is the mail archive of the
mailing list for the glibc project.
Re: PowerPC malloc alignment
- From: Daniel Jacobowitz <drow at false dot org>
- To: Roland McGrath <roland at redhat dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, libc-alpha at sourceware dot org, Steven Munroe <sjmunroe at us dot ibm dot com>
- Date: Fri, 2 Nov 2007 15:40:11 -0400
- Subject: Re: PowerPC malloc alignment
- References: <20071031205240.GA30110@caradoc.them.org> <20071031212316.GU2896@sunsite.mff.cuni.cz> <20071031213648.769884D04AE@magilla.localdomain>
On Wed, Oct 31, 2007 at 02:36:48PM -0700, Roland McGrath wrote:
> > The main problem is emacs (aka the only user of
> > malloc_set_state/malloc_get_state). Changing the alignment is really an ABI
> > change for these interfaces, unless it does some very ugly hacks in it.
> That can at least be made easy to detect gracefully via magic/version.
> Is it pathologically difficult to cope with an old dumped state?
Tricky, at least. The alignment has to be a constant or we're going
to penalize performance all across the board. And it is used
indirectly to size some arrays, e.g. via NFASTBINS.
I tried just ignoring malloc_set_state, to see if emacs does something
graceful. It does not check for failure and immediately frees the
saved state, so it crashes. If I forcibly skip both the call to
malloc_set_state and the following free, things seem to work OK but
malloc checking reveals it will happily realloc() pointers from the
saved heap. So that won't help either.
I see two ways to increase the alignment.
- Build a second set of malloc routines with the old alignment. At
malloc_set_state time, install them as hooks if necessary.
- Tell people to rebuild emacs. Improve the crash by adding a
debugging message out of malloc_set_state when it detects the
You can guess which one of these I like better. I doubt that anything
besides Emacs uses malloc_set_state. Some older librep may have, but
nowadays it has only the vestigial configure check. The only other
references I could find were programs using malloc_get_state to peek
at statistics, and they won't be affected anyway.
Let me know if you think we need the hooks approach.