compiler: add 'b_time64' base option #15008
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce a new base option called
b_time64
. This is a boolean option, which defaults tofalse
(in which case it has no effect). If set to true, this will set_TIME_BITS=64
(or equivalent) for all compilations.This enables a workaround for the Y2038 problem. With
_TIME_BITS=64
, libc will switchtime_t
and other relevant time types to 64-bits, if not already 64-bit (i.e., this usually only affects 32-bit platforms). libc will also transparently switch to 64-bit syscalls.For more background information, there is an LWN article about it (from 10 years ago):
Handling of this option is similar to _FILE_OFFSET_BITS=64, which meson sets by default. Unfortunately,
time_t
is much more often used in public APIs, and thus more likely to lead to ABI mismatches when mixing code compiled with and without the option.NB: This is a draft, as I have not spent too much time figuring out whether this should be a boolean option, or a choice-option (so you can override the value with
32
), and whether this needs support for other languages. This is mostly to start a discussion around the feature.