diff options
author | Joseph Myers <joseph@codesourcery.com> | 2017-12-12 13:56:47 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2017-12-12 13:56:47 +0000 |
commit | 8df5d34720dd71e934545bade879e04697830757 (patch) | |
tree | af607d1b63037ad92901e4ed8a4a71f95270ee31 | |
parent | 0cee1257a96fc2983c7cc0717015ad54d81ceff3 (diff) | |
download | glibc-8df5d34720dd71e934545bade879e04697830757.tar.gz glibc-8df5d34720dd71e934545bade879e04697830757.tar.xz glibc-8df5d34720dd71e934545bade879e04697830757.zip |
Remove --with-fp / --without-fp.
There is a configure option --without-fp that specifies that nofpu sysdeps directories should be used instead of fpu directories. For most glibc configurations, this option is of no use: either there is no valid nofpu variant of that configuration, or there are no fpu or nofpu sysdeps directories for that processor and so the option does nothing. For a few configurations, if you are using a soft-float compiler this option is required, and failing to use it generally results in compilation errors from inline asm using unavailable floating-point instructions. We're moving away from --with-cpu to configuring glibc based on how the compiler generates code, and it is natural to do so for --without-fp as well; in most cases the soft-float and hard-float ABIs are incompatible so you have no hope of building a working glibc with an inappropriately configured compiler or libgcc. This patch eliminates --without-fp, replacing it entirely by automatic configuration based on the compiler. Configurations for which this is relevant (coldfire / mips / powerpc32 / sh) define a variable with_fp_cond in their preconfigure fragments (under the same conditions under which those fragments do anything); this is a preprocessor conditional which the toplevel configure script then uses in a test to determine which sysdeps directories to use. The config.make with-fp variable remains. It's used only by powerpc (sysdeps/powerpc/powerpc32/Makefile) to add -mhard-float to various flags variables. For powerpc, -mcpu= options can imply use of soft-float. That could be an issue if you want to build for e.g. 476fp, but are using --with-cpu=476 because there isn't a 476fp sysdeps directory. If in future we eliminate --with-cpu and replace it entirely by testing the compiler, it would be natural at that point to eliminate that code as well (as the user should then just use a compiler defaulting to 476fp and the 476 sysdeps directory would be used automatically). Tested for x86_64, and tested with build-many-glibcs.py that installed shared libraries are unchanged by this patch. * configure.ac (--with-fp): Remove configure option. (with_fp_cond): New variable. (libc_cv_with_fp): New configure test. Use this variable instead of with_fp. * configure: Regenerated. * config.make.in (with-fp): Use @libc_cv_with_fp@. * manual/install.texi (Configuring and compiling): Remove --without-fp. * INSTALL: Regenerated. * sysdeps/m68k/preconfigure (with_fp_cond): Define for ColdFire. * sysdeps/mips/preconfigure (with_fp_cond): Define. * sysdeps/powerpc/preconfigure (with_fp_cond): Define for 32-bit. * sysdeps/sh/preconfigure (with_fp_cond): Define. * scripts/build-many-glibcs.py (Context.add_all_configs): Do not use --without-fp to configure glibc.
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | INSTALL | 4 | ||||
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | config.make.in | 2 | ||||
-rwxr-xr-x | configure | 44 | ||||
-rw-r--r-- | configure.ac | 31 | ||||
-rw-r--r-- | manual/install.texi | 4 | ||||
-rwxr-xr-x | scripts/build-many-glibcs.py | 51 | ||||
-rw-r--r-- | sysdeps/m68k/preconfigure | 6 | ||||
-rw-r--r-- | sysdeps/mips/preconfigure | 2 | ||||
-rw-r--r-- | sysdeps/powerpc/preconfigure | 1 | ||||
-rw-r--r-- | sysdeps/sh/preconfigure | 10 |
12 files changed, 112 insertions, 66 deletions
diff --git a/ChangeLog b/ChangeLog index 90e47f7877..7a54848d30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2017-12-12 Joseph Myers <joseph@codesourcery.com> + + * configure.ac (--with-fp): Remove configure option. + (with_fp_cond): New variable. + (libc_cv_with_fp): New configure test. Use this variable instead + of with_fp. + * configure: Regenerated. + * config.make.in (with-fp): Use @libc_cv_with_fp@. + * manual/install.texi (Configuring and compiling): Remove + --without-fp. + * INSTALL: Regenerated. + * sysdeps/m68k/preconfigure (with_fp_cond): Define for ColdFire. + * sysdeps/mips/preconfigure (with_fp_cond): Define. + * sysdeps/powerpc/preconfigure (with_fp_cond): Define for 32-bit. + * sysdeps/sh/preconfigure (with_fp_cond): Define. + * scripts/build-many-glibcs.py (Context.add_all_configs): Do not + use --without-fp to configure glibc. + 2017-12-12 Rical Jasan <ricaljasan@pacific.net> * manual/locale.texi (nl_langinfo): Fix a typo. diff --git a/INSTALL b/INSTALL index e59c11dabd..80306de35c 100644 --- a/INSTALL +++ b/INSTALL @@ -81,10 +81,6 @@ will be used, and CFLAGS sets optimization options for the compiler. library will still be usable, but functionality may be lost--for example, you can't build a shared libc with old binutils. -'--without-fp' - Use this option if your computer lacks hardware floating-point - support and your operating system does not emulate an FPU. - '--disable-shared' Don't build shared libraries even if it is possible. Not all systems support shared libraries; you need ELF support and diff --git a/NEWS b/NEWS index 25a2116cdd..c6d859ca75 100644 --- a/NEWS +++ b/NEWS @@ -76,6 +76,11 @@ Deprecated and removed features, and other changes affecting compatibility: glibc has been removed. The --enable-add-ons configure option is now ignored. +* The --without-fp configure option is now ignored. Whether hardware + floating-point instructions are used is now configured based on whether + the compiler used at configure time (without any options implied by a + --with-cpu= configure option) uses such instructions. + * The res_hnok, res_dnok, res_mailok and res_ownok functions now check that the specified string can be parsed as a domain name. diff --git a/config.make.in b/config.make.in index 9da77d1efa..04513dbb74 100644 --- a/config.make.in +++ b/config.make.in @@ -57,7 +57,7 @@ have-z-execstack = @libc_cv_z_execstack@ have-protected-data = @libc_cv_protected_data@ have-insert = @libc_cv_insert@ have-glob-dat-reloc = @libc_cv_has_glob_dat@ -with-fp = @with_fp@ +with-fp = @libc_cv_with_fp@ enable-timezone-tools = @enable_timezone_tools@ unwind-find-fde = @libc_cv_gcc_unwind_find_fde@ have-fpie = @libc_cv_fpie@ diff --git a/configure b/configure index dd8b8c95e6..4a85706862 100755 --- a/configure +++ b/configure @@ -666,6 +666,7 @@ multi_arch no_stack_protector stack_protector libc_cv_ssp +libc_cv_with_fp base_machine have_tunables build_pt_chown @@ -683,7 +684,6 @@ hardcoded_path_in_tests enable_timezone_tools use_default_link sysheaders -with_fp ac_ct_CXX CXXFLAGS CXX @@ -756,7 +756,6 @@ with_bugurl with_gd with_gd_include with_gd_lib -with_fp with_binutils with_selinux with_headers @@ -1467,7 +1466,6 @@ Optional Packages: --with-gd=DIR find libgd include dir and library with prefix DIR --with-gd-include=DIR find libgd include files in DIR --with-gd-lib=DIR find libgd library files in DIR - --with-fp if using floating-point hardware [default=yes] --with-binutils=PATH specify location of binutils (as and ld) --with-selinux if building with SELinux support --with-headers=PATH location of system headers to use (for example @@ -3294,15 +3292,6 @@ libgd-LDFLAGS = $libgd_ldflags" fi -# Check whether --with-fp was given. -if test "${with_fp+set}" = set; then : - withval=$with_fp; with_fp=$withval -else - with_fp=yes -fi - - - # Check whether --with-binutils was given. if test "${with_binutils+set}" = set; then : withval=$with_binutils; path_binutils=$withval @@ -3778,6 +3767,11 @@ fi # check below. libc_config_ok=no +# A preconfigure script for a system that may or may not use fpu +# sysdeps directories sets this to a preprocessor conditional for +# whether to use such directories. +with_fp_cond=1 + if frags=`ls -d $srcdir/sysdeps/*/preconfigure 2> /dev/null` then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysdeps preconfigure fragments" >&5 @@ -3816,6 +3810,30 @@ fi test -n "$base_machine" || base_machine=$machine +# Determine whether to use fpu or nofpu sysdeps directories. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for use of fpu sysdeps directories" >&5 +$as_echo_n "checking for use of fpu sysdeps directories... " >&6; } +if ${libc_cv_with_fp+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <<EOF +#if $with_fp_cond +int dummy; +#else +# error "no hardware floating point" +#endif +EOF +libc_cv_with_fp=no +if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \ + 1>&5 2>&5 ; then + libc_cv_with_fp=yes +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_with_fp" >&5 +$as_echo "$libc_cv_with_fp" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fstack-protector" >&5 $as_echo_n "checking for -fstack-protector... " >&6; } if ${libc_cv_ssp+:} false; then : @@ -4085,7 +4103,7 @@ tail=$machine${submachine:+/$submachine} while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do set $m # Prepend the machine's FPU directory unless --without-fp. - if test "$with_fp" = yes; then + if test "$libc_cv_with_fp" = yes; then maybe_fpu=/fpu else maybe_fpu=/nofpu diff --git a/configure.ac b/configure.ac index f85a50da53..edf662715b 100644 --- a/configure.ac +++ b/configure.ac @@ -127,12 +127,6 @@ libgd-LDFLAGS = $libgd_ldflags" fi dnl Arguments to specify presence of other packages/features. -AC_ARG_WITH([fp], - AC_HELP_STRING([--with-fp], - [if using floating-point hardware @<:@default=yes@:>@]), - [with_fp=$withval], - [with_fp=yes]) -AC_SUBST(with_fp) AC_ARG_WITH([binutils], AC_HELP_STRING([--with-binutils=PATH], [specify location of binutils (as and ld)]), @@ -489,6 +483,11 @@ AC_ARG_WITH([cpu], # check below. libc_config_ok=no +# A preconfigure script for a system that may or may not use fpu +# sysdeps directories sets this to a preprocessor conditional for +# whether to use such directories. +with_fp_cond=1 + dnl Let sysdeps/*/preconfigure act here. LIBC_PRECONFIGURE([$srcdir], [for sysdeps]) @@ -517,6 +516,24 @@ fi test -n "$base_machine" || base_machine=$machine AC_SUBST(base_machine) +# Determine whether to use fpu or nofpu sysdeps directories. +AC_CACHE_CHECK([for use of fpu sysdeps directories], + libc_cv_with_fp, [dnl +cat > conftest.c <<EOF +#if $with_fp_cond +int dummy; +#else +# error "no hardware floating point" +#endif +EOF +libc_cv_with_fp=no +if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \ + 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then + libc_cv_with_fp=yes +fi +rm -f conftest*]) +AC_SUBST(libc_cv_with_fp) + AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector], [libc_cv_ssp=yes], @@ -720,7 +737,7 @@ tail=$machine${submachine:+/$submachine} while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do set $m # Prepend the machine's FPU directory unless --without-fp. - if test "$with_fp" = yes; then + if test "$libc_cv_with_fp" = yes; then maybe_fpu=/fpu else maybe_fpu=/nofpu diff --git a/manual/install.texi b/manual/install.texi index a3cb09dafc..e81f1c50c3 100644 --- a/manual/install.texi +++ b/manual/install.texi @@ -106,10 +106,6 @@ problem and suppress these constructs, so that the library will still be usable, but functionality may be lost---for example, you can't build a shared libc with old binutils. -@item --without-fp -Use this option if your computer lacks hardware floating-point support -and your operating system does not emulate an FPU. - @c disable static doesn't work currently @c @item --disable-static @c Don't build static libraries. Static libraries aren't that useful these diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py index 59972a0602..599e12e355 100755 --- a/scripts/build-many-glibcs.py +++ b/scripts/build-many-glibcs.py @@ -216,15 +216,12 @@ class Context(object): os_name='linux-gnu', variant='soft', gcc_cfg=['--with-mips-plt', '--with-float=soft'], - glibcs=[{'variant': 'n32-soft', - 'cfg': ['--without-fp']}, + glibcs=[{'variant': 'n32-soft'}, {'variant': 'soft', 'arch': 'mips', - 'ccopts': '-mabi=32', - 'cfg': ['--without-fp']}, + 'ccopts': '-mabi=32'}, {'variant': 'n64-soft', - 'ccopts': '-mabi=64', - 'cfg': ['--without-fp']}]) + 'ccopts': '-mabi=64'}]) self.add_config(arch='mips64', os_name='linux-gnu', variant='nan2008', @@ -244,15 +241,12 @@ class Context(object): '--with-arch-64=mips64r2', '--with-arch-32=mips32r2', '--with-float=soft'], - glibcs=[{'variant': 'n32-nan2008-soft', - 'cfg': ['--without-fp']}, + glibcs=[{'variant': 'n32-nan2008-soft'}, {'variant': 'nan2008-soft', 'arch': 'mips', - 'ccopts': '-mabi=32', - 'cfg': ['--without-fp']}, + 'ccopts': '-mabi=32'}, {'variant': 'n64-nan2008-soft', - 'ccopts': '-mabi=64', - 'cfg': ['--without-fp']}]) + 'ccopts': '-mabi=64'}]) self.add_config(arch='mips64el', os_name='linux-gnu', gcc_cfg=['--with-mips-plt'], @@ -265,15 +259,12 @@ class Context(object): os_name='linux-gnu', variant='soft', gcc_cfg=['--with-mips-plt', '--with-float=soft'], - glibcs=[{'variant': 'n32-soft', - 'cfg': ['--without-fp']}, + glibcs=[{'variant': 'n32-soft'}, {'variant': 'soft', 'arch': 'mipsel', - 'ccopts': '-mabi=32', - 'cfg': ['--without-fp']}, + 'ccopts': '-mabi=32'}, {'variant': 'n64-soft', - 'ccopts': '-mabi=64', - 'cfg': ['--without-fp']}]) + 'ccopts': '-mabi=64'}]) self.add_config(arch='mips64el', os_name='linux-gnu', variant='nan2008', @@ -293,15 +284,12 @@ class Context(object): '--with-arch-64=mips64r2', '--with-arch-32=mips32r2', '--with-float=soft'], - glibcs=[{'variant': 'n32-nan2008-soft', - 'cfg': ['--without-fp']}, + glibcs=[{'variant': 'n32-nan2008-soft'}, {'variant': 'nan2008-soft', 'arch': 'mipsel', - 'ccopts': '-mabi=32', - 'cfg': ['--without-fp']}, + 'ccopts': '-mabi=32'}, {'variant': 'n64-nan2008-soft', - 'ccopts': '-mabi=64', - 'cfg': ['--without-fp']}]) + 'ccopts': '-mabi=64'}]) self.add_config(arch='nios2', os_name='linux-gnu') self.add_config(arch='powerpc', @@ -314,8 +302,7 @@ class Context(object): os_name='linux-gnu', variant='soft', gcc_cfg=['--disable-multilib', '--with-float=soft', - '--enable-secureplt'], - glibcs=[{'variant': 'soft', 'cfg': ['--without-fp']}]) + '--enable-secureplt']) self.add_config(arch='powerpc64', os_name='linux-gnu', gcc_cfg=['--disable-multilib', '--enable-secureplt']) @@ -325,13 +312,11 @@ class Context(object): self.add_config(arch='powerpc', os_name='linux-gnuspe', gcc_cfg=['--disable-multilib', '--enable-secureplt', - '--enable-e500-double'], - glibcs=[{'cfg': ['--without-fp']}]) + '--enable-e500-double']) self.add_config(arch='powerpc', os_name='linux-gnuspe', variant='e500v1', - gcc_cfg=['--disable-multilib', '--enable-secureplt'], - glibcs=[{'variant': 'e500v1', 'cfg': ['--without-fp']}]) + gcc_cfg=['--disable-multilib', '--enable-secureplt']) self.add_config(arch='s390x', os_name='linux-gnu', glibcs=[{}, @@ -347,13 +332,11 @@ class Context(object): self.add_config(arch='sh4', os_name='linux-gnu', variant='soft', - gcc_cfg=['--without-fp'], - glibcs=[{'variant': 'soft', 'cfg': ['--without-fp']}]) + gcc_cfg=['--without-fp']) self.add_config(arch='sh4eb', os_name='linux-gnu', variant='soft', - gcc_cfg=['--without-fp'], - glibcs=[{'variant': 'soft', 'cfg': ['--without-fp']}]) + gcc_cfg=['--without-fp']) self.add_config(arch='sparc64', os_name='linux-gnu', glibcs=[{}, diff --git a/sysdeps/m68k/preconfigure b/sysdeps/m68k/preconfigure index 94fc1aabc2..1028dac080 100644 --- a/sysdeps/m68k/preconfigure +++ b/sysdeps/m68k/preconfigure @@ -13,5 +13,9 @@ m68k) variant=`(echo "#ifdef __mcoldfire__" echo >&2 "Cannot determine m68k processor variant" exit 1 fi - base_machine=m68k machine=m68k/$variant ;; + base_machine=m68k machine=m68k/$variant + if test "$variant" = "coldfire"; then + with_fp_cond="defined __mcffpu__" + fi + ;; esac diff --git a/sysdeps/mips/preconfigure b/sysdeps/mips/preconfigure index c118592b27..48fc32ed5b 100644 --- a/sysdeps/mips/preconfigure +++ b/sysdeps/mips/preconfigure @@ -25,5 +25,7 @@ mips*) if test "$abiflag" != "_ABIO32" -a "$mips16flag" = "1"; then as_fn_error $? "MIPS16 is only supported with the o32 ABI." "$LINENO" 5 fi + + with_fp_cond="defined __mips_hard_float" ;; esac diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure index 7de2eafd52..0030bfd0c0 100644 --- a/sysdeps/powerpc/preconfigure +++ b/sysdeps/powerpc/preconfigure @@ -16,5 +16,6 @@ powerpc*) base_machine=powerpc machine=powerpc/powerpc32 fi rm -f conftest.i + with_fp_cond="!defined __NO_FPRS__" ;; esac diff --git a/sysdeps/sh/preconfigure b/sysdeps/sh/preconfigure index c1f6537797..16e29273df 100644 --- a/sysdeps/sh/preconfigure +++ b/sysdeps/sh/preconfigure @@ -1,6 +1,12 @@ # preconfigure fragment for sh. case "$machine" in -sh3*) base_machine=sh machine=sh/sh3 ;; -sh4*) base_machine=sh machine=sh/sh4 ;; +sh3*) base_machine=sh + machine=sh/sh3 + with_fp_cond="defined __SH_FPU_ANY__" + ;; +sh4*) base_machine=sh + machine=sh/sh4 + with_fp_cond="defined __SH_FPU_ANY__" + ;; esac |