about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2020-04-17 21:21:49 +0100
committerAmanieu d'Antras <amanieu@gmail.com>2020-04-18 14:10:04 +0100
commit9f23b2d36bf31b89a107b83a37665af08f6c0fb3 (patch)
treef1acadebbf985db4f172a4b5acbfa58b1b536db7
parent7fe41279c5b6cca8c16f94f12ef4bf8811943599 (diff)
downloadrust-9f23b2d36bf31b89a107b83a37665af08f6c0fb3.tar.gz
rust-9f23b2d36bf31b89a107b83a37665af08f6c0fb3.zip
Add an option to inhibit automatic injection of profiler_builtins
-rw-r--r--src/librustc_metadata/creader.rs4
-rw-r--r--src/librustc_session/options.rs2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs
index 3e5d7b8efd5..fe8fbd50627 100644
--- a/src/librustc_metadata/creader.rs
+++ b/src/librustc_metadata/creader.rs
@@ -686,7 +686,9 @@ impl<'a> CrateLoader<'a> {
     }
 
     fn inject_profiler_runtime(&mut self) {
-        if self.sess.opts.debugging_opts.profile || self.sess.opts.cg.profile_generate.enabled() {
+        if (self.sess.opts.debugging_opts.profile || self.sess.opts.cg.profile_generate.enabled())
+            && !self.sess.opts.debugging_opts.no_profiler_runtime
+        {
             info!("loading profiler");
 
             let name = Symbol::intern("profiler_builtins");
diff --git a/src/librustc_session/options.rs b/src/librustc_session/options.rs
index 8cd6ca86f46..94e65093e71 100644
--- a/src/librustc_session/options.rs
+++ b/src/librustc_session/options.rs
@@ -890,6 +890,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
         "extra arguments to prepend to the linker invocation (space separated)"),
     profile: bool = (false, parse_bool, [TRACKED],
                      "insert profiling code"),
+    no_profiler_runtime: bool = (false, parse_bool, [TRACKED],
+        "don't automatically inject the profiler_builtins crate"),
     relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
         "choose which RELRO level to use"),
     nll_facts: bool = (false, parse_bool, [UNTRACKED],