This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] powerpc64le build fails with GCC7


Hi all,

With GCC7, the test for -mfloat128 fails with a message that this option requires -mfloat128-type to be supplied as well. Cannot supply both options unconditionally, though, as GCC6 would choke on unknown option.

Patch attached, please review. Build-tested only, with GCC 7.2.0 and 6.4.0.

Regards,
Alexey.

>From ea42205587b557c604f165ffdb745d94035fd18d Mon Sep 17 00:00:00 2001
From: Alexey Neyman <stilor@att.net>
Date: Mon, 21 Aug 2017 08:50:02 -0700
Subject: [PATCH] Fix powerpc64le target with GCC7

With GCC7, the test for -mfloat128 fails with a message that this
option requires -mfloat128-type to be supplied as well. Cannot
supply both options unconditionally, though, as GCC6 would choke
on unknown option.

    * sysdeps/powerpc/powerpc64le/configure.ac:
    Detect if -mfloat128-type needs to be supplied in addition to
    -mfloat128
    * configure.ac (libc_cv_compiler_powerpc64le_float128_type):
    New variable.
    * config.make.in (config-cflags-mfloat128-type): New variable.
    * sysdeps/powerpc/powerpc64le/configure, configure: Regenerate.

Signed-off-by: Alexey Neyman <stilor@att.net>
---
 ChangeLog                                | 10 ++++++
 config.make.in                           |  1 +
 configure                                |  4 +++
 configure.ac                             |  3 ++
 sysdeps/powerpc/powerpc64le/Makefile     | 58 +++++++++++++++++---------------
 sysdeps/powerpc/powerpc64le/configure    | 20 ++++++++++-
 sysdeps/powerpc/powerpc64le/configure.ac |  8 ++++-
 7 files changed, 74 insertions(+), 30 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bfc20d6881..248ba1b5ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-08-21  Alexey Neyman  <stilor@att.net>
+
+	* sysdeps/powerpc/powerpc64le/configure.ac:
+	Detect if -mfloat128-type needs to be supplied in addition to
+	-mfloat128
+	* configure.ac (libc_cv_compiler_powerpc64le_float128_type):
+	New variable.
+	* config.make.in (config-cflags-mfloat128-type): New variable.
+	* sysdeps/powerpc/powerpc64le/configure, configure: Regenerate.
+
 2017-08-21  Florian Weimer  <fweimer@redhat.com>
 
 	[BZ #21972]
diff --git a/config.make.in b/config.make.in
index ea7a42cc19..44fc514d52 100644
--- a/config.make.in
+++ b/config.make.in
@@ -40,6 +40,7 @@ asflags-cpu = @libc_cv_cc_submachine@
 config-extra-cflags = @libc_extra_cflags@
 config-extra-cppflags = @libc_extra_cppflags@
 config-cflags-nofma = @libc_cv_cc_nofma@
+config-cflags-mfloat128-type = @libc_cv_compiler_powerpc64le_float128_type@
 
 defines = @DEFINES@
 sysheaders = @sysheaders@
diff --git a/configure b/configure
index 5cb5210107..b98352502d 100755
--- a/configure
+++ b/configure
@@ -618,6 +618,7 @@ have_libaudit
 LIBGD
 libc_cv_cc_loop_to_function
 libc_cv_cc_submachine
+libc_cv_compiler_powerpc64le_float128_type
 libc_cv_cc_nofma
 libc_cv_mtls_dialect_gnu2
 fno_unit_at_a_time
@@ -6331,6 +6332,9 @@ fi
 $as_echo "$libc_cv_cc_nofma" >&6; }
 
 
+# Detected in powerpc64le fragment
+
+
 if test -n "$submachine"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler option for CPU variant" >&5
 $as_echo_n "checking for compiler option for CPU variant... " >&6; }
diff --git a/configure.ac b/configure.ac
index 2c6308883c..9e4eaa3cfd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1677,6 +1677,9 @@ for opt in -ffp-contract=off -mno-fused-madd; do
 done])
 AC_SUBST(libc_cv_cc_nofma)
 
