diff --git a/INSTALL b/INSTALL index 242cb06f91..2fa7a81fd9 100644 --- a/INSTALL +++ b/INSTALL @@ -467,6 +467,12 @@ build the GNU C Library: better code. As of release time, GCC 9.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=ibmlondouble' is required. These additional features are + required for building the GNU C Library with support for IEEE long + double. + 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/NEWS b/NEWS index f58436c91a..e60f83a947 100644 --- a/NEWS +++ b/NEWS @@ -32,7 +32,8 @@ Deprecated and removed features, and other changes affecting compatibility: Changes to build and runtime requirements: - [Add changes to build and runtime requirements here] +* powerpc64le requires GCC 7.4 or newer. This is required for supporting + long double redirects. Security related changes: diff --git a/manual/install.texi b/manual/install.texi index 71bf47cac6..34fe75487f 100644 --- a/manual/install.texi +++ b/manual/install.texi @@ -507,6 +507,11 @@ the newest version of the compiler that is known to work for building release time, GCC 9.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=ibmlondouble} is required. These additional features are +required for building the GNU C Library with support for IEEE long double. + 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/powerpc/powerpc64/le/configure b/sysdeps/powerpc/powerpc64/le/configure index bca80cec76..071d881a5a 100644 --- a/sysdeps/powerpc/powerpc64/le/configure +++ b/sysdeps/powerpc/powerpc64/le/configure @@ -32,4 +32,63 @@ if test "$libc_cv_target_power8_ok" != "yes"; then : fi CFLAGS="$OLD_CFLAGS" +OLD_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -mno-gnu-attribute" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler supports -mno-gnu-attribute" >&5 +$as_echo_n "checking if the compiler supports -mno-gnu-attribute... " >&6; } +if ${libc_cv_no_gnu_attr_ok+:} false; then : + $as_echo_n "(cached) " >&6 +else + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_cv_no_gnu_attr_ok=yes +else + libc_cv_no_gnu_attr_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_no_gnu_attr_ok" >&5 +$as_echo "$libc_cv_no_gnu_attr_ok" >&6; } +if test "$libc_cv_no_gnu_attr_ok" != "yes"; then : + critic_missing="$critic_missing A compiler with -mno-gnu-attribute is required on powerpc64le." +fi +CFLAGS="$OLD_CFLAGS" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC compiles signbit with 128-bit floating point type" >&5 +$as_echo_n "checking if $CC compiles signbit with 128-bit floating point type... " >&6; } +if ${libc_cv_compiler_powerpc64le_ice+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -mabi=ieeelongdouble -Wno-psabi" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int sbr (long double a) { return __builtin_signbit (a); } +int sbm (long double *a) { return __builtin_signbit (*a); } +int sbo (long double *a) { return __builtin_signbit (a[4]); } +int sbi (long double *a, unsigned long n) { return __builtin_signbit (a[n]); } +void sbs (int *p, long double a) { *p = __builtin_signbit (a); } + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libc_cv_compiler_powerpc64le_ice=yes +else + libc_cv_compiler_powerpc64le_ice=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +CFLAGS="$save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_compiler_powerpc64le_ice" >&5 +$as_echo "$libc_cv_compiler_powerpc64le_ice" >&6; } +if test "$libc_cv_compiler_powerpc64le_ice" != "yes"; then : + critic_missing="$critic_missing __builtin_signbit is broken. GCC 7.4 or newer is required to resolve (PR83862)." +fi + + test -n "$critic_missing" && as_fn_error $? "*** $critic_missing" "$LINENO" 5 diff --git a/sysdeps/powerpc/powerpc64/le/configure.ac b/sysdeps/powerpc/powerpc64/le/configure.ac index 7f2c9fbf1f..6dabd9be6b 100644 --- a/sysdeps/powerpc/powerpc64/le/configure.ac +++ b/sysdeps/powerpc/powerpc64/le/configure.ac @@ -17,4 +17,39 @@ AS_IF([test "$libc_cv_target_power8_ok" != "yes"], [critic_missing="$critic_missing POWER8 or newer is required on powerpc64le."]) CFLAGS="$OLD_CFLAGS" +dnl Require support for -mno-gnu-attribute +OLD_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -mno-gnu-attribute" +AC_CACHE_CHECK([if the compiler supports -mno-gnu-attribute], + libc_cv_no_gnu_attr_ok, [ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +]])], + [libc_cv_no_gnu_attr_ok=yes], + [libc_cv_no_gnu_attr_ok=no])]) +AS_IF([test "$libc_cv_no_gnu_attr_ok" != "yes"], + [critic_missing="$critic_missing A compiler with -mno-gnu-attribute is required on powerpc64le."]) +CFLAGS="$OLD_CFLAGS" + +dnl Some old compiler versions give error for the function signbit() for +dnl 128-bit floating point types. This is fixed by PR83862 and backported +dnl to gcc6 and gcc7. This test is to check if we are using the compiler +dnl that has this bug (fixed in GCC 8.0, backported to 7.4). +AC_CACHE_CHECK([if $CC compiles signbit with 128-bit floating point type], + libc_cv_compiler_powerpc64le_ice, [dnl +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -mabi=ieeelongdouble -Wno-psabi" +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +int sbr (long double a) { return __builtin_signbit (a); } +int sbm (long double *a) { return __builtin_signbit (*a); } +int sbo (long double *a) { return __builtin_signbit (a[4]); } +int sbi (long double *a, unsigned long n) { return __builtin_signbit (a[n]); } +void sbs (int *p, long double a) { *p = __builtin_signbit (a); } +]])], + [libc_cv_compiler_powerpc64le_ice=yes], + [libc_cv_compiler_powerpc64le_ice=no]) +CFLAGS="$save_CFLAGS"]) +AS_IF([test "$libc_cv_compiler_powerpc64le_ice" != "yes"], + [critic_missing="$critic_missing __builtin_signbit is broken. GCC 7.4 or newer is required to resolve (PR83862)."]) + + test -n "$critic_missing" && AC_MSG_ERROR([*** $critic_missing])