diff --git a/configure b/configure index ee5922b1f14..a93a6c5a3a6 100755 --- a/configure +++ b/configure @@ -647,6 +647,7 @@ opt_nosave debug-assertions 0 "build with debugging assertions" opt_nosave llvm-release-debuginfo 0 "build LLVM with debugger metadata" opt_nosave debuginfo 0 "build with debugger metadata" opt_nosave debuginfo-lines 0 "build with line number debugger metadata" +opt_nosave debuginfo-only-std 0 "build only libstd with debugging information" opt_nosave debug-jemalloc 0 "build jemalloc with --enable-debug --enable-fill" valopt localstatedir "/var/lib" "local state directory" @@ -733,15 +734,17 @@ case "$CFG_RELEASE_CHANNEL" in nightly ) msg "overriding settings for $CFG_RELEASE_CHANNEL" CFG_ENABLE_LLVM_ASSERTIONS=1 - - # FIXME(#37364) shouldn't have to disable this on windows-gnu + # FIXME(stage0) re-enable this on the next stage0 now that #35566 is + # fixed case "$CFG_BUILD" in *-pc-windows-gnu) ;; *) - CFG_ENABLE_DEBUGINFO_LINES=1 + CFG_ENABLE_DEBUGINFO_LINES=1 + CFG_ENABLE_DEBUGINFO_ONLY_STD=1 ;; esac + ;; beta | stable) msg "overriding settings for $CFG_RELEASE_CHANNEL" @@ -749,7 +752,8 @@ case "$CFG_RELEASE_CHANNEL" in *-pc-windows-gnu) ;; *) - CFG_ENABLE_DEBUGINFO_LINES=1 + CFG_ENABLE_DEBUGINFO_LINES=1 + CFG_ENABLE_DEBUGINFO_ONLY_STD=1 ;; esac ;; @@ -785,6 +789,7 @@ if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTION if [ -n "$CFG_ENABLE_LLVM_RELEASE_DEBUGINFO" ]; then putvar CFG_ENABLE_LLVM_RELEASE_DEBUGINFO; fi if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi if [ -n "$CFG_ENABLE_DEBUGINFO_LINES" ]; then putvar CFG_ENABLE_DEBUGINFO_LINES; fi +if [ -n "$CFG_ENABLE_DEBUGINFO_ONLY_STD" ]; then putvar CFG_ENABLE_DEBUGINFO_ONLY_STD; fi if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; fi step_msg "looking for build programs" diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 31f8754d209..d0ffccb03cc 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -189,6 +189,13 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) { .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or(String::new())) .env("CFG_LIBDIR_RELATIVE", "lib"); + // If we're not building a compiler with debugging information then remove + // these two env vars which would be set otherwise. + if build.config.rust_debuginfo_only_std { + cargo.env_remove("RUSTC_DEBUGINFO"); + cargo.env_remove("RUSTC_DEBUGINFO_LINES"); + } + if let Some(ref ver_date) = build.ver_date { cargo.env("CFG_VER_DATE", ver_date); } diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 11c5b374ed9..dd0887e3b9f 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -63,6 +63,7 @@ pub struct Config { pub rust_debug_assertions: bool, pub rust_debuginfo: bool, pub rust_debuginfo_lines: bool, + pub rust_debuginfo_only_std: bool, pub rust_rpath: bool, pub rustc_default_linker: Option, pub rustc_default_ar: Option, @@ -179,6 +180,7 @@ struct Rust { debug_assertions: Option, debuginfo: Option, debuginfo_lines: Option, + debuginfo_only_std: Option, debug_jemalloc: Option, use_jemalloc: Option, backtrace: Option, @@ -298,6 +300,7 @@ pub fn parse(build: &str, file: Option) -> Config { set(&mut config.rust_debug_assertions, rust.debug_assertions); set(&mut config.rust_debuginfo, rust.debuginfo); set(&mut config.rust_debuginfo_lines, rust.debuginfo_lines); + set(&mut config.rust_debuginfo_only_std, rust.debuginfo_only_std); set(&mut config.rust_optimize, rust.optimize); set(&mut config.rust_optimize_tests, rust.optimize_tests); set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests); @@ -390,6 +393,7 @@ macro_rules! check { ("DEBUG_ASSERTIONS", self.rust_debug_assertions), ("DEBUGINFO", self.rust_debuginfo), ("DEBUGINFO_LINES", self.rust_debuginfo_lines), + ("DEBUGINFO_ONLY_STD", self.rust_debuginfo_only_std), ("JEMALLOC", self.use_jemalloc), ("DEBUG_JEMALLOC", self.debug_jemalloc), ("RPATH", self.rust_rpath), diff --git a/src/bootstrap/config.toml.example b/src/bootstrap/config.toml.example index 69210c4959b..76ac2808f09 100644 --- a/src/bootstrap/config.toml.example +++ b/src/bootstrap/config.toml.example @@ -149,6 +149,11 @@ # Whether or not line number debug information is emitted #debuginfo-lines = false +# Whether or not to only build debuginfo for the standard library if enabled. +# If enabled, this will not compile the compiler with debuginfo, just the +# standard library. +#debuginfo-only-std = false + # Whether or not jemalloc is built and enabled #use-jemalloc = true