This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [[PATCH RFC 2] 02/63] Y2038: add function __difftime64
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Albert ARIBAUD <albert dot aribaud at 3adev dot fr>
- Cc: Paul Eggert <eggert at cs dot ucla dot edu>, <libc-alpha at sourceware dot org>
- Date: Wed, 2 May 2018 15:45:23 +0000
- Subject: Re: [[PATCH RFC 2] 02/63] Y2038: add function __difftime64
- References: <20180418201819.15952-1-albert.aribaud@3adev.fr> <20180418201819.15952-2-albert.aribaud@3adev.fr> <20180418201819.15952-3-albert.aribaud@3adev.fr> <0a04fc43-9e92-1bbc-843d-049d1026d971@cs.ucla.edu> <20180419150411.4d7ee629@athena> <34e2461c-5da4-181d-d34b-b63c7f89dbf6@cs.ucla.edu> <20180502092209.540847ad@athena>
On Wed, 2 May 2018, Albert ARIBAUD wrote:
> 1) Keep the original file untouched as the 32-bit-time compilation unit.
> Compiling this file as it is now ensures that the ABI is untouched.
>
> 2) Compile the same original file with -D_TIME_BITS=64 (just like
> application code would be compiled under 64-bit-time), producing a
> second compilation unit which provides new symbols.
3. Make the main implementation the 64-bit one. Make difftime into a thin
wrapper round __difftime64. (In the case where time_t is already 64-bit,
the function would just be built directly as difftime without any wrapper
being involved.)
That's what I think it appropriate in all the cases where the function
implementations are nontrivial. It avoids duplication of complicated code
in the sources, and reduces the code size increase from duplication in the
binaries.
That's particularly important for e.g. the pthread functions where a
previous patch series was duplicating hundreds of lines of code in some
cases.
It would mean times sometimes go through two levels of validation /
conversion, from 32-bit to 64-bit and then back to 32-bit if the kernel
doesn't support the 64-bit interfaces, but I think the cost of that is
negligible.
--
Joseph S. Myers
joseph@codesourcery.com