From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1585) id 14E833858D1E; Wed, 10 Aug 2022 10:19:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14E833858D1E Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Luis Machado To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org Subject: [binutils-gdb] Disable year 2038 support on 32-bit hosts by default X-Act-Checkin: binutils-gdb X-Git-Author: Luis Machado X-Git-Refname: refs/heads/master X-Git-Oldrev: d7abcbcea5ddd40a3bf28758b62f35933c59f996 X-Git-Newrev: e5f2f7d901ee735224b3a657c193f88c7ad79a07 Message-Id: <20220810101909.14E833858D1E@sourceware.org> Date: Wed, 10 Aug 2022 10:19:09 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2022 10:19:09 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3De5f2f7d901ee= 735224b3a657c193f88c7ad79a07 commit e5f2f7d901ee735224b3a657c193f88c7ad79a07 Author: Luis Machado Date: Tue Jul 26 00:17:38 2022 +0100 Disable year 2038 support on 32-bit hosts by default =20 With a recent import of gnulib, code has been pulled that tests and ena= bles 64-bit time_t by default on 32-bit hosts that support it. =20 Although gdb can use the gnulib support, bfd doesn't use gnulib and cur= rently doesn't do these checks. =20 As a consequence, if we have a 32-bit host that supports 64-bit time_t,= we'll have a mismatch between gdb's notion of time_t and bfd's notion of time= _t. =20 This will lead to mismatches in the struct stat size, leading to memory corruption and crashes. =20 This patch disables the year 2038 check for now, which makes things work reliably again. =20 I'd consider this a temporary fix until we have proper bfd checks for t= he year 2038, if it makes sense. 64-bit hosts seems to be more common these da= ys, so I'm not sure how important it is to have this support enabled and how s= oon we want to enable it. =20 Thoughts? Diff: --- configure | 22 ++++++++++++++++++++++ configure.ac | 18 ++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/configure b/configure index be433ef6d5d..16139e3bfa3 100755 --- a/configure +++ b/configure @@ -790,6 +790,7 @@ enable_gold enable_ld enable_gprofng enable_compressed_debug_sections +enable_year2038 enable_libquadmath enable_libquadmath_support enable_libada @@ -1520,6 +1521,7 @@ Optional Features: --enable-compressed-debug-sections=3D{all,gas,gold,ld,none} Enable compressed debug sections for gas, gold o= r ld by default + --enable-year2038 enable support for timestamps past the year 2038 --disable-libquadmath do not build libquadmath directory --disable-libquadmath-support disable libquadmath support for Fortran @@ -3127,6 +3129,20 @@ case "${host}" in ;; esac =20 +# Default to --disable-year2038 until we can handle differences between +# projects that use gnulib (which understands year 2038) and projects that +# do not (like BFD). +# Check whether --enable-year2038 was given. +if test "${enable_year2038+set}" =3D set; then : + enableval=3D$enable_year2038; ENABLE_YEAR2038=3D$enableval +else + ENABLE_YEAR2038=3Dno +fi + +enable_year2038=3D +if test "${ENABLE_YEAR2038}" =3D "no" ; then + enable_year2038=3Dno +fi =20 # Check whether --enable-libquadmath was given. if test "${enable_libquadmath+set}" =3D set; then : @@ -7836,9 +7852,15 @@ if test "$silent" =3D yes; then baseargs=3D"$baseargs --silent" tbaseargs=3D"$tbaseargs --silent" fi + baseargs=3D"$baseargs --disable-option-checking" tbaseargs=3D"$tbaseargs --disable-option-checking" =20 +if test "$enable_year2038" =3D no; then + baseargs=3D"$baseargs --disable-year2038" + tbaseargs=3D"$tbaseargs --disable-year2038" +fi + # Record and document user additions to sub configure arguments. =20 =20 diff --git a/configure.ac b/configure.ac index 1651cbf3b02..a5555a9c91b 100644 --- a/configure.ac +++ b/configure.ac @@ -440,6 +440,18 @@ case "${host}" in ;; esac =20 +# Default to --disable-year2038 until we can handle differences between +# projects that use gnulib (which understands year 2038) and projects that +# do not (like BFD). +AC_ARG_ENABLE(year2038, +AS_HELP_STRING([--enable-year2038], + [enable support for timestamps past the year 2038]), +ENABLE_YEAR2038=3D$enableval, +ENABLE_YEAR2038=3Dno) +enable_year2038=3D +if test "${ENABLE_YEAR2038}" =3D "no" ; then + enable_year2038=3Dno +fi =20 AC_ARG_ENABLE(libquadmath, AS_HELP_STRING([--disable-libquadmath], @@ -3139,9 +3151,15 @@ if test "$silent" =3D yes; then baseargs=3D"$baseargs --silent" tbaseargs=3D"$tbaseargs --silent" fi + baseargs=3D"$baseargs --disable-option-checking" tbaseargs=3D"$tbaseargs --disable-option-checking" =20 +if test "$enable_year2038" =3D no; then + baseargs=3D"$baseargs --disable-year2038" + tbaseargs=3D"$tbaseargs --disable-year2038" +fi + # Record and document user additions to sub configure arguments. AC_ARG_VAR([build_configargs], [additional configure arguments for build directories])