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
This commit is contained in:
commit
2dffe78979
53
configure
vendored
53
configure
vendored
@ -523,30 +523,35 @@ fi
|
|||||||
BOOL_OPTIONS=""
|
BOOL_OPTIONS=""
|
||||||
VAL_OPTIONS=""
|
VAL_OPTIONS=""
|
||||||
|
|
||||||
|
opt debug 0 "debug mode"
|
||||||
opt valgrind 0 "run tests with valgrind (memcheck by default)"
|
opt valgrind 0 "run tests with valgrind (memcheck by default)"
|
||||||
opt helgrind 0 "run tests with helgrind instead of memcheck"
|
opt helgrind 0 "run tests with helgrind instead of memcheck"
|
||||||
opt valgrind-rpass 1 "run rpass-valgrind tests with valgrind"
|
opt valgrind-rpass 1 "run rpass-valgrind tests with valgrind"
|
||||||
opt docs 1 "build standard library documentation"
|
opt docs 1 "build standard library documentation"
|
||||||
opt compiler-docs 0 "build compiler 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 optimize-tests 1 "build tests with optimizations"
|
||||||
opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang"
|
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 1 "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 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 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 local-rust 0 "use an installed rustc rather than downloading a snapshot"
|
||||||
opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
|
opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
|
||||||
opt rpath 0 "build rpaths into rustc itself"
|
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
|
# This is used by the automation to produce single-target nightlies
|
||||||
opt dist-host-only 0 "only install bins for the host architecture"
|
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 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"
|
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 localstatedir "/var/lib" "local state directory"
|
||||||
valopt sysconfdir "/etc" "install system configuration files"
|
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 jemalloc-root "" "set directory where libjemalloc_pic.a is located"
|
||||||
valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
|
valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
|
||||||
valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path"
|
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
|
# Many of these are saved below during the "writing configuration" step
|
||||||
# (others are conditionally saved).
|
# (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 host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples"
|
||||||
valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target 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 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
|
# Temporarily support old triples until buildbots get updated
|
||||||
CFG_BUILD=$(to_llvm_triple $CFG_BUILD)
|
CFG_BUILD=$(to_llvm_triple $CFG_BUILD)
|
||||||
@ -621,13 +626,24 @@ case "$CFG_RELEASE_CHANNEL" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Continue supporting the old --enable-nightly flag to transition the bots
|
# Adjust perf and debug options for debug mode
|
||||||
# XXX Remove me
|
if [ -n "$CFG_ENABLE_DEBUG" ]; then
|
||||||
if [ ! -z "$CFG_ENABLE_NIGHTLY" ]
|
msg "debug mode enabled, setting performance options"
|
||||||
then
|
CFG_DISABLE_OPTIMIZE=1
|
||||||
CFG_RELEASE_CHANNEL=nightly
|
CFG_DISABLE_OPTIMIZE_CXX=1
|
||||||
|
CFG_ENABLE_LLVM_ASSERTIONS=1
|
||||||
|
CFG_ENABLE_DEBUG_ASSERTIONS=1
|
||||||
|
CFG_ENABLE_DEBUG_JEMALLOC=1
|
||||||
fi
|
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
|
# A magic value that allows the compiler to use unstable features
|
||||||
# during the bootstrap even when doing so would normally be an error
|
# during the bootstrap even when doing so would normally be an error
|
||||||
@ -1180,7 +1196,7 @@ do
|
|||||||
LLVM_DBG_OPTS="--enable-optimized"
|
LLVM_DBG_OPTS="--enable-optimized"
|
||||||
LLVM_INST_DIR=$LLVM_BUILD_DIR/Release
|
LLVM_INST_DIR=$LLVM_BUILD_DIR/Release
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$CFG_DISABLE_LLVM_ASSERTIONS" ]
|
if [ -z "$CFG_ENABLE_LLVM_ASSERTIONS" ]
|
||||||
then
|
then
|
||||||
LLVM_ASSERTION_OPTS="--disable-assertions"
|
LLVM_ASSERTION_OPTS="--disable-assertions"
|
||||||
else
|
else
|
||||||
@ -1434,6 +1450,11 @@ move_if_changed config.tmp config.mk
|
|||||||
rm -f config.tmp
|
rm -f config.tmp
|
||||||
touch config.stamp
|
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 "run \`make help\`"
|
||||||
msg
|
msg
|
||||||
|
@ -8,12 +8,6 @@
|
|||||||
# option. This file may not be copied, modified, or distributed
|
# option. This file may not be copied, modified, or distributed
|
||||||
# except according to those terms.
|
# except according to those terms.
|
||||||
|
|
||||||
ifdef CFG_DISABLE_VERIFY_INSTALL
|
|
||||||
MAYBE_DISABLE_VERIFY=--disable-verify
|
|
||||||
else
|
|
||||||
MAYBE_DISABLE_VERIFY=
|
|
||||||
endif
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
|
ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
|
||||||
# Build the dist as the original user
|
# Build the dist as the original user
|
||||||
@ -22,9 +16,9 @@ else
|
|||||||
$(Q)$(MAKE) prepare_install
|
$(Q)$(MAKE) prepare_install
|
||||||
endif
|
endif
|
||||||
ifeq ($(CFG_DISABLE_DOCS),)
|
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
|
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
|
# Remove tmp files because it's a decent amount of disk space
|
||||||
$(Q)rm -R tmp/dist
|
$(Q)rm -R tmp/dist
|
||||||
|
|
||||||
|
13
mk/main.mk
13
mk/main.mk
@ -126,11 +126,16 @@ endif
|
|||||||
|
|
||||||
CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS)
|
CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS)
|
||||||
|
|
||||||
ifdef CFG_DISABLE_DEBUG
|
ifdef CFG_ENABLE_DEBUG_ASSERTIONS
|
||||||
CFG_RUSTC_FLAGS += --cfg ndebug
|
$(info cfg: enabling debug assertions (CFG_ENABLE_DEBUG_ASSERTIONS))
|
||||||
else
|
|
||||||
$(info cfg: enabling more debugging (CFG_ENABLE_DEBUG))
|
|
||||||
CFG_RUSTC_FLAGS += --cfg debug -C debug-assertions=on
|
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
|
endif
|
||||||
|
|
||||||
ifdef SAVE_TEMPS
|
ifdef SAVE_TEMPS
|
||||||
|
4
mk/rt.mk
4
mk/rt.mk
@ -143,6 +143,10 @@ else ifeq ($(findstring android, $(OSTYPE_$(1))), android)
|
|||||||
JEMALLOC_ARGS_$(1) := --disable-tls
|
JEMALLOC_ARGS_$(1) := --disable-tls
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef CFG_ENABLE_DEBUG_JEMALLOC
|
||||||
|
JEMALLOC_ARGS_$(1) += --enable-debug --enable-fill
|
||||||
|
endif
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# jemalloc
|
# jemalloc
|
||||||
################################################################################
|
################################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user