From 96655cc4cc3942aa552f40cf22f2d3fa6d8b3704 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Mon, 7 Sep 2009 00:44:08 +0000 Subject: [PATCH] ChangeLog: * configure.ac (with-build-config): Document. Handle without. Handle missing argument. * configure: Rebuilt. config/ChangeLog: * bootstrap-debug-big.mk (STAGE2_CFLAGS): Drop -gtoggle. * bootstrap-debug-lean.mk: Update comments. (STAGE2_CFLAGS): Likewise. (do-compare): Don't override. ChangeLog: * configure.ac (with-build-config): Document. Handle without. Handle missing argument. * configure: Rebuilt. --- ChangeLog | 19 +++++++++++++ Makefile.in | 2 +- Makefile.tpl | 2 +- config/ChangeLog | 16 +++++++++++ config/bootstrap-debug-big.mk | 8 ++++++ config/bootstrap-debug-ckovw.mk | 16 +++++++++++ config/bootstrap-debug-lean.mk | 11 ++++++++ config/bootstrap-debug-lib.mk | 12 ++++++++ config/bootstrap-debug.mk | 12 +++++++- config/bootstrap-time.mk | 2 ++ configure | 50 +++++++++++++++++++++++++++++++-- configure.ac | 42 +++++++++++++++++++++++++-- 12 files changed, 183 insertions(+), 9 deletions(-) create mode 100644 config/bootstrap-debug-big.mk create mode 100644 config/bootstrap-debug-ckovw.mk create mode 100644 config/bootstrap-debug-lean.mk create mode 100644 config/bootstrap-debug-lib.mk create mode 100644 config/bootstrap-time.mk diff --git a/ChangeLog b/ChangeLog index 8742ef09663..d971a37e549 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2009-09-04 Alexandre Oliva + + * configure.ac (with-build-config): Document. Handle without. + Handle missing argument. + * configure: Rebuilt. + +2009-09-03 Alexandre Oliva + + * configure.ac (--with-build-config): New. Set BUILD_CONFIG. + Default to bootstrap-debug only if compare-debug works. + * configure: Rebuilt. + * Makefile.tpl: Make BUILD_CONFIG configure-configurable. + * Makefile.in: Rebuilt. + +2009-09-01 Alexandre Oliva + + * Makefile.tpl (BUILD_CONFIG): Default to bootstrap-debug. + * Makefile.in: Rebuilt. + 2009-09-02 Paolo Bonzini * Makefile.tpl (AWK): Fix typo. diff --git a/Makefile.in b/Makefile.in index 7e11774ac1a..044f849d0aa 100644 --- a/Makefile.in +++ b/Makefile.in @@ -771,7 +771,7 @@ EXTRA_GCC_FLAGS = \ GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) @if gcc -BUILD_CONFIG = +BUILD_CONFIG = @BUILD_CONFIG@ ifneq ($(BUILD_CONFIG),) include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk) endif diff --git a/Makefile.tpl b/Makefile.tpl index f12252b2c43..6c63d950fc6 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -619,7 +619,7 @@ EXTRA_GCC_FLAGS = \ GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) @if gcc -BUILD_CONFIG = +BUILD_CONFIG = @BUILD_CONFIG@ ifneq ($(BUILD_CONFIG),) include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk) endif diff --git a/config/ChangeLog b/config/ChangeLog index f45a3ccb294..ba8fd0011e6 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,19 @@ +2009-09-03 Alexandre Oliva + + * bootstrap-debug-big.mk (STAGE2_CFLAGS): Drop -gtoggle. + * bootstrap-debug-lean.mk: Update comments. + (STAGE2_CFLAGS): Likewise. + (do-compare): Don't override. + +2009-09-01 Alexandre Oliva + + * bootstrap-debug.mk: Add comments. + * bootstrap-debug-big.mk: New. + * bootstrap-debug-lean.mk: New. + * bootstrap-debug-ckovw.mk: Add comments. + * bootstrap-debug-lib.mk: Drop CFLAGS for stages. Use -g0 + for TFLAGS in stage1. Drop -fvar-tracking-assignments-toggle. + 2009-08-22 Ralf Wildenhues * override.m4 (_GCC_AUTOCONF_VERSION): Bump to 2.64. diff --git a/config/bootstrap-debug-big.mk b/config/bootstrap-debug-big.mk new file mode 100644 index 00000000000..855ddc2a642 --- /dev/null +++ b/config/bootstrap-debug-big.mk @@ -0,0 +1,8 @@ +# This BUILD_CONFIG option is a bit like bootstrap-debug-lean, but it +# trades space for speed: instead of recompiling programs during +# stage3, it generates dumps during stage2 and stage3, saving them all +# until the final compare. + +STAGE2_CFLAGS += -fdump-final-insns +STAGE3_CFLAGS += -fdump-final-insns +do-compare = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2 diff --git a/config/bootstrap-debug-ckovw.mk b/config/bootstrap-debug-ckovw.mk new file mode 100644 index 00000000000..909b9047fc2 --- /dev/null +++ b/config/bootstrap-debug-ckovw.mk @@ -0,0 +1,16 @@ +# This BUILD_CONFIG option is to be used along with +# bootstrap-debug-lean and bootstrap-debug-lib in a full bootstrap, to +# check that all host and target files are built with -fcompare-debug. + +# These arrange for a simple warning to be issued if -fcompare-debug +# is not given. +# BOOT_CFLAGS += -fcompare-debug="-w%n-fcompare-debug not overridden" +# TFLAGS += -fcompare-debug="-w%n-fcompare-debug not overridden" + +# GCC_COMPARE_DEBUG="-w%n-fcompare-debug not overridden"; + +FORCE_COMPARE_DEBUG = \ + GCC_COMPARE_DEBUG=$${GCC_COMPARE_DEBUG--fcompare-debug-not-overridden}; \ + export GCC_COMPARE_DEBUG; +POSTSTAGE1_HOST_EXPORTS += $(FORCE_COMPARE_DEBUG) +BASE_TARGET_EXPORTS += $(FORCE_COMPARE_DEBUG) diff --git a/config/bootstrap-debug-lean.mk b/config/bootstrap-debug-lean.mk new file mode 100644 index 00000000000..e215280b09f --- /dev/null +++ b/config/bootstrap-debug-lean.mk @@ -0,0 +1,11 @@ +# This BUILD_CONFIG option is a bit like bootstrap-debug, but rather +# than comparing stripped object files, it compares compiler internal +# state during stage3. Both can be used simultaneously. + +# This makes it slower than bootstrap-debug alone, for there's +# additional dumping and recompilation during stage3. +# bootstrap-debug-big can avoid the recompilation, if plenty of disk +# space is available. + +STAGE2_CFLAGS += -fcompare-debug= +STAGE3_CFLAGS += -fcompare-debug diff --git a/config/bootstrap-debug-lib.mk b/config/bootstrap-debug-lib.mk new file mode 100644 index 00000000000..32fdf4dd863 --- /dev/null +++ b/config/bootstrap-debug-lib.mk @@ -0,0 +1,12 @@ +# This BUILD_CONFIG option tests that target libraries built during +# stage3 would have generated the same executable code if they were +# compiled with -g0. + +# It uses -g0 rather than -gtoggle because -g is default on target +# library builds, and toggling it where it's supposed to be disabled +# breaks e.g. crtstuff on ppc. + +STAGE1_TFLAGS += -g0 -fcompare-debug= +STAGE2_TFLAGS += -fcompare-debug= +STAGE3_TFLAGS += -fcompare-debug=-g0 +do-compare = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2 diff --git a/config/bootstrap-debug.mk b/config/bootstrap-debug.mk index 521be824194..41389241c05 100644 --- a/config/bootstrap-debug.mk +++ b/config/bootstrap-debug.mk @@ -1,2 +1,12 @@ -STAGE2_CFLAGS += -g0 +# This BUILD_CONFIG option builds checks that toggling debug +# information generation doesn't affect the generated object code. + +# It is very lightweight: in addition to not performing any additional +# compilation (unlike bootstrap-debug-lean), it actually speeds up +# stage2, for no debug information is generated when compiling with +# the unoptimized stage1. + +# For more thorough testing, see bootstrap-debug-lean.mk + +STAGE2_CFLAGS += -gtoggle do-compare = $(SHELL) $(srcdir)/contrib/compare-debug $$f1 $$f2 diff --git a/config/bootstrap-time.mk b/config/bootstrap-time.mk new file mode 100644 index 00000000000..08a8dff912b --- /dev/null +++ b/config/bootstrap-time.mk @@ -0,0 +1,2 @@ +BOOT_CFLAGS += -time=$(shell pwd)/time.log +TFLAGS += -time=$(shell pwd)/time.log diff --git a/configure b/configure index e04c6b74751..3b6cd2d76dd 100755 --- a/configure +++ b/configure @@ -631,6 +631,7 @@ build_tooldir tooldir GCC_SHLIB_SUBDIR RPATH_ENVVAR +BUILD_CONFIG CXXFLAGS_FOR_TARGET CFLAGS_FOR_TARGET DEBUG_PREFIX_CFLAGS_FOR_TARGET @@ -768,6 +769,7 @@ enable_objc_gc with_build_sysroot with_debug_prefix_map enable_bootstrap +with_build_config enable_serial_configure with_build_time_tools enable_maintainer_mode @@ -1497,6 +1499,8 @@ Optional Packages: use sysroot as the system root during the build --with-debug-prefix-map='A=B C=D ...' map A to B, C to D ... in debug information +--with-build-config='NAME NAME2...' + Use config/NAME.mk build configuration --with-build-time-tools=PATH use given path to find target tools during the build @@ -6569,13 +6573,53 @@ $as_echo "$as_me: WARNING: trying to bootstrap a cross compiler" >&2;} esac # Adjust the toplevel makefile according to whether bootstrap was selected. -case "$enable_bootstrap" in +case $enable_bootstrap in yes) - bootstrap_suffix=bootstrap ;; + bootstrap_suffix=bootstrap + BUILD_CONFIG=bootstrap-debug + ;; no) - bootstrap_suffix=no-bootstrap ;; + bootstrap_suffix=no-bootstrap + BUILD_CONFIG= + ;; esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for default BUILD_CONFIG" >&5 +$as_echo_n "checking for default BUILD_CONFIG... " >&6; } + + +# Check whether --with-build-config was given. +if test "${with_build_config+set}" = set; then : + withval=$with_build_config; case $with_build_config in + yes) with_build_config= ;; + no) with_build_config= BUILD_CONFIG= ;; + esac +fi + + +if test "x${with_build_config}" != x; then + BUILD_CONFIG=$with_build_config +else + case $BUILD_CONFIG in + bootstrap-debug) + if echo "int f (void) { return 0; }" > conftest.c && + ${CC} -c conftest.c && + mv conftest.o conftest.o.g0 && + ${CC} -c -g conftest.c && + mv conftest.o conftest.o.g && + ${srcdir}/contrib/compare-debug conftest.o.g0 conftest.o.g; then + : + else + BUILD_CONFIG= + fi + rm -f conftest.c conftest.o conftest.o.g0 conftest.o.g + ;; + esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_CONFIG" >&5 +$as_echo "$BUILD_CONFIG" >&6; } + + for module in ${build_configdirs} ; do if test -z "${no_recursion}" \ && test -f ${build_subdir}/${module}/Makefile; then diff --git a/configure.ac b/configure.ac index 48fa58019ed..592a8e3b629 100644 --- a/configure.ac +++ b/configure.ac @@ -2459,13 +2459,49 @@ case "$have_compiler:$host:$target:$enable_bootstrap" in esac # Adjust the toplevel makefile according to whether bootstrap was selected. -case "$enable_bootstrap" in +case $enable_bootstrap in yes) - bootstrap_suffix=bootstrap ;; + bootstrap_suffix=bootstrap + BUILD_CONFIG=bootstrap-debug + ;; no) - bootstrap_suffix=no-bootstrap ;; + bootstrap_suffix=no-bootstrap + BUILD_CONFIG= + ;; esac +AC_MSG_CHECKING(for default BUILD_CONFIG) + +AC_ARG_WITH([build-config], + [--with-build-config='NAME NAME2...' + Use config/NAME.mk build configuration], + [case $with_build_config in + yes) with_build_config= ;; + no) with_build_config= BUILD_CONFIG= ;; + esac]) + +if test "x${with_build_config}" != x; then + BUILD_CONFIG=$with_build_config +else + case $BUILD_CONFIG in + bootstrap-debug) + if echo "int f (void) { return 0; }" > conftest.c && + ${CC} -c conftest.c && + mv conftest.o conftest.o.g0 && + ${CC} -c -g conftest.c && + mv conftest.o conftest.o.g && + ${srcdir}/contrib/compare-debug conftest.o.g0 conftest.o.g; then + : + else + BUILD_CONFIG= + fi + rm -f conftest.c conftest.o conftest.o.g0 conftest.o.g + ;; + esac +fi +AC_MSG_RESULT($BUILD_CONFIG) +AC_SUBST(BUILD_CONFIG) + for module in ${build_configdirs} ; do if test -z "${no_recursion}" \ && test -f ${build_subdir}/${module}/Makefile; then -- 2.30.2