| Summary: | Use 64-bit time_t on 32-bit glibc targets | ||
|---|---|---|---|
| Product: | gcc | Reporter: | Janne Blomqvist <jb> |
| Component: | libfortran | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | NEW --- | ||
| Severity: | enhancement | CC: | rguenth, sjames |
| Priority: | P3 | ||
| Version: | 16.0 | ||
| Target Milestone: | --- | ||
| See Also: |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114895 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120832 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114065 |
||
| Host: | Target: | ||
| Build: | Known to work: | ||
| Known to fail: | Last reconfirmed: | 2025-06-26 00:00:00 | |
|
Description
Janne Blomqvist
2022-01-01 19:24:53 UTC
Is there anything to be done as the time_t is now defaults to 64bit on the trunk of glibc? (In reply to Andrew Pinski from comment #1) > Is there anything to be done as the time_t is now defaults to 64bit on the > trunk of glibc? AFAIU it's not the default, you need to explicitly opt-in by setting the _TIME_BITS preprocessor macro to 64 (64-bit time_t is the default on musl, and {Net,Open}BSD ). Or are you saying that since the _TIME_BITS thing was introduced (with glibc 2.34), the upcoming 2.35/trunk has changed the default? (In reply to Janne Blomqvist from comment #2) > (In reply to Andrew Pinski from comment #1) > > Is there anything to be done as the time_t is now defaults to 64bit on the > > trunk of glibc? > > AFAIU it's not the default, you need to explicitly opt-in by setting the > _TIME_BITS preprocessor macro to 64 (64-bit time_t is the default on musl, > and {Net,Open}BSD ). > > Or are you saying that since the _TIME_BITS thing was introduced (with glibc > 2.34), the upcoming 2.35/trunk has changed the default? Yes, the upcoming 2.35 has changed the default: https://sourceware.org/pipermail/libc-alpha/2021-December/134576.html Sorry I was not clear about that. (In reply to Andrew Pinski from comment #3) > (In reply to Janne Blomqvist from comment #2) > > (In reply to Andrew Pinski from comment #1) > > > Is there anything to be done as the time_t is now defaults to 64bit on the > > > trunk of glibc? > > > > AFAIU it's not the default, you need to explicitly opt-in by setting the > > _TIME_BITS preprocessor macro to 64 (64-bit time_t is the default on musl, > > and {Net,Open}BSD ). > > > > Or are you saying that since the _TIME_BITS thing was introduced (with glibc > > 2.34), the upcoming 2.35/trunk has changed the default? > > Yes, the upcoming 2.35 has changed the default: > https://sourceware.org/pipermail/libc-alpha/2021-December/134576.html I'm not super-familiar with glibc, but it seems that this changes the default (in ./bits/timesize.h) to 64 for targets not overriding it, however it adds/modifies a number of target-specific overrides to retain the previous behavior? In particular for x86 there is ./sysdeps/unix/sysv/linux/x86/bits/timesize.h which says: #if defined __x86_64__ && defined __ILP32__ /* For x32, time is 64-bit even though word size is 32-bit. */ # define __TIMESIZE 64 #else /* For others, time size is word size. */ # define __TIMESIZE __WORDSIZE #endif If my reading of the above is correct, on 32-bit x86 __TIMESIZE is set to __WORDSIZE, that is, 32. Similarly for ./sysdeps/unix/sysv/linux/arm/bits/timesize.h it says #define __TIMESIZE 32 On Sat, 1 Jan 2022, jb at gcc dot gnu.org via Gcc-bugs wrote:
> I'm not super-familiar with glibc, but it seems that this changes the default
> (in ./bits/timesize.h) to 64 for targets not overriding it, however it
> adds/modifies a number of target-specific overrides to retain the previous
> behavior?
Exactly. "Default" here means "default for architectures that don't
provide their own bits/timesize.h header"; there is no change to the
default for any existing architecture. It was already required that new
glibc ports must use 64-bit time_t; the effect of this change is that new
glibc ports to 32-bit architectures no longer need to have a
bits/timesize.h header of their own (in general, we want the defaults to
be such that new ports need as few sysdeps files as possible).
Confirmed. autoconf 2.71 has AC_SYS_LARGEFILE support for 64bit time_t where we'd need to add AC_SYS_YEAR2038 to flip a default (otherwise it's conditional on a --configure option). This means we'll have to update from 2.69 to at least 2.71. |