This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[RFC patch] non-release srctrees: --enable-targets=all & 64bit & -lmcheck
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: binutils at sourceware dot org
- Date: Fri, 18 May 2012 23:14:10 +0200
- Subject: [RFC patch] non-release srctrees: --enable-targets=all & 64bit & -lmcheck
Hi,
--enable-targets=all commonly discovers checked in regressions:
http://sourceware.org/ml/binutils/2012-05/msg00271.html
http://sourceware.org/ml/gdb-patches/2012-05/msg00548.html
http://sourceware.org/ml/gdb-patches/2012-05/msg00003.html
http://sourceware.org/ml/gdb-patches/2012-03/msg00279.html
http://sourceware.org/ml/gdb-patches/2011-03/msg00600.html
(many more, I did not search too thoroughly)
--enable-64-bit-bfd is required for full --enable-targets=all.
-lmcheck is cheap enough to never be noticed and it also finds checked in
regressions:
http://sourceware.org/ml/gdb-patches/2012-03/msg00589.html
http://sourceware.org/ml/gdb-patches/2012-02/msg00612.html
(many more, I did not search too thoroughly)
As Joel already turns off -Werror (for gdb/) for release branches it could be
just extended for more options. (This patch requires running autoconf in
bfd/, opcodes/ and gdb/ after changing config/development.m4.)
Unfortuntely this patch cannot be limited only to gdb/ :
-lmcheck could be applied also for ld/, gold/, gas/, gprof/ and binutils/.
I have been targeting only gdb/ and its pre-requisites so far.
Thanks,
Jan
bfd/
2012-05-18 Jan Kratochvil <jan.kratochvil@redhat.com>
* acinclude.m4: Include ../config/development.m4.
* configure: Regenerate.
* configure.in: Call ACX_DEVELOPMENT.
(want64): Default it to $development.
(enable_targets): Default it to all for $development.
config/
2012-05-18 Jan Kratochvil <jan.kratochvil@redhat.com>
* development.m4: New file.
gdb/
2012-05-18 Jan Kratochvil <jan.kratochvil@redhat.com>
* acinclude.m4: Include ../config/development.m4.
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Call ACX_DEVELOPMENT.
(enable_targets): Default it to all for $development.
(want64): Default it to $development.
Call AC_CHECK_LIB for mcheck if $development.
(ERROR_ON_WARNING): Enable it by default only if $development.
opcodes/
2012-05-18 Jan Kratochvil <jan.kratochvil@redhat.com>
* configure: Regenerate.
* configure.ac: Call ACX_DEVELOPMENT.
(enable_targets): Default it to all for $development.
diff --git a/bfd/acinclude.m4 b/bfd/acinclude.m4
index d9813bd..6738978 100644
--- a/bfd/acinclude.m4
+++ b/bfd/acinclude.m4
@@ -1,4 +1,5 @@
sinclude([../config/zlib.m4])
+sinclude([../config/development.m4])
dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
AC_DEFUN([BFD_BINARY_FOPEN],
diff --git a/bfd/configure.in b/bfd/configure.in
index 9e72c7a..1a5612d 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -27,6 +27,7 @@ LT_INIT([dlopen])
# AC_PLUGINS setting $plugins is called by ACX_LARGEFILE.
ACX_LARGEFILE
+ACX_DEVELOPMENT
AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes")
@@ -44,7 +45,7 @@ AC_ARG_ENABLE(64-bit-bfd,
yes) want64=true ;;
no) want64=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
-esac],[want64=false])dnl
+esac],[want64=$development])dnl
AC_ARG_ENABLE(targets,
[ --enable-targets alternative target configurations],
@@ -53,7 +54,12 @@ AC_ARG_ENABLE(targets,
;;
no) enable_targets= ;;
*) enable_targets=$enableval ;;
-esac])dnl
+esac],
+[if $development; then
+ enable_targets=all
+ else
+ enable_targets=
+ fi])
AC_ARG_WITH(mmap,
[ --with-mmap try using mmap for BFD input files if available],
diff --git a/config/development.m4 b/config/development.m4
new file mode 100644
index 0000000..2d74cd3
--- /dev/null
+++ b/config/development.m4
@@ -0,0 +1,15 @@
+dnl Copyright (C) 2012 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl Provide more thorough testing such as --enable-targets=all
+dnl Set to 'true' for development snapshots, 'false' for releases or
+dnl pre-releases.
+
+AC_DEFUN([ACX_DEVELOPMENT],
+[
+ development=true
+])
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 9d231e1..ba6679a 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -35,6 +35,7 @@ dnl For AM_LANGINFO_CODESET.
sinclude([../config/codeset.m4])
sinclude([../config/zlib.m4])
+sinclude([../config/development.m4])
#
# Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 6433bf9..7d6cedc 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -26,6 +26,7 @@ AM_MAINTAINER_MODE
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
ACX_LARGEFILE
+ACX_DEVELOPMENT
AM_PROG_CC_STDC
AC_CONFIG_AUX_DIR(..)
@@ -171,7 +172,12 @@ AS_HELP_STRING([--enable-targets=TARGETS], [alternative target configurations]),
;;
no) enable_targets= ;;
*) enable_targets=$enableval ;;
-esac])
+esac],
+[if $development; then
+ enable_targets=all
+ else
+ enable_targets=
+ fi])
# Check whether to enable 64-bit support on 32-bit hosts
AC_ARG_ENABLE(64-bit-bfd,
@@ -180,7 +186,7 @@ AS_HELP_STRING([--enable-64-bit-bfd], [64-bit support (on hosts with narrower wo
yes) want64=true ;;
no) want64=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
-esac],[want64=false])dnl
+esac],[want64=$development])dnl
# Provide defaults for some variables set by the per-host and per-target
# configuration.
@@ -640,6 +646,11 @@ AC_SUBST(READLINE_DEPS)
AC_SUBST(READLINE_CFLAGS)
AC_SUBST(READLINE_TEXI_INCFLAG)
+dnl -lmcheck provides cheap enough memory mangling for debugging purposes.
+if $development; then
+ AC_CHECK_LIB(mcheck, main)
+fi
+
# Generate jit-reader.h
# This is typedeffed to GDB_CORE_ADDR in jit-reader.h
@@ -1822,8 +1833,8 @@ AC_ARG_ENABLE(werror,
*) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
esac])
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc. Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
ERROR_ON_WARNING=yes
fi
diff --git a/opcodes/configure.in b/opcodes/configure.in
index dadfe4a..f818abe 100644
--- a/opcodes/configure.in
+++ b/opcodes/configure.in
@@ -20,6 +20,7 @@ AM_INIT_AUTOMAKE(opcodes, ${BFD_VERSION})
AC_PROG_CC
AC_GNU_SOURCE
AC_USE_SYSTEM_EXTENSIONS
+ACX_DEVELOPMENT
dnl These must be called before LT_INIT, because it may want
dnl to call AC_CHECK_PROG.
@@ -39,7 +40,12 @@ AC_ARG_ENABLE(targets,
;;
no) enable_targets= ;;
*) enable_targets=$enableval ;;
-esac])dnl
+esac],
+[if $development; then
+ enable_targets=all
+ else
+ enable_targets=
+ fi])
AM_BINUTILS_WARNINGS
diff --git a/bfd/configure b/bfd/configure
index fe51170..b154e25 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -11985,6 +11985,9 @@ fi
+ development=true
+
+
if test "$plugins" = "yes"; then
PLUGINS_TRUE=
PLUGINS_FALSE='#'
@@ -12010,7 +12013,7 @@ if test "${enable_64_bit_bfd+set}" = set; then :
*) as_fn_error "bad value ${enableval} for 64-bit-bfd option" "$LINENO" 5 ;;
esac
else
- want64=false
+ want64=$development
fi
# Check whether --enable-targets was given.
@@ -12021,9 +12024,16 @@ if test "${enable_targets+set}" = set; then :
no) enable_targets= ;;
*) enable_targets=$enableval ;;
esac
+else
+ if $development; then
+ enable_targets=all
+ else
+ enable_targets=
+ fi
fi
+
# Check whether --with-mmap was given.
if test "${with_mmap+set}" = set; then :
withval=$with_mmap; case "${withval}" in
diff --git a/gdb/config.in b/gdb/config.in
index a3bd8dd..5767773 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -201,6 +201,9 @@
/* 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 Python 2.4 is being used. */
#undef HAVE_LIBPYTHON2_4
diff --git a/gdb/configure b/gdb/configure
index de746e8..fca12f1 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -4277,6 +4277,9 @@ fi
+ development=true
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${CC-cc} option to accept ANSI C" >&5
@@ -5029,6 +5032,12 @@ if test "${enable_targets+set}" = set; then :
no) enable_targets= ;;
*) enable_targets=$enableval ;;
esac
+else
+ if $development; then
+ enable_targets=all
+ else
+ enable_targets=
+ fi
fi
@@ -5041,7 +5050,7 @@ if test "${enable_64_bit_bfd+set}" = set; then :
*) as_fn_error "bad value ${enableval} for 64-bit-bfd option" "$LINENO" 5 ;;
esac
else
- want64=false
+ want64=$development
fi
# Provide defaults for some variables set by the per-host and per-target
@@ -7034,6 +7043,48 @@ fi
+if $development; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lmcheck" >&5
+$as_echo_n "checking for main in -lmcheck... " >&6; }
+if test "${ac_cv_lib_mcheck_main+set}" = set; 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" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBMCHECK 1
+_ACEOF
+
+ LIBS="-lmcheck $LIBS"
+
+fi
+
+fi
+
# Generate jit-reader.h
# This is typedeffed to GDB_CORE_ADDR in jit-reader.h
@@ -12300,8 +12351,8 @@ if test "${enable_werror+set}" = set; then :
fi
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc. Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
ERROR_ON_WARNING=yes
fi
diff --git a/opcodes/configure b/opcodes/configure
index dbfca48..f820379 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -4887,6 +4887,9 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+ development=true
+
+
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
@@ -11134,7 +11137,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11137 "configure"
+#line 11140 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11240,7 +11243,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11243 "configure"
+#line 11246 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11486,9 +11489,16 @@ if test "${enable_targets+set}" = set; then :
no) enable_targets= ;;
*) enable_targets=$enableval ;;
esac
+else
+ if $development; then
+ enable_targets=all
+ else
+ enable_targets=
+ fi
fi
+
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */