64-bit obstack support
Richard Henderson
rth@twiddle.net
Wed Jul 16 15:04:00 GMT 2014
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~
More information about the Libc-alpha
mailing list