public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Y2038 and C++ ABIs
@ 2017-11-07 18:31 Ben Hutchings
  2017-11-19 16:00 ` Albert ARIBAUD
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2017-11-07 18:31 UTC (permalink / raw)
  To: Albert Aribaud; +Cc: glibc development

Albert, I reviewed the draft at
<https://sourceware.org/glibc/wiki/Y2038ProofnessDesign> and I see a
potential problem with the proposed type changes.

Suppose a C++ library has some function parameters whose types are
based on struct timespec or struct timeval.  Those structure names will
be mangled into the function symbol names.

If the library is rebuilt on a 32-bit architecture with the updated
glibc, and it opts in to 64-bit time support, the symbol names change -
and that's good because the function's ABI really is changing.

However, if it's rebuilt and continues to use 32-bit time, it looks
like the symbol names might still change because struct timespec would
be an alias for struct timespec32.  That would be very undesirable. 
However, I'm not sure how you intended the type aliasing to be done. 
Would struct timespec be a structure with identical layout to
timespec32/64 (which avoids this problem), or aliased through a #define
or some other means?

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Y2038 and C++ ABIs
  2017-11-07 18:31 Y2038 and C++ ABIs Ben Hutchings
@ 2017-11-19 16:00 ` Albert ARIBAUD
  0 siblings, 0 replies; 2+ messages in thread
From: Albert ARIBAUD @ 2017-11-19 16:00 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: glibc development

Hi Ben,

On Tue, 07 Nov 2017 18:31:32 +0000, Ben Hutchings
<ben.hutchings@codethink.co.uk> wrote :

> Albert, I reviewed the draft at
> <https://sourceware.org/glibc/wiki/Y2038ProofnessDesign> and I see a
> potential problem with the proposed type changes.
> 
> Suppose a C++ library has some function parameters whose types are
> based on struct timespec or struct timeval.  Those structure names will
> be mangled into the function symbol names.
> 
> If the library is rebuilt on a 32-bit architecture with the updated
> glibc, and it opts in to 64-bit time support, the symbol names change -
> and that's good because the function's ABI really is changing.
> 
> However, if it's rebuilt and continues to use 32-bit time, it looks
> like the symbol names might still change because struct timespec would
> be an alias for struct timespec32.  That would be very undesirable. 
> However, I'm not sure how you intended the type aliasing to be done. 
> Would struct timespec be a structure with identical layout to
> timespec32/64 (which avoids this problem), or aliased through a #define
> or some other means?

Thanks Ben for raising this, and sorry for the delay in answering.

The objective is of course to be 100% compatible with existing
source code, i.e. source code which did not specify _TIME_BITS=64
should compile exactly the same with or without the Y2038-proof GLIBC
patches.

IOW, and barring a mistake of mine, the API side of GLIBC should not be
affected at all when 64-bit-time support is added but not selected, and
any source name mangling should also be unaffected.

On the implementation side, there are explicit 32-bit- and 64-bit-time
variants of the various time-related structures since we may need both,
and the 32-bit variants are (intended to be) identical to the public
but should not affect the public API mangling.

Or am I missing the point?
 
> Ben.

Cordialement,
Albert ARIBAUD
3ADEV

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-19 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-07 18:31 Y2038 and C++ ABIs Ben Hutchings
2017-11-19 16:00 ` Albert ARIBAUD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).