Skip to content

Commit 9f23b2d

Browse files
committedApr 18, 2020
Add an option to inhibit automatic injection of profiler_builtins
1 parent 7fe4127 commit 9f23b2d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
 

‎src/librustc_metadata/creader.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,9 @@ impl<'a> CrateLoader<'a> {
686686
}
687687

688688
fn inject_profiler_runtime(&mut self) {
689-
if self.sess.opts.debugging_opts.profile || self.sess.opts.cg.profile_generate.enabled() {
689+
if (self.sess.opts.debugging_opts.profile || self.sess.opts.cg.profile_generate.enabled())
690+
&& !self.sess.opts.debugging_opts.no_profiler_runtime
691+
{
690692
info!("loading profiler");
691693

692694
let name = Symbol::intern("profiler_builtins");

‎src/librustc_session/options.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
890890
"extra arguments to prepend to the linker invocation (space separated)"),
891891
profile: bool = (false, parse_bool, [TRACKED],
892892
"insert profiling code"),
893+
no_profiler_runtime: bool = (false, parse_bool, [TRACKED],
894+
"don't automatically inject the profiler_builtins crate"),
893895
relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
894896
"choose which RELRO level to use"),
895897
nll_facts: bool = (false, parse_bool, [UNTRACKED],

0 commit comments

Comments
 (0)