From patchwork Mon Apr 6 19:12:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 38756 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 4BE37385E00A for ; Mon, 6 Apr 2020 19:12:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4BE37385E00A Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 036J3ou2026860 for ; Mon, 6 Apr 2020 15:12:42 -0400 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 306nvv2u5t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 06 Apr 2020 15:12:42 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 036JBwsN024596 for ; Mon, 6 Apr 2020 19:12:41 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma02dal.us.ibm.com with ESMTP id 306hv6pxmr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 06 Apr 2020 19:12:41 +0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 036JCe0Y34865560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 6 Apr 2020 19:12:40 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BD6F8112065 for ; Mon, 6 Apr 2020 19:12:40 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8EA41112063 for ; Mon, 6 Apr 2020 19:12:40 +0000 (GMT) Received: from brokenarrow.ibmuc.com (unknown [9.85.183.58]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP for ; Mon, 6 Apr 2020 19:12:40 +0000 (GMT) From: "Paul E. Murphy" To: libc-alpha@sourceware.org Subject: [PATCH v3 3/6] powerpc64le: raise GCC requirement to 7.4 for long double transition Date: Mon, 6 Apr 2020 14:12:36 -0500 Message-Id: X-Mailer: git-send-email 2.21.1 In-Reply-To: References: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-06_09:2020-04-06, 2020-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 malwarescore=0 phishscore=0 mlxscore=0 priorityscore=1501 adultscore=0 suspectscore=1 lowpriorityscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004060145 X-Spam-Status: No, score=-24.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 19:12:45 -0000 Add compiler feature tests to ensure we can build ieee128 long double. These test for -mabi=ieeelongdouble, -mno-gnu-attribute, and -Wno-psabi. Likewise, verify some compiler bugs have been addressed. These aren't helpful for building glibc, but may cause test failures when testing the new long double. See notes below from Raji. On powerpc64le, some older compiler versions give error for the function signbit() for 128-bit floating point types. This is fixed by PR83862 in gcc 8.0 and backported to gcc6 and gcc7. This patch adds a test to check compiler version to avoid compiler errors during make check. Likewise, test for -mno-gnu-attribute support which was On powerpc64le, a few files are built on IEEE long double mode (-mabi=ieeelongdouble), whereas most are built on IBM long double mode (-mabi=ibmlongdouble, the default for -mlong-double-128). Since binutils 2.31, linking object files with different long double modes causes errors similar to: ld: libc_pic.a(s_isinfl.os) uses IBM long double, libc_pic.a(ieee128-qefgcvt.os) uses IEEE long double. collect2: error: ld returned 1 exit status make[2]: *** [../Makerules:649: libc_pic.os] Error 1 The warnings are fair and correct, but in order for glibc to have support for both long double modes on powerpc64le, they have to be ignored. This can be accomplished with the use of -mno-gnu-attribute option when building the few files that require IEEE long double mode. However, -mno-gnu-attribute is not available in GCC 6, the minimum version required to build glibc, so this patch adds a test for this feature in powerpc64le builds, and fails early if it's not available. Co-Authored-By: Rajalakshmi Srinivasaraghavan Co-Authored-By: Gabriel F. T. Gomes --- INSTALL | 6 +++ NEWS | 3 +- manual/install.texi | 5 ++ sysdeps/powerpc/powerpc64/le/configure | 59 +++++++++++++++++++++++ sysdeps/powerpc/powerpc64/le/configure.ac | 35 ++++++++++++++ 5 files changed, 107 insertions(+), 1 deletion(-) diff --git a/INSTALL b/INSTALL index 242cb06f91..d7c109358c 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' is required. As of release time, + this means GCC 7.4 (excepting 7.5) or newer. The compiler option + is 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 3cf738adfb..07da1545b4 100644 --- a/NEWS +++ b/NEWS @@ -20,7 +20,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..66de8ea59b 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} is required. As of release time, +this means GCC 7.4 (excepting 7.5) or newer. The compiler option is 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..4b4d6cff6f 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 (BZ 83862)." +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..26a54beaa0 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 BZ 83862 and backported +dnl to gcc6 and gcc7. This test is to check if we are using the compiler +dnl that has this bug. (available in GCC 8.0). +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 (BZ 83862)."]) + + test -n "$critic_missing" && AC_MSG_ERROR([*** $critic_missing])