+# Detected in powerpc64le fragment
+AC_SUBST(libc_cv_compiler_powerpc64le_float128_type)
+
 if test -n "$submachine"; then
   AC_CACHE_CHECK([for compiler option for CPU variant],
 		 libc_cv_cc_submachine, [dnl
diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
index 77617b670a..389a58aa54 100644
--- a/sysdeps/powerpc/powerpc64le/Makefile
+++ b/sysdeps/powerpc/powerpc64le/Makefile
@@ -6,35 +6,37 @@
 # linked executables, forcing to link the loader after libgcc link.
 f128-loader-link = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
 
+f128-options = -mfloat128 $(config-cflags-mfloat128-type)
+
 ifeq ($(subdir),math)
 # sqrtf128 requires emulation before POWER9.
 CPPFLAGS += -I../soft-fp
 
 # float128 requires adding a handful of extra flags.
-$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128
-CFLAGS-libm-test-support-float128.c += -mfloat128
+$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += $(f128-options)
+$(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += $(f128-options)
+$(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += $(f128-options)
+$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += $(f128-options)
+CFLAGS-libm-test-support-float128.c += $(f128-options)
 $(objpfx)test-float128% $(objpfx)test-ifloat128%: \
   gnulib-tests += $(f128-loader-link)
 endif
 
 # Append flags to string <-> _Float128 routines.
 ifneq ($(filter $(subdir),wcsmbs stdlib),)
-$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),%f128_l$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),%f128_nan$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),%float1282mpn$(suf)): CFLAGS += -mfloat128
-$(foreach suf,$(all-object-suffixes),%mpn2float128$(suf)): CFLAGS += -mfloat128
-CFLAGS-bug-strtod.c += -mfloat128
-CFLAGS-bug-strtod2.c += -mfloat128
-CFLAGS-tst-strtod-round.c += -mfloat128
-CFLAGS-tst-wcstod-round.c += -mfloat128
-CFLAGS-tst-strtod6.c += -mfloat128
-CFLAGS-tst-strfrom.c += -mfloat128
-CFLAGS-tst-strfrom-locale.c += -mfloat128
-CFLAGS-strfrom-skeleton.c += -mfloat128
+$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += $(f128-options)
+$(foreach suf,$(all-object-suffixes),%f128_l$(suf)): CFLAGS += $(f128-options)
+$(foreach suf,$(all-object-suffixes),%f128_nan$(suf)): CFLAGS += $(f128-options)
+$(foreach suf,$(all-object-suffixes),%float1282mpn$(suf)): CFLAGS += $(f128-options)
+$(foreach suf,$(all-object-suffixes),%mpn2float128$(suf)): CFLAGS += $(f128-options)
+CFLAGS-bug-strtod.c += $(f128-options)
+CFLAGS-bug-strtod2.c += $(f128-options)
+CFLAGS-tst-strtod-round.c += $(f128-options)
+CFLAGS-tst-wcstod-round.c += $(f128-options)
+CFLAGS-tst-strtod6.c += $(f128-options)
+CFLAGS-tst-strfrom.c += $(f128-options)
+CFLAGS-tst-strfrom-locale.c += $(f128-options)
+CFLAGS-strfrom-skeleton.c += $(f128-options)
 $(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
 tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
 strfrom-skeleton,$(objpfx)$(test)): gnulib-tests += $(f128-loader-link)
@@ -44,18 +46,18 @@ strfrom-skeleton,$(objpfx)$(test)): gnulib-tests += $(f128-loader-link)
 # Makefiles (e.g.: wcsmbs/Makefile) override CFLAGS defined by the Makefiles in
 # sysdeps.  This is avoided with the use sysdep-CFLAGS instead of CFLAGS.
 sysdep-CFLAGS += $(sysdep-CFLAGS-$(<F))
