diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 63c4d9f4a29..bd5494ba4cd 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -128,6 +128,9 @@ pub fn run_passes(sess: Session, }; let use_softfp = sess.opts.debugging_opts & session::USE_SOFTFP != 0; + // FIXME: #11906: Omitting frame pointers breaks retrieving the value of a parameter. + let no_fp_elim = sess.opts.debuginfo; + let tm = sess.targ_cfg.target_strs.target_triple.with_c_str(|T| { sess.opts.target_cpu.with_c_str(|CPU| { sess.opts.target_feature.with_c_str(|Features| { @@ -137,7 +140,8 @@ pub fn run_passes(sess: Session, lib::llvm::RelocPIC, OptLevel, true, - use_softfp + use_softfp, + no_fp_elim ) }) }) diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index 3693b00951b..3ed59c0195e 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -1728,7 +1728,8 @@ pub fn LLVMRustCreateTargetMachine(Triple: *c_char, Reloc: RelocMode, Level: CodeGenOptLevel, EnableSegstk: bool, - UseSoftFP: bool) -> TargetMachineRef; + UseSoftFP: bool, + NoFramePointerElim: bool) -> TargetMachineRef; pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef); pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef, PM: PassManagerRef, diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index cab9c187eae..2bc96d9f0bf 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -68,7 +68,8 @@ LLVMRustCreateTargetMachine(const char *triple, Reloc::Model RM, CodeGenOpt::Level OptLevel, bool EnableSegmentedStacks, - bool UseSoftFloat) { + bool UseSoftFloat, + bool NoFramePointerElim) { std::string Error; Triple Trip(Triple::normalize(triple)); const llvm::Target *TheTarget = TargetRegistry::lookupTarget(Trip.getTriple(), @@ -79,7 +80,7 @@ LLVMRustCreateTargetMachine(const char *triple, } TargetOptions Options; - Options.NoFramePointerElim = true; + Options.NoFramePointerElim = NoFramePointerElim; Options.EnableSegmentedStacks = EnableSegmentedStacks; Options.FloatABIType = FloatABI::Default; Options.UseSoftFloat = UseSoftFloat; diff --git a/src/test/debug-info/function-prologue-stepping-no-split-stack.rs b/src/test/debug-info/function-prologue-stepping-no-split-stack.rs index 4d940c91d2a..da2d4e09fc6 100644 --- a/src/test/debug-info/function-prologue-stepping-no-split-stack.rs +++ b/src/test/debug-info/function-prologue-stepping-no-split-stack.rs @@ -244,6 +244,3 @@ fn main() { while_expr(40, 41, 42); loop_expr(43, 44, 45); } - - -