[PR build/24886] disable glibc mcheck support
authorFrank Ch. Eigler <fche@redhat.com>
Tue, 6 Aug 2019 15:23:48 +0000 (11:23 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Tue, 6 Aug 2019 19:09:53 +0000 (15:09 -0400)
This patch drops gdb's configury support for glibc's mcheck function.
It has been observed to cause false abort()s, because it is
thread-unsafe yet interposes every malloc/free operation.  So if any
library transitively used by gdb also uses threads, then these
functions can easily corrupt their own checking data.  These days, gcc
ASAN and valgrind provide high quality checking, and mcheck is
apparently itself being slowly deprecated.

So, let's stop linking to it.  Attached patch drops the
autoconf/Makefile machinery for both gdb and gdbserver.  No
testsuite-visible impact.  IMHO not worth mentioning in NEWS.

See also: https://sourceware.org/bugzilla/show_bug.cgi?id=9939

gdb/ChangeLog

        PR build/24886
        * configure.ac: Drop enable-libmcheck support.
        * configure, config.in: Rebuild.
        * libmcheck.m4: Remove.
        * acinclude.m4: Don't include it.
        * Makefile.in: Don't distribute it.
        * top.c (print_gdb_configuration): Don't mention it.

gdb/gdbserver/ChangeLog

        PR build/24886
        * configure.ac: Drop enable-libmcheck support.
        * configure, config.in: Rebuild.
        * acinclude.m4: Don't include it.

13 files changed:
gdb/ChangeLog
gdb/Makefile.in
gdb/acinclude.m4
gdb/config.in
gdb/configure
gdb/configure.ac
gdb/gdbserver/ChangeLog
gdb/gdbserver/acinclude.m4
gdb/gdbserver/config.in
gdb/gdbserver/configure
gdb/gdbserver/configure.ac
gdb/libmcheck.m4 [deleted file]
gdb/top.c

index 57ca368352aa02b02b4c4629dc87ef9bb5520bd5..974cca4c524d53c0fdbcdf28b5d0bf06548808be 100644 (file)
@@ -1,3 +1,13 @@
+2019-08-06  Frank Ch. Eigler  <fche@redhat.com>
+
+       PR build/24886
+       * configure.ac: Drop enable-libmcheck support.
+       * configure, config.in: Rebuild.
+       * libmcheck.m4: Remove.
+       * acinclude.m4: Don't include it.
+       * Makefile.in: Don't distribute it.
+       * top.c (print_gdb_configuration): Don't mention it.
+
 2019-08-06  Tom Tromey  <tom@tromey.com>
 
        * utils.c (set_output_style): Sometimes pass stream to
index 01ff0c0c20306547f26bce67309c700394b4729a..044627a073343c455c6ba4dbf5dd51bebbc21fca 100644 (file)
@@ -2044,7 +2044,6 @@ ACLOCAL_AMFLAGS = -I ../config
 aclocal_m4_deps = \
        configure.ac \
        acx_configure_dir.m4 \
-       libmcheck.m4 \
        transform.m4 \
        ../bfd/bfd.m4 \
        ../config/acinclude.m4 \
index b32dcf58c25391f8d329c571a1485837e1c32838..6e81aaed3bf442348b3b18f229d7cf01d62b2722 100644 (file)
@@ -6,9 +6,6 @@ dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
 
 sinclude(acx_configure_dir.m4)
 
-# This gets GDB_AC_LIBMCHECK.
-sinclude(libmcheck.m4)
-
 # This gets GDB_AC_TRANSFORM.
 sinclude(transform.m4)
 
index c0291fbd9c53f48594516e6201b78040a8343979..26ca02f6a3e88fae91ed00e8ad1b79b6b68d2473 100644 (file)
 /* Define to 1 if you have the `m' library (-lm). */
 #undef HAVE_LIBM
 
-/* Define to 1 if you have the `mcheck' library (-lmcheck). */
-#undef HAVE_LIBMCHECK
-
 /* Define if you have the mpfr library. */
 #undef HAVE_LIBMPFR
 
index 12954d1f74ae570b2bba27ecf1ff70b3ea1ae820..9206f0e7f887d5100b4f5358bdbf68f9a19b5495 100755 (executable)
@@ -879,7 +879,6 @@ with_libmpfr_prefix
 with_python
 with_guile
 enable_source_highlight
-enable_libmcheck
 with_intel_pt
 with_libipt_prefix
 with_included_regex
@@ -1556,7 +1555,6 @@ Optional Features:
   --disable-rpath         do not hardcode runtime library paths
   --enable-source-highlight
                           enable source-highlight for source listings
-  --enable-libmcheck      Try linking with -lmcheck if available
   --enable-werror         treat compile warnings as errors
   --enable-build-warnings enable build-time compiler warnings if gcc is used
   --enable-gdb-build-warnings
 
 
 
-# --------------------- #
-# Check for libmcheck.  #
-# --------------------- #
-
-# Enable -lmcheck by default (it provides cheap-enough memory mangling),
-# but turn it off if Python is enabled with threads, since -lmcheck is
-# not thread safe (http://sourceware.org/bugzilla/show_bug.cgi?id=9939),
-# and for releases.
-if test \( "${have_libpython}" = "no" -o "${python_has_threads}" = "no" \) \
-   && $development; then
-  libmcheck_default=yes
-else
-  libmcheck_default=no
-fi
-
-  # Check whether --enable-libmcheck was given.
-if test "${enable_libmcheck+set}" = set; then :
-  enableval=$enable_libmcheck; case "${enableval}" in
-      yes | y) ENABLE_LIBMCHECK="yes" ;;
-      no | n)  ENABLE_LIBMCHECK="no" ;;
-      *) as_fn_error $? "bad value ${enableval} for --enable-libmcheck" "$LINENO" 5 ;;
-    esac
-fi
-
-
-  if test -z "${ENABLE_LIBMCHECK}"; then
-    ENABLE_LIBMCHECK=${libmcheck_default}
-  fi
-
-  if test "$ENABLE_LIBMCHECK" = "yes" ; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lmcheck" >&5
-$as_echo_n "checking for main in -lmcheck... " >&6; }
-if ${ac_cv_lib_mcheck_main+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmcheck  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-return main ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_mcheck_main=yes
-else
-  ac_cv_lib_mcheck_main=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_mcheck_main" >&5
-$as_echo "$ac_cv_lib_mcheck_main" >&6; }
-if test "x$ac_cv_lib_mcheck_main" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBMCHECK 1
-_ACEOF
-
-  LIBS="-lmcheck $LIBS"
-
-fi
-
-  fi
-
-
-if test "$ENABLE_LIBMCHECK" = "yes" \
-       -a "${have_libpython}" != "no" \
-       -a "${python_has_threads}" = "yes" ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-libmcheck may lead to spurious crashes if threads are used in python" >&5
-$as_echo "$as_me: WARNING: --enable-libmcheck may lead to spurious crashes if threads are used in python" >&2;}
-fi
-
 
 # Check whether --with-intel_pt was given.
 if test "${with_intel_pt+set}" = set; then :
