[PATCH 3/4] Consolidate pread/pread64 implementations
Joseph Myers
joseph@codesourcery.com
Fri Jan 8 18:02:00 GMT 2016
On Fri, 8 Jan 2016, Adhemerval Zanella wrote:
> Ok I got a better solution to avoid code build duplication. The only
> issue is for mips64 n32, sizeof(off_t) is different than sizeof(off64_t)
> which leaded to continue provide a mips pread implementation (although
> as for sh is uses de default one).
To be clear: that separate n32 implementation should only be needed
because pread and pread64 have incompatible types (without some #define
hacks to hide one of the header declarations). The pread64 implementation
(defined to take a 64-bit function argument) should be usable for pread as
well, because both 32-bit and 64-bit arguments are passed in a single
register, and 32-bit integer arguments are always sign-extended to 64-bit
(even if of an unsigned type) when passed in registers. (It would have to
be that way round; a pread implementation would not be safe to use for
pread64 in case the compiler generated code that assumed the register had
a 32-bit off_t value.)
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list