rust/pull-49959.patch

196 lines
8.3 KiB
Diff
Raw Normal View History

2018-05-10 18:32:50 +00:00
From cc2906cb26304301709557a88ac4a3334b88616b Mon Sep 17 00:00:00 2001
2018-04-16 03:47:49 +00:00
From: Josh Stone <jistone@redhat.com>
Date: Fri, 13 Apr 2018 16:52:54 -0700
Subject: [PATCH 1/3] rustbuild: allow building tools with debuginfo
Debugging information for the extended tools is currently disabled for
concerns about the size. This patch adds `--enable-debuginfo-tools` to
let one opt into having that debuginfo.
This is useful for debugging the tools in distro packages. We always
strip debuginfo into separate packages anyway, so the extra size is not
a concern in regular use.
---
CONTRIBUTING.md | 1 +
config.toml.example | 4 ++++
src/bootstrap/builder.rs | 12 ++++++++----
src/bootstrap/config.rs | 5 +++++
src/bootstrap/configure.py | 1 +
5 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
2018-05-10 18:32:50 +00:00
index 7a62405f0596..73d4188d6954 100644
2018-04-16 03:47:49 +00:00
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -121,6 +121,7 @@ configuration used in the build process. Some options to note:
#### `[rust]`:
- `debuginfo = true` - Build a compiler with debuginfo. Makes building rustc slower, but then you can use a debugger to debug `rustc`.
- `debuginfo-lines = true` - An alternative to `debuginfo = true` that doesn't let you use a debugger, but doesn't make building rustc slower and still gives you line numbers in backtraces.
+- `debuginfo-tools = true` - Build the extended tools with debuginfo.
- `debug-assertions = true` - Makes the log output of `debug!` work.
- `optimize = false` - Disable optimizations to speed up compilation of stage1 rust, but makes the stage1 compiler x100 slower.
diff --git a/config.toml.example b/config.toml.example
2018-05-10 18:32:50 +00:00
index 68bc7dfe720f..bd18a604a9c8 100644
2018-04-16 03:47:49 +00:00
--- a/config.toml.example
+++ b/config.toml.example
2018-05-10 18:32:50 +00:00
@@ -262,6 +262,10 @@
2018-04-16 03:47:49 +00:00
# standard library.
#debuginfo-only-std = false
+# Enable debuginfo for the extended tools: cargo, rls, rustfmt
+# Adding debuginfo increases their sizes by a factor of 3-4.
+#debuginfo-tools = false
+
# Whether or not jemalloc is built and enabled
#use-jemalloc = true
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
2018-05-10 18:32:50 +00:00
index 7ff64af91967..ae19c66d6070 100644
2018-04-16 03:47:49 +00:00
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
2018-05-10 18:32:50 +00:00
@@ -622,10 +622,14 @@ impl<'a> Builder<'a> {
2018-04-16 03:47:49 +00:00
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build)));
}
- if mode != Mode::Tool {
- // Tools don't get debuginfo right now, e.g. cargo and rls don't
- // get compiled with debuginfo.
- // Adding debuginfo increases their sizes by a factor of 3-4.
+ if mode == Mode::Tool {
+ // Tools like cargo and rls don't get debuginfo by default right now, but this can be
+ // enabled in the config. Adding debuginfo increases their sizes by a factor of 3-4.
+ if self.config.rust_debuginfo_tools {
+ cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string());
+ cargo.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string());
+ }
+ } else {
cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string());
cargo.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string());
cargo.env("RUSTC_FORCE_UNSTABLE", "1");
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
2018-05-10 18:32:50 +00:00
index 239316d45c49..95d138b9fab2 100644
2018-04-16 03:47:49 +00:00
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
2018-05-10 18:32:50 +00:00
@@ -94,6 +94,7 @@ pub struct Config {
2018-04-16 03:47:49 +00:00
pub rust_debuginfo: bool,
pub rust_debuginfo_lines: bool,
pub rust_debuginfo_only_std: bool,
+ pub rust_debuginfo_tools: bool,
pub rust_rpath: bool,
pub rustc_parallel_queries: bool,
pub rustc_default_linker: Option<String>,
2018-05-10 18:32:50 +00:00
@@ -282,6 +283,7 @@ struct Rust {
2018-04-16 03:47:49 +00:00
debuginfo: Option<bool>,
debuginfo_lines: Option<bool>,
debuginfo_only_std: Option<bool>,
+ debuginfo_tools: Option<bool>,
experimental_parallel_queries: Option<bool>,
debug_jemalloc: Option<bool>,
use_jemalloc: Option<bool>,
2018-05-10 18:32:50 +00:00
@@ -462,6 +464,7 @@ impl Config {
2018-04-16 03:47:49 +00:00
let mut llvm_assertions = None;
let mut debuginfo_lines = None;
let mut debuginfo_only_std = None;
+ let mut debuginfo_tools = None;
let mut debug = None;
let mut debug_jemalloc = None;
let mut debuginfo = None;
2018-05-10 18:32:50 +00:00
@@ -499,6 +502,7 @@ impl Config {
2018-04-16 03:47:49 +00:00
debuginfo = rust.debuginfo;
debuginfo_lines = rust.debuginfo_lines;
debuginfo_only_std = rust.debuginfo_only_std;
+ debuginfo_tools = rust.debuginfo_tools;
optimize = rust.optimize;
ignore_git = rust.ignore_git;
debug_jemalloc = rust.debug_jemalloc;
2018-05-10 18:32:50 +00:00
@@ -582,6 +586,7 @@ impl Config {
};
2018-04-16 03:47:49 +00:00
config.rust_debuginfo_lines = debuginfo_lines.unwrap_or(default);
config.rust_debuginfo_only_std = debuginfo_only_std.unwrap_or(default);
+ config.rust_debuginfo_tools = debuginfo_tools.unwrap_or(default);
let default = debug == Some(true);
config.debug_jemalloc = debug_jemalloc.unwrap_or(default);
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
2018-05-10 18:32:50 +00:00
index b06968d313ba..a0123da6d8ff 100755
2018-04-16 03:47:49 +00:00
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
2018-05-10 18:32:50 +00:00
@@ -79,6 +79,7 @@ o("llvm-release-debuginfo", "llvm.release-debuginfo", "build LLVM with debugger
2018-04-16 03:47:49 +00:00
o("debuginfo", "rust.debuginfo", "build with debugger metadata")
o("debuginfo-lines", "rust.debuginfo-lines", "build with line number debugger metadata")
o("debuginfo-only-std", "rust.debuginfo-only-std", "build only libstd with debugging information")
+o("debuginfo-tools", "rust.debuginfo-tools", "build extended tools with debugging information")
o("debug-jemalloc", "rust.debug-jemalloc", "build jemalloc with --enable-debug --enable-fill")
v("save-toolstates", "rust.save-toolstates", "save build and test status of external tools into this file")
--
2018-05-10 18:32:50 +00:00
2.17.0
2018-04-16 03:47:49 +00:00
2018-05-10 18:32:50 +00:00
From bc7403d067b3e2a154df1ef088377cb2a75f429c Mon Sep 17 00:00:00 2001
2018-04-16 03:47:49 +00:00
From: Josh Stone <jistone@redhat.com>
Date: Fri, 13 Apr 2018 21:57:53 -0700
Subject: [PATCH 2/3] Avoid specific claims about debuginfo size
---
config.toml.example | 2 +-
src/bootstrap/builder.rs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/config.toml.example b/config.toml.example
2018-05-10 18:32:50 +00:00
index bd18a604a9c8..effe00843810 100644
2018-04-16 03:47:49 +00:00
--- a/config.toml.example
+++ b/config.toml.example
2018-05-10 18:32:50 +00:00
@@ -263,7 +263,7 @@
2018-04-16 03:47:49 +00:00
#debuginfo-only-std = false
# Enable debuginfo for the extended tools: cargo, rls, rustfmt
-# Adding debuginfo increases their sizes by a factor of 3-4.
+# Adding debuginfo makes them several times larger.
#debuginfo-tools = false
# Whether or not jemalloc is built and enabled
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
2018-05-10 18:32:50 +00:00
index ae19c66d6070..6874efa5a4c7 100644
2018-04-16 03:47:49 +00:00
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
2018-05-10 18:32:50 +00:00
@@ -624,7 +624,7 @@ impl<'a> Builder<'a> {
2018-04-16 03:47:49 +00:00
if mode == Mode::Tool {
// Tools like cargo and rls don't get debuginfo by default right now, but this can be
- // enabled in the config. Adding debuginfo increases their sizes by a factor of 3-4.
+ // enabled in the config. Adding debuginfo makes them several times larger.
if self.config.rust_debuginfo_tools {
cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string());
cargo.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string());
--
2018-05-10 18:32:50 +00:00
2.17.0
2018-04-16 03:47:49 +00:00
2018-05-10 18:32:50 +00:00
From 93734e9c46e30acc9a51f19c56511ce8516b6855 Mon Sep 17 00:00:00 2001
2018-04-16 03:47:49 +00:00
From: Josh Stone <jistone@redhat.com>
Date: Fri, 13 Apr 2018 21:58:21 -0700
Subject: [PATCH 3/3] Make debuginfo-tools always default false
---
src/bootstrap/config.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
2018-05-10 18:32:50 +00:00
index 95d138b9fab2..1b4b2c5fb2a5 100644
2018-04-16 03:47:49 +00:00
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
2018-05-10 18:32:50 +00:00
@@ -586,7 +586,7 @@ impl Config {
};
2018-04-16 03:47:49 +00:00
config.rust_debuginfo_lines = debuginfo_lines.unwrap_or(default);
config.rust_debuginfo_only_std = debuginfo_only_std.unwrap_or(default);
- config.rust_debuginfo_tools = debuginfo_tools.unwrap_or(default);
+ config.rust_debuginfo_tools = debuginfo_tools.unwrap_or(false);
let default = debug == Some(true);
config.debug_jemalloc = debug_jemalloc.unwrap_or(default);
--
2018-05-10 18:32:50 +00:00
2.17.0
2018-04-16 03:47:49 +00:00