This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: 64-bit obstack support
- From: Richard Henderson <rth at twiddle dot net>
- To: Alan Modra <amodra at gmail dot com>, libc-alpha at sourceware dot org
- Date: Wed, 16 Jul 2014 08:04:03 -0700
- Subject: Re: 64-bit obstack support
- Authentication-results: sourceware.org; auth=none
- References: <20140716080412 dot GB8039 at bubble dot grove dot modra dot org>
On 07/16/2014 01:04 AM, Alan Modra wrote:
> - on 64-bit targets supported by glibc, a size_t parameter (at least
> for the first or second parameter) or return from a function, is
> passed in the same register as an int. I checked aarch64, alpha,
> mips64, powerpc64, s390x, sh64, sparc64, tilegx, x64_64.
It really depends on how the 64-bit target passes 32-bit values.
For alpha and mips64, 32-bit values are always sign-extended. For ppc64 and
s390x, 32-bit values are extended according to the sign of the type. These
targets are thus in the same boat as 32-bit targets, where we're safe unless
the values are large.
But some 64-bit targets allow garbage in the high bits when passing a 32-bit
parameter. I believe this applies to aarch64, sparc64, ia64 and x86_64. (It
won't be visible often for aarch64 and x86_64, because of how 32-bit operations
zero the high bits, but it can happen.)
For this later set of targets, it's not safe nor abi compatible to widen an int
parameter to size_t.
r~