[pushed] configure, libquadmath: Remove unintended AC_CHECK_LIBM [PR111928]

Message ID 20231023131839.6244-1-iain@sandoe.co.uk
State Unresolved
Headers
Series [pushed] configure, libquadmath: Remove unintended AC_CHECK_LIBM [PR111928] |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Iain Sandoe Oct. 23, 2023, 1:18 p.m. UTC
  This is a partial reversion of r14-4825-g6a6d3817afa02b to remove an
unintended change.

Tested with x86_64-linux X arm-none-eabi (and  x86_64-darwin X arm-non-eabi
and native x86_64-darwin bootstrap.  Also reported by the OP to fix the
issue, pushed to trunk, apologies for the breakage,
Iain

--- 8< ---

This was a rebase error, that managed to pass testing on Darwin and
Linux (but fails on bare metal).

	PR libquadmath/111928

libquadmath/ChangeLog:

	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Remove AC_CHECK_LIBM.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
---
 libquadmath/Makefile.in  |   1 -
 libquadmath/configure    | 147 +--------------------------------------
 libquadmath/configure.ac |   2 -
 3 files changed, 2 insertions(+), 148 deletions(-)
  

Comments

Jakub Jelinek Dec. 11, 2023, 3:18 p.m. UTC | #1
On Mon, Oct 23, 2023 at 02:18:39PM +0100, Iain Sandoe wrote:
> This is a partial reversion of r14-4825-g6a6d3817afa02b to remove an
> unintended change.
> 
> Tested with x86_64-linux X arm-none-eabi (and  x86_64-darwin X arm-non-eabi
> and native x86_64-darwin bootstrap.  Also reported by the OP to fix the
> issue, pushed to trunk, apologies for the breakage,
> Iain
> 
> --- 8< ---
> 
> This was a rebase error, that managed to pass testing on Darwin and
> Linux (but fails on bare metal).
> 
> 	PR libquadmath/111928
> 
> libquadmath/ChangeLog:
> 
> 	* Makefile.in: Regenerate.
> 	* configure: Regenerate.
> 	* configure.ac: Remove AC_CHECK_LIBM.

I'm afraid this change is very harmful on Linux.
libquadmath.so.0 had on Linux since forever
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
entry (and it should have it, because it has undefined relocations against
libm.so.6 entrypoints: at least signgam and sqrt, on powerpc64le also
__sqrtieee128.
But with this change it no longer has.
This e.g. breaks libtool build on powerpc64le, where the dynamic linker
crashes during sqrt related IFUNC resolution.

	Jakub
  

Patch

diff --git a/libquadmath/Makefile.in b/libquadmath/Makefile.in
index 068af559457..dbcafb57e5b 100644
--- a/libquadmath/Makefile.in
+++ b/libquadmath/Makefile.in
@@ -355,7 +355,6 @@  INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
-LIBM = @LIBM@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
diff --git a/libquadmath/configure b/libquadmath/configure
index 5bd9a070fdc..fd527458285 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -644,7 +644,6 @@  LIBQUAD_USE_SYMVER_GNU_FALSE
 LIBQUAD_USE_SYMVER_GNU_TRUE
 LIBQUAD_USE_SYMVER_FALSE
 LIBQUAD_USE_SYMVER_TRUE
-LIBM
 toolexeclibdir
 toolexecdir
 MAINT
@@ -10922,7 +10921,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10925 "configure"
+#line 10924 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11028,7 +11027,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11031 "configure"
+#line 11030 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12261,148 +12260,6 @@  esac
 
 
 
-LIBM=
-case $host in
-*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
-  # These system don't have libm, or don't need it
-  ;;
-*-ncr-sysv4.3*)
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5
-$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; }
-if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmw  $LIBS"
-if test x$gcc_no_link = xyes; then
-  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char _mwvalidcheckl ();
-int
-main ()
-{
-return _mwvalidcheckl ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_mw__mwvalidcheckl=yes
-else
-  ac_cv_lib_mw__mwvalidcheckl=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5
-$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; }
-if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then :
-  LIBM="-lmw"
-fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
-$as_echo_n "checking for cos in -lm... " >&6; }
-if ${ac_cv_lib_m_cos+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
-if test x$gcc_no_link = xyes; then
-  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char cos ();
-int
-main ()
-{
-return cos ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_m_cos=yes
-else
-  ac_cv_lib_m_cos=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
-$as_echo "$ac_cv_lib_m_cos" >&6; }
-if test "x$ac_cv_lib_m_cos" = xyes; then :
-  LIBM="$LIBM -lm"
-fi
-
-  ;;
-*)
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
-$as_echo_n "checking for cos in -lm... " >&6; }
-if ${ac_cv_lib_m_cos+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
-if test x$gcc_no_link = xyes; then
-  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char cos ();
-int
-main ()
-{
-return cos ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_m_cos=yes
-else
-  ac_cv_lib_m_cos=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
-$as_echo "$ac_cv_lib_m_cos" >&6; }
-if test "x$ac_cv_lib_m_cos" = xyes; then :
-  LIBM="-lm"
-fi
-
-  ;;
-esac
-
-
-
 for ac_header in fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index 94a3f2179e9..23ac3bae6e5 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -122,8 +122,6 @@  esac
 AC_SUBST(toolexecdir)
 AC_SUBST(toolexeclibdir)
 
-AC_CHECK_LIBM
-
 AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h)
 LIBQUAD_CHECK_MATH_H_SIGNGAM