[PATCH] Raise the minimum GCC version to 11.5 [BZ #32539]

Sam James sam@gentoo.org
Sun Jan 12 09:00:03 GMT 2025


"H.J. Lu" <hjl.tools@gmail.com> writes:

> For all Linux distros with glibc 2.40 which I can find, GCC 14.2 is used
> to compile glibc 2.40:
>
> OS                    GCC      URL
> AOSC                  14.2.0   https://aosc.io/
> Arch Linux            14.2.0   https://archlinux.org/
> ArchPOWER             14.2.0   https://archlinuxpower.org/
> Artix                 14.2.0   https://artixlinux.org/
> Debian                14.2.0   https://www.debian.org/
> Devuan                14.2.0   https://www.devuan.org/
> Exherbo               14.2.0   https://www.exherbolinux.org/
> Fedora                14.2.1   https://fedoraproject.org/
> Gentoo                14.2.1   https://gentoo.org/
> Kali Linux            14.2.0   https://www.kali.org/
> KaOS                  14.2.0   https://kaosx.us/
> LiGurOS               14.2.0   https://liguros.gitlab.io/
> Mageia                14.2.0   https://www.mageia.org/en/
> Manjaro               14.2.0   https://manjaro.org/
> NixOS                 14.2.0   https://nixos.org/
> openmamba             14.2.0   https://openmamba.org/
> OpenMandriva          14.2.0   https://openmandriva.org/
> openSUSE              14.2.0   https://www.opensuse.org/
> Parabola              14.2.0   https://www.parabola.nu/
> PLD Linux             14.2.0   https://pld-linux.org/
> PureOS                14.2.0   https://pureos.net/
> Raspbian              14.2.0   http://raspbian.org/
> Slackware             14.2.0   http://www.slackware.com/
> Solus                 14.2.0   https://getsol.us/
> T2 SDE                14.2.0   http://t2sde.org/
> Ubuntu                14.2.0   https://www.ubuntu.com/
> Wikidata              14.2.0   https://wikidata.org/
>
> Support older versions of GCC to build glibc 2.41:
>
> 1. Need to work around bugs in older versions of GCC.
> 2. Can't use the new features in newer versions of GCC, which may be
> required for new features in glibc.
>
> The main benefit of supporting older versions of GCC is easier backport
> of bug fixes to the older releases of glibc, which can be mitigated by
> avoiding incompatible features in newer versions of GCC for critical bug
> fixes.
>
> Require GCC 11.5 or newer to build. Remove GCC version check for PowerPC
> and s390x.  TEST_CC and TEST_CXX can be used to test the glibc build
> with the older versions of GCC.
>
> For glibc developers who are using Linux OSes which don't come with GCC
> 11.5 or newer, they should build and install GCC 11.5 or newer to work
> on glibc.
>
> This fixes BZ #32539.
>
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> ---
>  INSTALL                                      | 25 +-----
>  configure                                    |  3 +-
>  configure.ac                                 |  3 +-
>  manual/install.texi                          | 24 +-----
>  sysdeps/s390/configure                       | 40 ----------
>  sysdeps/s390/configure.ac                    | 18 -----
>  sysdeps/unix/sysv/linux/powerpc/configure    | 83 --------------------
>  sysdeps/unix/sysv/linux/powerpc/configure.ac | 34 --------
>  8 files changed, 11 insertions(+), 219 deletions(-)
>
> diff --git a/INSTALL b/INSTALL
> index 7e8dcbb089..d0ae89e625 100644
> --- a/INSTALL
> +++ b/INSTALL
> @@ -488,31 +488,14 @@ build the GNU C Library:
>       As of release time, GNU 'make' 4.4.1 is the newest verified to work
>       to build the GNU C Library.
>  
> -   * GCC 6.2 or newer
> +   * GCC 11.5 or newer
>  
> -     GCC 6.2 or higher is required.  In general it is recommended to use
> -     the newest version of the compiler that is known to work for
> +     GCC 11.5 or higher is required.  In general it is recommended to
> +     use the newest version of the compiler that is known to work for
>       building the GNU C Library, as newer compilers usually produce
> -     better code.  As of release time, GCC 14.1 is the newest compiler
> +     better code.  As of release time, GCC 14.2 is the newest compiler
>       verified to work to build the GNU C Library.
>  
> -     For PowerPC 64-bits little-endian (powerpc64le), a GCC version with
> -     support for '-mno-gnu-attribute', '-mabi=ieeelongdouble', and
> -     '-mabi=ibmlongdouble' is required.  Likewise, the compiler must
> -     also support passing '-mlong-double-128' with the preceding
> -     options.  As of release, this implies GCC 7.4 and newer (excepting
> -     GCC 7.5.0, see GCC PR94200).  These additional features are
> -     required for building the GNU C Library with support for IEEE long
> -     double.
> -
> -     For ARC architecture builds, GCC 8.3 or higher is needed.
> -
> -     For s390x architecture builds, GCC 7.1 or higher is needed (See gcc
> -     Bug 98269).
> -
> -     For AArch64 architecture builds with mathvec enabled, GCC 10 or
> -     higher is needed due to dependency on arm_sve.h.
> -
>       For multi-arch support it is recommended to use a GCC which has
>       been built with support for GNU indirect functions.  This ensures
>       that correct debugging information is generated for functions
> diff --git a/configure b/configure
> index eb8abd0054..32c18b2eda 100755
> --- a/configure
> +++ b/configure
> @@ -5763,6 +5763,7 @@ if test $ac_verc_fail = yes; then
>  fi
>  
>  
> +# Require GCC 11.5 to build.
>  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC is sufficient to build libc" >&5
>  printf %s "checking if $CC is sufficient to build libc... " >&6; }
>  if test ${libc_cv_compiler_ok+y}
> @@ -5777,7 +5778,7 @@ int
>  main (void)
>  {
>  
> -#if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
> +#if !defined __GNUC__ || __GNUC__ < 11 || (__GNUC__ == 11 && __GNUC_MINOR__ < 5)
>  #error insufficient compiler
>  #endif
>    ;
> diff --git a/configure.ac b/configure.ac
> index 050bfa65e3..02da3638c8 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -573,9 +573,10 @@ AC_CHECK_PROG_VER(BISON, bison, --version,
>    [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
>    [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
>  
> +# Require GCC 11.5 to build.
>  AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
>  AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
> -#if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
> +#if !defined __GNUC__ || __GNUC__ < 11 || (__GNUC__ == 11 && __GNUC_MINOR__ < 5)
>  #error insufficient compiler
>  #endif]])],

Some distros like Debian often linger on e.g. X.2 and then backport
fixes. I don't know if this is a problem for 11 in reality. 

But such distributions probably won't be using trunk glibc anyway,
though people might try to develop on it.

This isn't an objection but I want to hear from someone who knows about
such distros. CC'd doko.

Personally, I don't want us to waste time investigating issues in 11.x
before .5 (and it's why I would've preferred 12+/an alive branch, but
forget about that for now). If people must use 11, they should use 11.5,
or bypass the check by setting the cache var.

>  	       [libc_cv_compiler_ok=yes],
> diff --git a/manual/install.texi b/manual/install.texi
> index b5292a976a..7d3436a1ff 100644
> --- a/manual/install.texi
> +++ b/manual/install.texi
> @@ -530,32 +530,14 @@ As of release time, GNU @code{make} 4.4.1 is the newest verified to work
>  to build @theglibc{}.
>  
>  @item
> -GCC 6.2 or newer
> +GCC 11.5 or newer
>  
> -GCC 6.2 or higher is required.  In general it is recommended to use
> +GCC 11.5 or higher is required.  In general it is recommended to use
>  the newest version of the compiler that is known to work for building
>  @theglibc{}, as newer compilers usually produce better code.  As of
> -release time, GCC 14.1 is the newest compiler verified to work to build
> +release time, GCC 14.2 is the newest compiler verified to work to build
>  @theglibc{}.
>  
> -For PowerPC 64-bits little-endian (powerpc64le), a GCC version with support
> -for @option{-mno-gnu-attribute}, @option{-mabi=ieeelongdouble}, and
> -@option{-mabi=ibmlongdouble} is required.  Likewise, the compiler must also
> -support passing @option{-mlong-double-128} with the preceding options.  As
> -of release, this implies GCC 7.4 and newer (excepting GCC 7.5.0, see GCC
> -PR94200).  These additional features are required for building the GNU C
> -Library with support for IEEE long double.
> -
> -@c powerpc64le performs an autoconf test to verify the compiler compiles with
> -@c commands like "$CC -c foo.c -mabi=ibmlongdouble -mlong-double-128".
> -
> -For ARC architecture builds, GCC 8.3 or higher is needed.
> -
> -For s390x architecture builds, GCC 7.1 or higher is needed (See gcc Bug 98269).
> -
> -For AArch64 architecture builds with mathvec enabled, GCC 10 or higher is needed
> -due to dependency on arm_sve.h.
> -
>  For multi-arch support it is recommended to use a GCC which has been built with
>  support for GNU indirect functions.  This ensures that correct debugging
>  information is generated for functions selected by IFUNC resolvers.  This
> diff --git a/sysdeps/s390/configure b/sysdeps/s390/configure
> index 67c3755c16..97f52524fb 100644
> --- a/sysdeps/s390/configure
> +++ b/sysdeps/s390/configure
> @@ -309,46 +309,6 @@ then
>  
>  fi
>  
> -
> -
> -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC is sufficient to build libc on s390x" >&5
> -printf %s "checking if $CC is sufficient to build libc on s390x... " >&6; }
> -if test ${libc_cv_compiler_ok_on_s390x+y}
> -then :
> -  printf %s "(cached) " >&6
> -else case e in #(
> -  e)
> -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> -/* end confdefs.h.  */
> -
> -int
> -main (void)
> -{
> -
> -#if !defined __GNUC__ || __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 1)
> -#error insufficient compiler for building on s390x
> -#endif
> -
> -  ;
> -  return 0;
> -}
> -_ACEOF
> -if ac_fn_c_try_cpp "$LINENO"
> -then :
> -  libc_cv_compiler_ok_on_s390x=yes
> -else case e in #(
> -  e) libc_cv_compiler_ok_on_s390x=no ;;
> -esac
> -fi
> -rm -f conftest.err conftest.i conftest.$ac_ext ;;
> -esac
> -fi
> -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_compiler_ok_on_s390x" >&5
> -printf "%s\n" "$libc_cv_compiler_ok_on_s390x" >&6; }
> -if test "$libc_cv_compiler_ok_on_s390x" != yes; then
> -   critic_missing="$critic_missing On s390x, GCC >= 7.1.0 is required."
> -fi
> -
>  test -n "$critic_missing" && as_fn_error $? "
>  *** $critic_missing" "$LINENO" 5
>  
> diff --git a/sysdeps/s390/configure.ac b/sysdeps/s390/configure.ac
> index 89c3e5b211..496866b850 100644
> --- a/sysdeps/s390/configure.ac
> +++ b/sysdeps/s390/configure.ac
> @@ -161,23 +161,5 @@ then
>    AC_DEFINE(HAVE_S390_MIN_ARCH13_ZARCH_ASM_SUPPORT)
>  fi
>  
> -
> -dnl test if GCC is new enough. See gcc "Bug 98269 - gcc 6.5.0
> -dnl __builtin_add_overflow() with small uint32_t values incorrectly detects
> -dnl overflow
> -dnl (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269)
> -AC_CACHE_CHECK([if $CC is sufficient to build libc on s390x],
> -libc_cv_compiler_ok_on_s390x, [
> -AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
> -#if !defined __GNUC__ || __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 1)
> -#error insufficient compiler for building on s390x
> -#endif
> -]])],
> -	[libc_cv_compiler_ok_on_s390x=yes],
> -	[libc_cv_compiler_ok_on_s390x=no])])
> -if test "$libc_cv_compiler_ok_on_s390x" != yes; then
> -   critic_missing="$critic_missing On s390x, GCC >= 7.1.0 is required."
> -fi
> -
>  test -n "$critic_missing" && AC_MSG_ERROR([
>  *** $critic_missing])
> diff --git a/sysdeps/unix/sysv/linux/powerpc/configure b/sysdeps/unix/sysv/linux/powerpc/configure
> index 61ae675c1a..6fa7589530 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/configure
> +++ b/sysdeps/unix/sysv/linux/powerpc/configure
> @@ -1,89 +1,6 @@
>  # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
>   # Local configure fragment for sysdeps/unix/sysv/linux/powerpc/.
>  
> -
> -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format" >&5
> -printf %s "checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format... " >&6; }
> -if test ${libc_cv_mlong_double_128ibm+y}
> -then :
> -  printf %s "(cached) " >&6
> -else case e in #(
> -  e) save_CFLAGS="$CFLAGS"
> -CFLAGS="$CFLAGS -mlong-double-128"
> -cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> -/* end confdefs.h.  */
> -#include <float.h>
> -int
> -main (void)
> -{
> -
> -#if LDBL_MANT_DIG != 106
> -# error "compiler doesn't implement IBM extended format of long double"
> -#endif
> -long double foobar (long double x) { return x; }
> -  ;
> -  return 0;
> -}
> -_ACEOF
> -if ac_fn_c_try_compile "$LINENO"
> -then :
> -  libc_cv_mlong_double_128ibm=yes
> -else case e in #(
> -  e) libc_cv_mlong_double_128ibm=no ;;
> -esac
> -fi
> -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
> -CFLAGS="$save_CFLAGS" ;;
> -esac
> -fi
> -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mlong_double_128ibm" >&5
> -printf "%s\n" "$libc_cv_mlong_double_128ibm" >&6; }
> -
> -if test "$libc_cv_mlong_double_128ibm" = no; then
> -  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC $CFLAGS supports -mabi=ibmlongdouble" >&5
> -printf %s "checking whether $CC $CFLAGS supports -mabi=ibmlongdouble... " >&6; }
> -if test ${libc_cv_mabi_ibmlongdouble+y}
> -then :
> -  printf %s "(cached) " >&6
> -else case e in #(
> -  e)   save_CFLAGS="$CFLAGS"
> -  CFLAGS="$CFLAGS -mlong-double-128 -mabi=ibmlongdouble"
> -  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> -/* end confdefs.h.  */
> -#include <float.h>
> -int
> -main (void)
> -{
> -
> -#if LDBL_MANT_DIG != 106
> -# error "compiler doesn't implement IBM extended format of long double"
> -#endif
> -long double foobar (long double x) { return x; }
> -  ;
> -  return 0;
> -}
> -_ACEOF
> -if ac_fn_c_try_compile "$LINENO"
> -then :
> -  libc_cv_mabi_ibmlongdouble=yes
> -else case e in #(
> -  e) libc_cv_mabi_ibmlongdouble=no ;;
> -esac
> -fi
> -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
> -  CFLAGS="$save_CFLAGS" ;;
> -esac
> -fi
> -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mabi_ibmlongdouble" >&5
> -printf "%s\n" "$libc_cv_mabi_ibmlongdouble" >&6; }
> -
> -  if test "$libc_cv_mabi_ibmlongdouble" = yes; then
> -    CFLAGS="$CFLAGS -mabi=ibmlongdouble"
> -  else
> -    as_fn_error $? "this configuration requires -mlong-double-128 IBM extended format support" "$LINENO" 5
> -  fi
> -fi
> -
>  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-tls-get-addr-optimize" >&5
>  printf %s "checking for linker that supports --no-tls-get-addr-optimize... " >&6; }
>  libc_linker_feature=no
> diff --git a/sysdeps/unix/sysv/linux/powerpc/configure.ac b/sysdeps/unix/sysv/linux/powerpc/configure.ac
> index 8d2ec60f68..bcf0c62442 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/configure.ac
> +++ b/sysdeps/unix/sysv/linux/powerpc/configure.ac
> @@ -2,40 +2,6 @@ sinclude(./aclocal.m4)dnl Autoconf lossage

We should cleanup:
* libc_cv_compiler_powerpc64le_ice (powerpc)
* soft_float_abi_support (csky)
* libc_cv_gcc_builtin_tbegin (s390, obsolete with compilers containing r6-2660-gc914ac45c7670c)

BUT if you want to defer those cleanups to after the release, to avoid
risk on targets that are harder to test, I (or you) can do that. Andreas?

> [...]

The patch looks good but we should decide on either:
1) merging with bare-minimum cleanups (maybe just top-level
configure.ac), more cleanups post-release
2) merging this as-is for now, more cleanups post-release
3) merging this with no cleanups inside, all cleanups post-release


More information about the Libc-alpha mailing list