about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-04-09 15:54:11 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-04-10 00:24:43 +0530
commit2dffe789791f2be95683b47a34f7a4c7f1014047 (patch)
treebafaa34372afd41a4dc9569ee6e3a3a70fb4c030
parent67fa4d3a0c1236e849c2446bcdc47e617452a645 (diff)
parenta725426ec8464e17794b0e8d0a06d33ba6ea95f0 (diff)
downloadrust-2dffe789791f2be95683b47a34f7a4c7f1014047.tar.gz
rust-2dffe789791f2be95683b47a34f7a4c7f1014047.zip
Rollup merge of #24205 - brson:debug, r=alexcrichton
 This makes the default configuration fully optimized, with no debugging options, no llvm asserts, renames --enable-debug to --enable-debug-assertions, and adds --enable-debug as a blanket option that toggles various things, per #17665. It does not add a `--enable-release` flag since that would be a no-op.

cc @nrc

Fixes https://github.com/rust-lang/rust/issues/22390
Fixes https://github.com/rust-lang/rust/issues/17081
Partially addresses https://github.com/rust-lang/rust/issues/17665
-rwxr-xr-xconfigure53
-rw-r--r--mk/install.mk10
-rw-r--r--mk/main.mk13
-rw-r--r--mk/rt.mk4
4 files changed, 52 insertions, 28 deletions
diff --git a/configure b/configure
index ef474fcf79d..97c998a5cda 100755
--- a/configure
+++ b/configure
@@ -523,30 +523,35 @@ 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 1 "build LLVM with assertions"
-opt debug 1 "build with extra debug fun"
+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"
 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"
 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"
+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"
 
@@ -556,6 +561,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 +574,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,13 +626,24 @@ 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
+# 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_ENABLE_LLVM_ASSERTIONS=1
+    CFG_ENABLE_DEBUG_ASSERTIONS=1
+    CFG_ENABLE_DEBUG_JEMALLOC=1
 fi
-putvar CFG_RELEASE_CHANNEL
+
+# 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
+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
@@ -1180,7 +1196,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
@@ -1434,6 +1450,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
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
 
diff --git a/mk/main.mk b/mk/main.mk
index b9f2cf1cce8..ea00444453d 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -126,11 +126,16 @@ endif
 
 CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS)
 
-ifdef CFG_DISABLE_DEBUG
-  CFG_RUSTC_FLAGS += --cfg ndebug
-else
-  $(info cfg: enabling more debugging (CFG_ENABLE_DEBUG))
+ifdef 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
+endif
+
+ifdef CFG_ENABLE_DEBUGINFO
+  $(info cfg: enabling debuginfo (CFG_ENABLE_DEBUGINFO))
+  CFG_RUSTC_FLAGS += -g
 endif
 
 ifdef SAVE_TEMPS
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
 ################################################################################