index 2a43d12df761aa445ba086a8797e69f19c2daa2d..05b722b7f11a163e3936e0482e26c65d8bd3cb93 100644 (file)
@@ -1234,28 +1234,6 @@ fi
 AC_SUBST(SRCHIGH_LIBS)
 AC_SUBST(SRCHIGH_CFLAGS)
 
-# --------------------- #
-# Check for libmcheck.  #
-# --------------------- #
-
-# Enable -lmcheck by default (it provides cheap-enough memory mangling),
-# but turn it off if Python is enabled with threads, since -lmcheck is
-# not thread safe (http://sourceware.org/bugzilla/show_bug.cgi?id=9939),
-# and for releases.
-if test \( "${have_libpython}" = "no" -o "${python_has_threads}" = "no" \) \
-   && $development; then
-  libmcheck_default=yes
-else
-  libmcheck_default=no
-fi
-GDB_AC_LIBMCHECK(${libmcheck_default})
-
-if test "$ENABLE_LIBMCHECK" = "yes" \
-       -a "${have_libpython}" != "no" \
-       -a "${python_has_threads}" = "yes" ; then
-  AC_MSG_WARN(--enable-libmcheck may lead to spurious crashes if threads are used in python)
-fi
-
 AC_ARG_WITH(intel_pt,
   AS_HELP_STRING([--with-intel-pt], [include Intel Processor Trace support (auto/yes/no)]),
   [], [with_intel_pt=auto])
