Raise the minimum GCC version to 12.1 [BZ #32539]

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.42:

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, like _Float16 which requires GCC 12.1 or
above, 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 12.1 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
12.1 or newer, they should build and install GCC 12.1 or newer to work
on glibc.

This fixes BZ #32539.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
H.J. Lu 2025-02-12 12:53:09 +08:00
parent dbb2880e61
commit 27b96e069a
8 changed files with 9 additions and 217 deletions

23
INSTALL
View File

@ -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 12.1 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 12.1 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.2.1 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

3
configure vendored
View File

@ -5764,6 +5764,7 @@ if test $ac_verc_fail = yes; then
fi
# Require GCC 12.1 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}
@ -5778,7 +5779,7 @@ int
main (void)
{
#if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
#if !defined __GNUC__ || __GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 1)
#error insufficient compiler
#endif
;

View File

@ -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 12.1 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__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 1)
#error insufficient compiler
#endif]])],
[libc_cv_compiler_ok=yes],

View File

@ -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 12.1 or newer
GCC 6.2 or higher is required. In general it is recommended to use
GCC 12.1 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.2.1 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

View File

@ -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

View File

@ -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])

View File

@ -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

View File

@ -2,40 +2,6 @@ sinclude(./aclocal.m4)dnl Autoconf lossage
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
# Local configure fragment for sysdeps/unix/sysv/linux/powerpc/.
AC_CACHE_CHECK(whether $CC $CFLAGS -mlong-double-128 uses IBM extended format,
libc_cv_mlong_double_128ibm, [dnl
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mlong-double-128"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <float.h>]], [[
#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; }]])],
libc_cv_mlong_double_128ibm=yes,
libc_cv_mlong_double_128ibm=no)
CFLAGS="$save_CFLAGS"])
if test "$libc_cv_mlong_double_128ibm" = no; then
AC_CACHE_CHECK(whether $CC $CFLAGS supports -mabi=ibmlongdouble,
libc_cv_mabi_ibmlongdouble, [dnl
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mlong-double-128 -mabi=ibmlongdouble"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <float.h>]], [[
#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; }]])],
libc_cv_mabi_ibmlongdouble=yes,
libc_cv_mabi_ibmlongdouble=no)
CFLAGS="$save_CFLAGS"])
if test "$libc_cv_mabi_ibmlongdouble" = yes; then
CFLAGS="$CFLAGS -mabi=ibmlongdouble"
else
AC_MSG_ERROR([this configuration requires -mlong-double-128 IBM extended format support])
fi
fi
LIBC_LINKER_FEATURE([--no-tls-get-addr-optimize], [-Wl,--no-tls-get-addr-optimize],
[libc_cv_tls_get_addr_optimize=yes], [libc_cv_tls_get_addr_optimize=no])
LIBC_CONFIG_VAR([have-tls-get-addr-optimize], [$libc_cv_tls_get_addr_optimize])