diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index df4ae1e24619a..3789626d3511a 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1064,8 +1064,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, 2 = full debug info with variable and type information"), opt_level: Option = (None, parse_opt_string, [TRACKED], "optimize with possible levels 0-3, s, or z"), - force_frame_pointers: bool = (false, parse_bool, [TRACKED], - "force frame pointers to be used"), + force_frame_pointers: Option = (None, parse_opt_bool, [TRACKED], + "force use of the frame pointers"), debug_assertions: Option = (None, parse_opt_bool, [TRACKED], "explicitly enable the cfg(debug_assertions) directive"), inline_threshold: Option = (None, parse_opt_uint, [TRACKED], @@ -2893,7 +2893,7 @@ mod tests { assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); - opts.cg.force_frame_pointers = true; + opts.cg.force_frame_pointers = Some(false); assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 46c69d052301e..1cfb5700b715d 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -676,8 +676,11 @@ impl Session { } pub fn must_not_eliminate_frame_pointers(&self) -> bool { - self.opts.debuginfo != DebugInfoLevel::NoDebugInfo - || !self.target.target.options.eliminate_frame_pointer + if let Some(x) = self.opts.cg.force_frame_pointers { + x + } else { + !self.target.target.options.eliminate_frame_pointer + } } /// Returns the symbol name for the registrar function, diff --git a/src/test/codegen/force-frame-pointers.rs b/src/test/codegen/force-frame-pointers.rs index d40406a0476f2..f70e366719882 100644 --- a/src/test/codegen/force-frame-pointers.rs +++ b/src/test/codegen/force-frame-pointers.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. // -// compile-flags: -C no-prepopulate-passes -C force-frame-pointers +// compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y #![crate_type="lib"]