index a7dccf5b94f25090bf306b17f982f7ed13739d55..2dda3521ec9fbd9bc01bab4f5dd804ecd4cabf10 100644 (file)
@@ -1,3 +1,10 @@
+2019-08-06  Frank Ch. Eigler  <fche@redhat.com>
+
+       PR build/24886
+       * configure.ac: Drop enable-libmcheck support.
+       * configure, config.in: Rebuild.
+       * acinclude.m4: Don't include it.
+
 2019-07-19  Alan Hayward  <alan.hayward@arm.com>
 
        * configure.srv: Remove Arm xml files.
index 96ded3d7d3900e84a9612ed8e7e3e55522c32c9a..3887b165c66cc382e2da59691532059e4d62aa29 100644 (file)
@@ -3,9 +3,6 @@ sinclude(../../bfd/bfd.m4)
 
 sinclude(../acx_configure_dir.m4)
 
-# This gets GDB_AC_LIBMCHECK.
-sinclude(../libmcheck.m4)
-
 # This gets AM_GDB_WARNINGS.
 sinclude(../warning.m4)
 
index 05537df81e3796aad695b0b418a58dbf02a6bf7e..3991964f9bd55d608672906f633997ca7e9ba5da 100644 (file)
 /* Define to 1 if you have the `dl' library (-ldl). */
 #undef HAVE_LIBDL
 
-/* Define to 1 if you have the `mcheck' library (-lmcheck). */
-#undef HAVE_LIBMCHECK
-
 /* Define if the target supports branch tracing. */
 #undef HAVE_LINUX_BTRACE
 
index 0c04fcc8ae6a52b51cce6fd457788493692cd60e..7e5be51cb281f960be3284d7dac6b49bc1d14206 100755 (executable)
@@ -721,7 +721,6 @@ ac_user_opts='
 enable_option_checking
 enable_maintainer_mode
 enable_largefile
-enable_libmcheck
 enable_unit_tests
 with_ust
 with_ust_include
@@ -1367,7 +1366,6 @@ Optional Features:
                           enable make rules and dependencies not useful (and
                           sometimes confusing) to the casual installer
   --disable-largefile     omit support for large files
-  --enable-libmcheck      Try linking with -lmcheck if available
   --enable-unit-tests     Enable the inclusion of unit tests when compiling
                           GDB
   --enable-werror         treat compile warnings as errors
@@ -1756,52 +1754,6 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_header_compile
 
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        test -x conftest$ac_exeext
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_retval=1
-fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_link
-
 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
 # -------------------------------------------
 # Tests whether TYPE exists after having included INCLUDES, setting cache
@@ -1856,6 +1808,52 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_type
 
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        test -x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
 # ac_fn_c_check_func LINENO FUNC VAR
 # ----------------------------------
 # Tests whether FUNC exists, setting the cache variable VAR accordingly
@@ -5827,71 +5825,6 @@ fi
 # Set the 'development' global.
 . $srcdir/../../bfd/development.sh
 
