This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: sparc 32-bit dirent broken
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: David Miller <davem at davemloft dot net>
- Cc: <fweimer at redhat dot com>, <libc-alpha at sourceware dot org>
- Date: Thu, 10 Oct 2013 23:49:13 +0000
- Subject: Re: sparc 32-bit dirent broken
- Authentication-results: sourceware.org; auth=none
- References: <52570475 dot 2050107 at redhat dot com> <20131010 dot 164308 dot 103134182855731464 dot davem at davemloft dot net> <20131010 dot 170628 dot 144428253182134045 dot davem at davemloft dot net> <20131010 dot 171716 dot 69341787771640099 dot davem at davemloft dot net>
On Thu, 10 Oct 2013, David Miller wrote:
> Any suggestions for a better alignof or is this good enough to fix
> the problem? We probably should have a per-sysdep definition of
> "largest C type alignment" so we can use it in situations like this.
In principle, C11's max_align_t in <stddef.h> is what you want. But:
(a) The first GCC version with it is 4.7 and we support older versions to
build glibc.
(b) The C11 specifications regarding alignment have several deficiencies.
See <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1731.pdf> for a
discussion.
(c) The alignment of max_align_t, although a reasonable empirical
approximation to the alignment required by C99 / C11, may in fact not be
supported by malloc (powerpc32 - bug 6527).
(d) If new types such as decimal floating point (defined as extensions to
ISO C in a way that means their alignment should be supported in all
contexts) get supported, this may change the alignment of max_align_t (so
it's not a great idea to use it in ABIs in a way that would affect) and
may also increase the requirements on malloc alignment (see my comment in
bug 6527 about how really the alignment should be increased for 32-bit x86
as well).
--
Joseph S. Myers
joseph@codesourcery.com