1# To simulate Y2038 occurring in qemu, add to your build configuration:
2# QB_OPT_APPEND:append = " -rtc base=2040-02-02"
3#
4# Note that this does result in ptest failures on qemux86:
5# perl python3 dbus openssl glibc-tests openssh curl glib-2.0 tcl libmodule-build-perl
6# and a subset of those occurs in qemux86-64 as well:
7# curl python3 openssl openssl tcl python3-cryptography
8#
9# Working to address those (before Y2038 rolls in) will be appreciated.
10
11GLIBC_64BIT_TIME_FLAGS = " -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64"
12
13# Only needed for some 32-bit architectures, some relatively newer
14# architectures do not need it ( e.g. riscv32 )
15TARGET_CC_ARCH:append:arm = "${GLIBC_64BIT_TIME_FLAGS}"
16TARGET_CC_ARCH:append:armeb = "${GLIBC_64BIT_TIME_FLAGS}"
17TARGET_CC_ARCH:append:mipsarcho32 = "${GLIBC_64BIT_TIME_FLAGS}"
18TARGET_CC_ARCH:append:powerpc = "${@bb.utils.contains('TUNE_FEATURES', 'm32', '${GLIBC_64BIT_TIME_FLAGS}', '', d)}"
19TARGET_CC_ARCH:append:x86 = "${@bb.utils.contains('TUNE_FEATURES', 'm32', '${GLIBC_64BIT_TIME_FLAGS}', '', d)}"
20
21GLIBC_64BIT_TIME_FLAGS:pn-glibc = ""
22GLIBC_64BIT_TIME_FLAGS:pn-glibc-y2038-tests = ""
23GLIBC_64BIT_TIME_FLAGS:pn-glibc-testsuite = ""
24# pipewire-v4l2 explicitly sets _FILE_OFFSET_BITS=32 to get access to
25# both 32 and 64 bit file APIs.  But it does not handle the time side?
26# Needs further investigation
27GLIBC_64BIT_TIME_FLAGS:pn-pipewire = ""
28# Pulseaudio override certain LFS64 functions e.g. open64 and intentionally
29# undefines _FILE_OFFSET_BITS, which wont work when _TIME_BITS=64 is set
30# See https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/3770
31GLIBC_64BIT_TIME_FLAGS:pn-pulseaudio = ""
32# Undefines _FILE_OFFSET_BITS on purpose in
33# libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
34GLIBC_64BIT_TIME_FLAGS:pn-gcc-sanitizers = ""
35
36# Caused by the flags exceptions above
37INSANE_SKIP:append:pn-gcc-sanitizers = " 32bit-time"
38INSANE_SKIP:append:pn-glibc = " 32bit-time"
39INSANE_SKIP:append:pn-glibc-y2038-tests = " 32bit-time"
40INSANE_SKIP:append:pn-pulseaudio = " 32bit-time"
41
42# Strace has tests that call 32 bit API directly, which is fair enough, e.g.
43# /usr/lib/strace/ptest/tests/ioctl_termios uses 32-bit api 'ioctl'
44INSANE_SKIP:append:pn-strace = " 32bit-time"
45
46# Additionally cargo_common class (i.e. everything written in rust)
47# has the same INSANE_SKIP setting.
48# Please check the comment in meta/classes-recipe/cargo_common.bbclass
49# for information about why, and the overall Y2038 situation in rust.
50