-# Enable -lmcheck by default (it provides cheap-enough memory
-# mangling), but turn it off for releases.
-if $development; then
-  libmcheck_default=yes
-else
-  libmcheck_default=no
-fi
-
-  # Check whether --enable-libmcheck was given.
-if test "${enable_libmcheck+set}" = set; then :
-  enableval=$enable_libmcheck; case "${enableval}" in
-      yes | y) ENABLE_LIBMCHECK="yes" ;;
-      no | n)  ENABLE_LIBMCHECK="no" ;;
-      *) as_fn_error $? "bad value ${enableval} for --enable-libmcheck" "$LINENO" 5 ;;
-    esac
-fi
-
-
-  if test -z "${ENABLE_LIBMCHECK}"; then
-    ENABLE_LIBMCHECK=${libmcheck_default}
-  fi
-
-  if test "$ENABLE_LIBMCHECK" = "yes" ; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lmcheck" >&5
-$as_echo_n "checking for main in -lmcheck... " >&6; }
-if ${ac_cv_lib_mcheck_main+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmcheck  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-return main ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_mcheck_main=yes
-else
-  ac_cv_lib_mcheck_main=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_mcheck_main" >&5
-$as_echo "$ac_cv_lib_mcheck_main" >&6; }
-if test "x$ac_cv_lib_mcheck_main" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBMCHECK 1
-_ACEOF
-
-  LIBS="-lmcheck $LIBS"
-
-fi
-
-  fi
-
-
 
 # Check whether we will enable the inclusion of unit tests when
 # compiling GDB.
index 574b7c5b287917575a632baa7dd27700f65b90b7..0009aac9f207197a685330c6bf643d682f8121b4 100644 (file)
@@ -45,15 +45,6 @@ AC_HEADER_STDC
 # Set the 'development' global.
 . $srcdir/../../bfd/development.sh
 
-# Enable -lmcheck by default (it provides cheap-enough memory
-# mangling), but turn it off for releases.
-if $development; then
-  libmcheck_default=yes
-else
-  libmcheck_default=no
-fi
-GDB_AC_LIBMCHECK(${libmcheck_default})
-
 GDB_AC_SELFTEST([
   srv_selftest_objs="gdbsupport/selftest.o"
 ])
diff --git a/gdb/libmcheck.m4 b/gdb/libmcheck.m4
deleted file mode 100644 (file)
index 692a5c8..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
-dnl
-dnl This file is part of GDB.
-dnl
-dnl This program is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 3 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-dnl GDB_AC_LIBMCHECK([DEFAULT])
-dnl Provide an --enable-libmcheck/--disable-libmcheck set of options
-dnl allowing a user to enable this option even when building releases,
-dnl or to disable it when building a snapshot.
-dnl DEFAULT (yes/no) is used as default if the user doesn't set
-dnl the option explicitly.
-
-AC_DEFUN([GDB_AC_LIBMCHECK],
-[
-  AC_ARG_ENABLE(libmcheck,
-    AS_HELP_STRING([--enable-libmcheck],
-                  [Try linking with -lmcheck if available]),
-    [case "${enableval}" in
-      yes | y) ENABLE_LIBMCHECK="yes" ;;
-      no | n)  ENABLE_LIBMCHECK="no" ;;
-      *) AC_MSG_ERROR(bad value ${enableval} for --enable-libmcheck) ;;
-    esac])
-
-  if test -z "${ENABLE_LIBMCHECK}"; then
-    ENABLE_LIBMCHECK=[$1]
-  fi
-
-  if test "$ENABLE_LIBMCHECK" = "yes" ; then
-    AC_CHECK_LIB(mcheck, main)
-  fi
-])
index 60f81b3bf85416c3f48201666095e40297d3effe..a9f9a384f7e1ecc1f2f8dfad2289b795754c2f19 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1462,15 +1462,6 @@ This GDB was configured as follows:\n\
              --without-intel-pt\n\
 "));
 #endif
-#if HAVE_LIBMCHECK
-    fprintf_filtered (stream, _("\
-             --enable-libmcheck\n\
-"));
-#else
-    fprintf_filtered (stream, _("\
-             --disable-libmcheck\n\
-"));
-#endif
 #if HAVE_LIBMPFR
     fprintf_filtered (stream, _("\
              --with-mpfr\n\
This page took 0.052442 seconds and 4 git commands to generate.