diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2023-06-05 16:15:29 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2023-06-06 12:38:14 +0200 |
commit | b3fedb54814bcef49c1de57360261bdf56f13472 (patch) | |
tree | c93bd2123d9552aca421f2b52a3544efa75a113b | |
parent | 3b187c5795b4212b770224f8bc83e2c211e66cdb (diff) | |
download | ptxdist-b3fedb54814bcef49c1de57360261bdf56f13472.tar.gz ptxdist-b3fedb54814bcef49c1de57360261bdf56f13472.tar.xz |
glibc: add option for Y2038 support
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r-- | rules/glibc.in | 8 | ||||
-rw-r--r-- | rules/glibc.make | 12 | ||||
-rw-r--r-- | scripts/lib/ptxd_make_00-init.sh | 13 | ||||
-rw-r--r-- | scripts/wrapper/libwrapper.sh | 3 |
4 files changed, 36 insertions, 0 deletions
diff --git a/rules/glibc.in b/rules/glibc.in index 36cad2c1f..e95b95cac 100644 --- a/rules/glibc.in +++ b/rules/glibc.in @@ -8,6 +8,14 @@ if GLIBC menu "glibc " +config GLIBC_Y2038 + bool + select GLOBAL_LARGE_FILE + prompt "enable Y2038 support" + help + Build the BSP with _TIME_BITS=64 to support dates beyound + 2038-01-19 03:14:07. + comment "Install options" config GLIBC_2_34 diff --git a/rules/glibc.make b/rules/glibc.make index 35a0b0705..028d64e6f 100644 --- a/rules/glibc.make +++ b/rules/glibc.make @@ -23,6 +23,18 @@ GLIBC_VERSION := $(call ptx/config-version, PTXCONF_GLIBC) -include $(PTXDIST_PLATFORMDIR)/selected_toolchain/../share/compliance/glibc.make # ---------------------------------------------------------------------------- +# Prepare +# ---------------------------------------------------------------------------- + +$(STATEDIR)/glibc.prepare: + @$(call targetinfo) + @echo Checking Y2038 support... + @echo 'static_assert(sizeof(time_t) == 8, "y2038");' | \ + $(CROSS_CC) -c -x c -include sys/types.h -include assert.h - &>/dev/null || \ + ptxd_bailout "PTXCONF_GLIBC_Y2038 is enabled but the toolchain has no Y2028 support!" + @$(call touch) + +# ---------------------------------------------------------------------------- # Target-Install # ---------------------------------------------------------------------------- diff --git a/scripts/lib/ptxd_make_00-init.sh b/scripts/lib/ptxd_make_00-init.sh index 8627334c8..16e978ea3 100644 --- a/scripts/lib/ptxd_make_00-init.sh +++ b/scripts/lib/ptxd_make_00-init.sh @@ -118,6 +118,16 @@ ptxd_init_sysroot_toolchain() { export PTXDIST_SYSROOT_TOOLCHAIN } +# +# init Y2038 support +# +# out: +# PTXDIST_Y2038 +# +ptxd_init_y2028() { + PTXDIST_Y2038="$(ptxd_get_ptxconf PTXCONF_GLIBC_Y2038)" + export PTXDIST_Y2038 +} # # gather all sysroots @@ -306,6 +316,7 @@ ptxd_init_save_wrapper_env() { PTXDIST_HOST_LDFLAGS="${PTXDIST_HOST_LDFLAGS}" PTXDIST_PLATFORMDIR="${PTXDIST_PLATFORMDIR}" PTXDIST_SYSROOT_TOOLCHAIN="${PTXDIST_SYSROOT_TOOLCHAIN}" + PTXDIST_Y2038="${PTXDIST_Y2038}" PTXDIST_ICECC_DIR="${PTXDIST_ICECC_DIR}" PTXDIST_ICECC_REMOTE_CPP="${PTXDIST_ICECC_REMOTE_CPP}" PTXDIST_ICECC_CLANG="${PTXDIST_ICECC_CLANG}" @@ -323,6 +334,8 @@ ptxd_make_init() { ptxd_init_sysroot_toolchain || return fi && + ptxd_init_y2028 && + ptxd_init_ptxdist_path_sysroot && ptxd_init_ptxdist_path_sysroot_host && diff --git a/scripts/wrapper/libwrapper.sh b/scripts/wrapper/libwrapper.sh index 640101796..5f4691cfe 100644 --- a/scripts/wrapper/libwrapper.sh +++ b/scripts/wrapper/libwrapper.sh @@ -315,6 +315,9 @@ cc_add_optimizations() { cpp_add_target_extra() { cc_check_args ${pkg_cppflags} add_opt_arg TARGET_COMPILER_RECORD_SWITCHES "-frecord-gcc-switches" + if [ "${PTXDIST_Y2038}" = y ]; then + add_arg -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 + fi add_late_arg ${PTXDIST_CROSS_CPPFLAGS} add_arg ${pkg_cppflags} add_opt_arg TARGET_EXTRA_CPPFLAGS ${PTXCONF_TARGET_EXTRA_CPPFLAGS} |