about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-06-14 08:46:14 +0000
committerbors <bors@rust-lang.org>2017-06-14 08:46:14 +0000
commitdfa7e21e4ee555d04c0fb86069f5acffee3550ad (patch)
tree8e29f75d4d8a37b5205a1ae76c9f0a4588ddec43 /src/bootstrap
parente40ef964fe491b19c22dfb8dd36d1eab14223c36 (diff)
parent5c084fd8edd986d8a4bd9ff37b303f8777623a56 (diff)
downloadrust-dfa7e21e4ee555d04c0fb86069f5acffee3550ad.tar.gz
rust-dfa7e21e4ee555d04c0fb86069f5acffee3550ad.zip
Auto merge of #42433 - marco-c:profiling, r=alexcrichton
Build instruction profiler runtime as part of compiler-rt

r? @alexcrichton

This is #38608 with some fixes.

Still missing:
- [x] testing with profiler enabled on some builders (on which ones? Should I add the option to some of the already existing configurations, or create a new configuration?);
- [x] enabling distribution (on which builders?);
- [x] documentation.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/check.rs4
-rw-r--r--src/bootstrap/config.rs4
-rw-r--r--src/bootstrap/config.toml.example3
-rw-r--r--src/bootstrap/dist.rs1
-rw-r--r--src/bootstrap/lib.rs3
5 files changed, 15 insertions, 0 deletions
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 385376333c1..5ecd752d0ce 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -299,6 +299,10 @@ pub fn compiletest(build: &Build,
         cmd.env("SANITIZER_SUPPORT", "1");
     }
 
+    if build.config.profiler {
+        cmd.env("PROFILER_SUPPORT", "1");
+    }
+
     cmd.arg("--adb-path").arg("adb");
     cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);
     if target.contains("android") {
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index abad216d89b..64b2a665e25 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -50,6 +50,7 @@ pub struct Config {
     pub full_bootstrap: bool,
     pub extended: bool,
     pub sanitizers: bool,
+    pub profiler: bool,
 
     // llvm codegen options
     pub llvm_assertions: bool,
@@ -162,6 +163,7 @@ struct Build {
     extended: Option<bool>,
     verbose: Option<usize>,
     sanitizers: Option<bool>,
+    profiler: Option<bool>,
     openssl_static: Option<bool>,
 }
 
@@ -318,6 +320,7 @@ impl Config {
         set(&mut config.extended, build.extended);
         set(&mut config.verbose, build.verbose);
         set(&mut config.sanitizers, build.sanitizers);
+        set(&mut config.profiler, build.profiler);
         set(&mut config.openssl_static, build.openssl_static);
 
         if let Some(ref install) = toml.install {
@@ -471,6 +474,7 @@ impl Config {
                 ("FULL_BOOTSTRAP", self.full_bootstrap),
                 ("EXTENDED", self.extended),
                 ("SANITIZERS", self.sanitizers),
+                ("PROFILER", self.profiler),
                 ("DIST_SRC", self.rust_dist_src),
                 ("CARGO_OPENSSL_STATIC", self.openssl_static),
             }
diff --git a/src/bootstrap/config.toml.example b/src/bootstrap/config.toml.example
index 0eb6c4c82c4..3a467dafbfb 100644
--- a/src/bootstrap/config.toml.example
+++ b/src/bootstrap/config.toml.example
@@ -147,6 +147,9 @@
 # Build the sanitizer runtimes
 #sanitizers = false
 
+# Build the profiler runtime
+#profiler = false
+
 # Indicates whether the OpenSSL linked into Cargo will be statically linked or
 # not. If static linkage is specified then the build system will download a
 # known-good version of OpenSSL, compile it, and link it to Cargo.
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 26d44ae7693..ebf602373c9 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -570,6 +570,7 @@ pub fn rust_src(build: &Build) {
         "src/libgetopts",
         "src/compiler-rt",
         "src/jemalloc",
+        "src/libprofiler_builtins",
     ];
     let std_src_dirs_exclude = [
         "src/compiler-rt/test",
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 2fe6a2a3ae8..c8cd71f8f28 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -594,6 +594,9 @@ impl Build {
         if self.config.backtrace {
             features.push_str(" backtrace");
         }
+        if self.config.profiler {
+            features.push_str(" profiler");
+        }
         return features
     }