aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-12-19 12:08:00 +0800
committerH.J. Lu <hjl.tools@gmail.com>2024-12-22 12:54:44 +0800
commitf5fb9fa011f242bfd8c291fe876532ebd252397e (patch)
tree20230ef83afcc97d09a084c863d3b4fe6353f5e9 /sysdeps
parent9151ecbb5e5a3d2ee30826ab9cce3aa5575e3a70 (diff)
downloadglibc-f5fb9fa011f242bfd8c291fe876532ebd252397e.zip
glibc-f5fb9fa011f242bfd8c291fe876532ebd252397e.tar.gz
glibc-f5fb9fa011f242bfd8c291fe876532ebd252397e.tar.bz2
x86: Include test-flt-eval-method-387 if -mfpmath=387 works
Since Clang doesn't support -mfpmath=387 on x86-64, on x86, include test-flt-eval-method-387 only if -mfpmath=387 works. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/x86/configure34
-rw-r--r--sysdeps/x86/configure.ac10
-rw-r--r--sysdeps/x86/fpu/Makefile4
3 files changed, 47 insertions, 1 deletions
diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
index a6d3777..c7ea9ac 100644
--- a/sysdeps/x86/configure
+++ b/sysdeps/x86/configure
@@ -175,6 +175,40 @@ x86-isa-level-3-or-above = 3 4"
config_vars="$config_vars
enable-x86-isa-level = $libc_cv_include_x86_isa_level"
+
+
+saved_CC="$CC"
+CC="$TEST_CC"
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if -mfpmath=387 works in testing" >&5
+printf %s "checking if -mfpmath=387 works in testing... " >&6; }
+if test ${libc_cv_have_test_cc_cflags_mfpmath_387+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if { ac_try='${CC-cc} -c -Werror -mfpmath=387 -xc /dev/null -S -o /dev/null'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+then :
+ libc_cv_have_test_cc_cflags_mfpmath_387=yes
+else case e in #(
+ e) libc_cv_have_test_cc_cflags_mfpmath_387=no
+ ;;
+esac
+fi ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_have_test_cc_cflags_mfpmath_387" >&5
+printf "%s\n" "$libc_cv_have_test_cc_cflags_mfpmath_387" >&6; }
+
+CC="$saved_CC"
+
+
+config_vars="$config_vars
+have-test-cc-cflags-mfpmath-387 = $libc_cv_have_test_cc_cflags_mfpmath_387"
+
printf "%s\n" "#define SUPPORT_STATIC_PIE 1" >>confdefs.h
diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
index 8a259d3..031f917 100644
--- a/sysdeps/x86/configure.ac
+++ b/sysdeps/x86/configure.ac
@@ -120,5 +120,15 @@ LIBC_CONFIG_VAR([have-x86-isa-level], [$libc_cv_have_x86_isa_level])
LIBC_CONFIG_VAR([x86-isa-level-3-or-above], [3 4])
LIBC_CONFIG_VAR([enable-x86-isa-level], [$libc_cv_include_x86_isa_level])
+dnl Check if TEST_CC supports -mfpmath=387
+LIBC_TRY_TEST_CC_OPTION([if -mfpmath=387 works],
+ [-c -Werror -mfpmath=387],
+ libc_cv_have_test_cc_cflags_mfpmath_387,
+ [libc_cv_have_test_cc_cflags_mfpmath_387=yes],
+ [libc_cv_have_test_cc_cflags_mfpmath_387=no]
+)
+LIBC_CONFIG_VAR(have-test-cc-cflags-mfpmath-387,
+ $libc_cv_have_test_cc_cflags_mfpmath_387)
+
dnl Static PIE is supported.
AC_DEFINE(SUPPORT_STATIC_PIE)
diff --git a/sysdeps/x86/fpu/Makefile b/sysdeps/x86/fpu/Makefile
index 705dd9d..91b2444 100644
--- a/sysdeps/x86/fpu/Makefile
+++ b/sysdeps/x86/fpu/Makefile
@@ -8,9 +8,11 @@ tests += \
test-fenv-sse \
test-fenv-sse-2 \
test-fenv-x87 \
- test-flt-eval-method-387 \
test-flt-eval-method-sse \
# tests
+ifeq ($(have-test-cc-cflags-mfpmath-387),yes)
+tests += test-flt-eval-method-387
+endif
CFLAGS-test-fenv-sse.c += -msse2 -mfpmath=sse
CFLAGS-test-fenv-clear-sse.c += -msse2 -mfpmath=sse
CFLAGS-test-fenv-sse-2.c += -msse2 -mfpmath=sse