-sysdep-CFLAGS-fpioconst.c += -mfloat128
-sysdep-CFLAGS-strtod_l.c += -mfloat128
-sysdep-CFLAGS-strtof_l.c += -mfloat128
-sysdep-CFLAGS-strtold_l.c += -mfloat128
-sysdep-CFLAGS-wcstod_l.c += -mfloat128
-sysdep-CFLAGS-wcstof_l.c += -mfloat128
-sysdep-CFLAGS-wcstold_l.c += -mfloat128
+sysdep-CFLAGS-fpioconst.c += $(f128-options)
+sysdep-CFLAGS-strtod_l.c += $(f128-options)
+sysdep-CFLAGS-strtof_l.c += $(f128-options)
+sysdep-CFLAGS-strtold_l.c += $(f128-options)
+sysdep-CFLAGS-wcstod_l.c += $(f128-options)
+sysdep-CFLAGS-wcstof_l.c += $(f128-options)
+sysdep-CFLAGS-wcstold_l.c += $(f128-options)
 endif
 
 # Append flags to printf routines.
 ifeq ($(subdir),stdio-common)
-CFLAGS-printf_fp.c = -mfloat128
-CFLAGS-printf_fphex.c = -mfloat128
-CFLAGS-printf_size.c = -mfloat128
+CFLAGS-printf_fp.c = $(f128-options)
+CFLAGS-printf_fphex.c = $(f128-options)
+CFLAGS-printf_size.c = $(f128-options)
 endif
diff --git a/sysdeps/powerpc/powerpc64le/configure b/sysdeps/powerpc/powerpc64le/configure
index 66bb5dcc1a..5978894469 100644
--- a/sysdeps/powerpc/powerpc64le/configure
+++ b/sysdeps/powerpc/powerpc64le/configure
@@ -1,6 +1,24 @@
 # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
  # Local configure fragment for sysdeps/powerpc/powerpc64le.
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -mfloat128-type" >&5
+$as_echo_n "checking whether compiler supports -mfloat128-type... " >&6; }
+if ${libc_cv_compiler_powerpc64le_float128_type+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -mfloat128-type -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_compiler_powerpc64le_float128_type=-mfloat128-type
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_compiler_powerpc64le_float128_type" >&5
+$as_echo "$libc_cv_compiler_powerpc64le_float128_type" >&6; }
+
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports binary128 floating point type" >&5
 $as_echo_n "checking if $CC supports binary128 floating point type... " >&6; }
@@ -8,7 +26,7 @@ if ${libc_cv_compiler_powerpc64le_binary128_ok+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Werror -mfloat128"
+CFLAGS="$CFLAGS -Werror -mfloat128 $libc_cv_compiler_powerpc64le_float128_type"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
diff --git a/sysdeps/powerpc/powerpc64le/configure.ac b/sysdeps/powerpc/powerpc64le/configure.ac
index 20a49d89e8..27eb8b7aca 100644
--- a/sysdeps/powerpc/powerpc64le/configure.ac
+++ b/sysdeps/powerpc/powerpc64le/configure.ac
@@ -1,12 +1,18 @@
 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 # Local configure fragment for sysdeps/powerpc/powerpc64le.
 
+AC_CACHE_CHECK([whether compiler supports -mfloat128-type],
+	       libc_cv_compiler_powerpc64le_float128_type, [dnl
+LIBC_TRY_CC_OPTION([-mfloat128-type],
+    [libc_cv_compiler_powerpc64le_float128_type=-mfloat128-type])
+])
+
 dnl Require binary128 floating point support on powerpc64le (available in
 dnl GCC 6.2).
 AC_CACHE_CHECK([if $CC supports binary128 floating point type],
 	       libc_cv_compiler_powerpc64le_binary128_ok, [dnl
 save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Werror -mfloat128"
+CFLAGS="$CFLAGS -Werror -mfloat128 $libc_cv_compiler_powerpc64le_float128_type"
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 __float128 a, b, c, d, e;
 int i;
-- 
2.11.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]