From 45eb54c870df94805d8e71525fd30844137905cf Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 8 Apr 2015 12:06:29 -0700 Subject: [PATCH 01/11] configure: Remove obsolete --nightly flag --- configure | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/configure b/configure index ef474fcf79d..8c190a6f42b 100755 --- a/configure +++ b/configure @@ -1,4 +1,4 @@ -#!/bin/sh +<#!/bin/sh msg() { echo "configure: $1" @@ -540,7 +540,6 @@ opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds" opt local-rust 0 "use an installed rustc rather than downloading a snapshot" opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM" opt rpath 0 "build rpaths into rustc itself" -opt nightly 0 "build nightly packages" opt verify-install 1 "verify installed binaries work" # This is used by the automation to produce single-target nightlies opt dist-host-only 0 "only install bins for the host architecture" @@ -556,6 +555,7 @@ valopt llvm-root "" "set LLVM root" valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located" valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple" valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path" +valopt release-channel "dev" "the name of the release channel to build" # Many of these are saved below during the "writing configuration" step # (others are conditionally saved). @@ -568,7 +568,6 @@ valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary" valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples" valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples" valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH" -valopt_nosave release-channel "dev" "the name of the release channel to build" # Temporarily support old triples until buildbots get updated CFG_BUILD=$(to_llvm_triple $CFG_BUILD) @@ -621,14 +620,6 @@ case "$CFG_RELEASE_CHANNEL" in ;; esac -# Continue supporting the old --enable-nightly flag to transition the bots -# XXX Remove me -if [ ! -z "$CFG_ENABLE_NIGHTLY" ] -then - CFG_RELEASE_CHANNEL=nightly -fi -putvar CFG_RELEASE_CHANNEL - # A magic value that allows the compiler to use unstable features # during the bootstrap even when doing so would normally be an error # because of feature staging or because the build turns on From bc9f16c59960cfb306178428956f8446337d27e7 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 8 Apr 2015 12:16:45 -0700 Subject: [PATCH 02/11] configure: Remove obsolete --disable-verify option rust-installer never verifies. --- configure | 1 - mk/install.mk | 10 ++-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 8c190a6f42b..51e9ad7d88e 100755 --- a/configure +++ b/configure @@ -540,7 +540,6 @@ opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds" opt local-rust 0 "use an installed rustc rather than downloading a snapshot" opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM" opt rpath 0 "build rpaths into rustc itself" -opt verify-install 1 "verify installed binaries work" # This is used by the automation to produce single-target nightlies opt dist-host-only 0 "only install bins for the host architecture" opt inject-std-version 1 "inject the current compiler version of libstd into programs" diff --git a/mk/install.mk b/mk/install.mk index 8850cd77803..cabc97a1e49 100644 --- a/mk/install.mk +++ b/mk/install.mk @@ -8,12 +8,6 @@ # option. This file may not be copied, modified, or distributed # except according to those terms. -ifdef CFG_DISABLE_VERIFY_INSTALL -MAYBE_DISABLE_VERIFY=--disable-verify -else -MAYBE_DISABLE_VERIFY= -endif - install: ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER))) # Build the dist as the original user @@ -22,9 +16,9 @@ else $(Q)$(MAKE) prepare_install endif ifeq ($(CFG_DISABLE_DOCS),) - $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" + $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" endif - $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" + $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" # Remove tmp files because it's a decent amount of disk space $(Q)rm -R tmp/dist From ed8eebd99b65c54d95ce4302ddff1633ed96549b Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 8 Apr 2015 13:17:46 -0700 Subject: [PATCH 03/11] configure: Rename --enable-debug to --enable-debug-assertions --- configure | 4 ++-- mk/main.mk | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 51e9ad7d88e..6564c8c26e4 100755 --- a/configure +++ b/configure @@ -1,4 +1,4 @@ -<#!/bin/sh +#!/bin/sh msg() { echo "configure: $1" @@ -534,7 +534,7 @@ opt optimize-llvm 1 "build optimized LLVM" opt optimize-tests 1 "build tests with optimizations" opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang" opt llvm-assertions 1 "build LLVM with assertions" -opt debug 1 "build with extra debug fun" +opt debug-assertions 1 "build with extra debug fun" opt fast-make 0 "use .gitmodules as timestamp for submodule deps" opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds" opt local-rust 0 "use an installed rustc rather than downloading a snapshot" diff --git a/mk/main.mk b/mk/main.mk index b9f2cf1cce8..4428dcc43c8 100644 --- a/mk/main.mk +++ b/mk/main.mk @@ -126,10 +126,10 @@ endif CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS) -ifdef CFG_DISABLE_DEBUG +ifdef CFG_DISABLE_DEBUG_ASSERTIONS CFG_RUSTC_FLAGS += --cfg ndebug else - $(info cfg: enabling more debugging (CFG_ENABLE_DEBUG)) + $(info cfg: enabling more debugging (CFG_ENABLE_DEBUG_ASSERTIONS)) CFG_RUSTC_FLAGS += --cfg debug -C debug-assertions=on endif From 59e332bd2f3cd448b3976b919caeebede15a9694 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 8 Apr 2015 13:23:44 -0700 Subject: [PATCH 04/11] configure: Disable debug assertions by default --- configure | 2 +- mk/main.mk | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 6564c8c26e4..b301ad73c81 100755 --- a/configure +++ b/configure @@ -534,7 +534,7 @@ opt optimize-llvm 1 "build optimized LLVM" opt optimize-tests 1 "build tests with optimizations" opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang" opt llvm-assertions 1 "build LLVM with assertions" -opt debug-assertions 1 "build with extra debug fun" +opt debug-assertions 0 "build with extra debug fun" opt fast-make 0 "use .gitmodules as timestamp for submodule deps" opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds" opt local-rust 0 "use an installed rustc rather than downloading a snapshot" diff --git a/mk/main.mk b/mk/main.mk index 4428dcc43c8..0c80c3f84f0 100644 --- a/mk/main.mk +++ b/mk/main.mk @@ -126,11 +126,11 @@ endif CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS) -ifdef CFG_DISABLE_DEBUG_ASSERTIONS - CFG_RUSTC_FLAGS += --cfg ndebug -else +ifdef CFG_ENABLE_DEBUG_ASSERTIONS $(info cfg: enabling more debugging (CFG_ENABLE_DEBUG_ASSERTIONS)) CFG_RUSTC_FLAGS += --cfg debug -C debug-assertions=on +else + CFG_RUSTC_FLAGS += --cfg ndebug endif ifdef SAVE_TEMPS From 2cdfd372e2565a35374977da5c20ce6069c4aa41 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 8 Apr 2015 13:25:20 -0700 Subject: [PATCH 05/11] configure: Clarify help message for --enable-debug-assertions --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index b301ad73c81..9ff1765775e 100755 --- a/configure +++ b/configure @@ -534,7 +534,7 @@ opt optimize-llvm 1 "build optimized LLVM" opt optimize-tests 1 "build tests with optimizations" opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang" opt llvm-assertions 1 "build LLVM with assertions" -opt debug-assertions 0 "build with extra debug fun" +opt debug-assertions 0 "build with debugging assertions" opt fast-make 0 "use .gitmodules as timestamp for submodule deps" opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds" opt local-rust 0 "use an installed rustc rather than downloading a snapshot" From 8545d2ce5358b7b04d8be4531cf8b0ffb9a2e794 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 8 Apr 2015 13:27:12 -0700 Subject: [PATCH 06/11] configure: Disable LLVM asserts by default --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 9ff1765775e..8620e1425d0 100755 --- a/configure +++ b/configure @@ -533,7 +533,7 @@ opt optimize-cxx 1 "build optimized C++ code" opt optimize-llvm 1 "build optimized LLVM" opt optimize-tests 1 "build tests with optimizations" opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang" -opt llvm-assertions 1 "build LLVM with assertions" +opt llvm-assertions 0 "build LLVM with assertions" opt debug-assertions 0 "build with debugging assertions" opt fast-make 0 "use .gitmodules as timestamp for submodule deps" opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds" @@ -1170,7 +1170,7 @@ do LLVM_DBG_OPTS="--enable-optimized" LLVM_INST_DIR=$LLVM_BUILD_DIR/Release fi - if [ ! -z "$CFG_DISABLE_LLVM_ASSERTIONS" ] + if [ -z "$CFG_ENABLE_LLVM_ASSERTIONS" ] then LLVM_ASSERTION_OPTS="--disable-assertions" else From 1b34f0aef0a843f4e5aa8b2d457162f9d58f52d8 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 8 Apr 2015 13:31:26 -0700 Subject: [PATCH 07/11] configure: Clarify --enable-debug-assertions status message --- mk/main.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/main.mk b/mk/main.mk index 0c80c3f84f0..98b9dda1251 100644 --- a/mk/main.mk +++ b/mk/main.mk @@ -127,7 +127,7 @@ endif CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS) ifdef CFG_ENABLE_DEBUG_ASSERTIONS - $(info cfg: enabling more debugging (CFG_ENABLE_DEBUG_ASSERTIONS)) + $(info cfg: enabling debug assertions (CFG_ENABLE_DEBUG_ASSERTIONS)) CFG_RUSTC_FLAGS += --cfg debug -C debug-assertions=on else CFG_RUSTC_FLAGS += --cfg ndebug From 7cbf8233539d74b9c6a3b1bdc67c66bfb9e0ce7e Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 8 Apr 2015 13:57:37 -0700 Subject: [PATCH 08/11] configure: Add --enable-debuginfo --- configure | 1 + mk/main.mk | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/configure b/configure index 8620e1425d0..3fe9d543c5d 100755 --- a/configure +++ b/configure @@ -535,6 +535,7 @@ opt optimize-tests 1 "build tests with optimizations" opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang" opt llvm-assertions 0 "build LLVM with assertions" opt debug-assertions 0 "build with debugging assertions" +opt debuginfo 0 "build with debugger metadata" opt fast-make 0 "use .gitmodules as timestamp for submodule deps" opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds" opt local-rust 0 "use an installed rustc rather than downloading a snapshot" diff --git a/mk/main.mk b/mk/main.mk index 98b9dda1251..ea00444453d 100644 --- a/mk/main.mk +++ b/mk/main.mk @@ -133,6 +133,11 @@ else CFG_RUSTC_FLAGS += --cfg ndebug endif +ifdef CFG_ENABLE_DEBUGINFO + $(info cfg: enabling debuginfo (CFG_ENABLE_DEBUGINFO)) + CFG_RUSTC_FLAGS += -g +endif + ifdef SAVE_TEMPS CFG_RUSTC_FLAGS += --save-temps endif From 1002155c755562b8932251b50dac149edf8c885b Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 8 Apr 2015 14:21:36 -0700 Subject: [PATCH 09/11] Add --enable-debug to control multiple perf options --- configure | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 3fe9d543c5d..4d2868ede5c 100755 --- a/configure +++ b/configure @@ -523,19 +523,16 @@ fi BOOL_OPTIONS="" VAL_OPTIONS="" +opt debug 0 "debug mode" opt valgrind 0 "run tests with valgrind (memcheck by default)" opt helgrind 0 "run tests with helgrind instead of memcheck" opt valgrind-rpass 1 "run rpass-valgrind tests with valgrind" opt docs 1 "build standard library documentation" opt compiler-docs 0 "build compiler documentation" -opt optimize 1 "build optimized rust code" -opt optimize-cxx 1 "build optimized C++ code" -opt optimize-llvm 1 "build optimized LLVM" opt optimize-tests 1 "build tests with optimizations" opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang" opt llvm-assertions 0 "build LLVM with assertions" opt debug-assertions 0 "build with debugging assertions" -opt debuginfo 0 "build with debugger metadata" opt fast-make 0 "use .gitmodules as timestamp for submodule deps" opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds" opt local-rust 0 "use an installed rustc rather than downloading a snapshot" @@ -546,6 +543,14 @@ opt dist-host-only 0 "only install bins for the host architecture" opt inject-std-version 1 "inject the current compiler version of libstd into programs" opt llvm-version-check 1 "don't check if the LLVM version is supported, build anyway" +# Optimization and debugging options. These may be overridden by the release channel, etc. +opt_nosave optimize 1 "build optimized rust code" +opt_nosave optimize-cxx 1 "build optimized C++ code" +opt_nosave optimize-llvm 1 "build optimized LLVM" +opt_nosave llvm-assertions 0 "build LLVM with assertions" +opt_nosave debug-assertions 0 "build with debugging assertions" +opt_nosave debuginfo 0 "build with debugger metadata" + valopt localstatedir "/var/lib" "local state directory" valopt sysconfdir "/etc" "install system configuration files" @@ -620,6 +625,24 @@ case "$CFG_RELEASE_CHANNEL" in ;; esac +# Adjust perf and debug options for debug mode +if [ -n "$CFG_ENABLE_DEBUG" ]; then + msg "debug mode enabled, setting performance options" + CFG_DISABLE_OPTIMIZE=1 + CFG_DISABLE_OPTIMIZE_CXX=1 + CFG_DISABLE_OPTIMIZE_LLVM=1 + CFG_ENABLE_LLVM_ASSERTIONS=1 + CFG_ENABLE_DEBUG_ASSERTIONS=1 +fi + +# OK, now write the debugging options +if [ -n "$CFG_DISABLE_OPTIMIZE" ]; then putvar CFG_DISABLE_OPTIMIZE; fi +if [ -n "$CFG_DISABLE_OPTIMIZE_CXX" ]; then putvar CFG_DISABLE_OPTIMIZE_CXX; fi +if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then putvar CFG_DISABLE_OPTIMIZE_LLVM; fi +if [ -n "$CFG_ENABLE_LLVM_ASSERTIONS" ]; then putvar CFG_ENABLE_LLVM_ASSERTIONS; fi +if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTIONS; fi +if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi + # A magic value that allows the compiler to use unstable features # during the bootstrap even when doing so would normally be an error # because of feature staging or because the build turns on @@ -1425,6 +1448,11 @@ move_if_changed config.tmp config.mk rm -f config.tmp touch config.stamp -step_msg "complete" +if [ -z "$CFG_ENABLE_DEBUG" ]; then + step_msg "configured in release mode. for development consider --enable-debug" +else + step_msg "complete" +fi + msg "run \`make help\`" msg From 6d17c35cd5fb806eb81441a1cbea755b0efc41ad Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 8 Apr 2015 15:12:08 -0700 Subject: [PATCH 10/11] configure: Add --enable-debug-jemalloc --- configure | 3 +++ mk/rt.mk | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/configure b/configure index 4d2868ede5c..b23cfaf976f 100755 --- a/configure +++ b/configure @@ -550,6 +550,7 @@ opt_nosave optimize-llvm 1 "build optimized LLVM" opt_nosave llvm-assertions 0 "build LLVM with assertions" opt_nosave debug-assertions 0 "build with debugging assertions" opt_nosave debuginfo 0 "build with debugger metadata" +opt_nosave debug-jemalloc 0 "build jemalloc with --enable-debug --enable-fill" valopt localstatedir "/var/lib" "local state directory" valopt sysconfdir "/etc" "install system configuration files" @@ -633,6 +634,7 @@ if [ -n "$CFG_ENABLE_DEBUG" ]; then CFG_DISABLE_OPTIMIZE_LLVM=1 CFG_ENABLE_LLVM_ASSERTIONS=1 CFG_ENABLE_DEBUG_ASSERTIONS=1 + CFG_ENABLE_DEBUG_JEMALLOC=1 fi # OK, now write the debugging options @@ -642,6 +644,7 @@ if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then putvar CFG_DISABLE_OPTIMIZE_LLVM; f if [ -n "$CFG_ENABLE_LLVM_ASSERTIONS" ]; then putvar CFG_ENABLE_LLVM_ASSERTIONS; fi if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTIONS; fi if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi +if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; fi # A magic value that allows the compiler to use unstable features # during the bootstrap even when doing so would normally be an error diff --git a/mk/rt.mk b/mk/rt.mk index 527485c5029..70abce8b460 100644 --- a/mk/rt.mk +++ b/mk/rt.mk @@ -143,6 +143,10 @@ else ifeq ($(findstring android, $(OSTYPE_$(1))), android) JEMALLOC_ARGS_$(1) := --disable-tls endif +ifdef CFG_ENABLE_DEBUG_JEMALLOC + JEMALLOC_ARGS_$(1) += --enable-debug --enable-fill +endif + ################################################################################ # jemalloc ################################################################################ From a725426ec8464e17794b0e8d0a06d33ba6ea95f0 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 8 Apr 2015 18:01:46 -0700 Subject: [PATCH 11/11] Don't deoptimize llvm when --enable-debug libLTO fails to link here. --- configure | 1 - 1 file changed, 1 deletion(-) diff --git a/configure b/configure index b23cfaf976f..97c998a5cda 100755 --- a/configure +++ b/configure @@ -631,7 +631,6 @@ if [ -n "$CFG_ENABLE_DEBUG" ]; then msg "debug mode enabled, setting performance options" CFG_DISABLE_OPTIMIZE=1 CFG_DISABLE_OPTIMIZE_CXX=1 - CFG_DISABLE_OPTIMIZE_LLVM=1 CFG_ENABLE_LLVM_ASSERTIONS=1 CFG_ENABLE_DEBUG_ASSERTIONS=1 CFG_ENABLE_DEBUG_JEMALLOC=1