Skip to content

Commit cb263e8

Browse files
committed
enable fp-elim when debug info is disabled
This can almost be fully disabled, as it no longer breaks retrieving a backtrace on OS X as verified by @alexcrichton. However, it still breaks retrieving the values of parameters. This should be fixable in the future via a proper location list... Closes #7477
1 parent 17c42db commit cb263e8

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/librustc/back/link.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ pub mod write {
128128
};
129129
let use_softfp = sess.opts.debugging_opts & session::USE_SOFTFP != 0;
130130

131+
// FIXME: #11906: Omitting frame pointers breaks retrieving the value of a parameter.
132+
let no_fp_elim = sess.opts.debuginfo;
133+
131134
let tm = sess.targ_cfg.target_strs.target_triple.with_c_str(|T| {
132135
sess.opts.target_cpu.with_c_str(|CPU| {
133136
sess.opts.target_feature.with_c_str(|Features| {
@@ -137,7 +140,8 @@ pub mod write {
137140
lib::llvm::RelocPIC,
138141
OptLevel,
139142
true,
140-
use_softfp
143+
use_softfp,
144+
no_fp_elim
141145
)
142146
})
143147
})

src/librustc/lib/llvm.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,8 @@ pub mod llvm {
17281728
Reloc: RelocMode,
17291729
Level: CodeGenOptLevel,
17301730
EnableSegstk: bool,
1731-
UseSoftFP: bool) -> TargetMachineRef;
1731+
UseSoftFP: bool,
1732+
NoFramePointerElim: bool) -> TargetMachineRef;
17321733
pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
17331734
pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
17341735
PM: PassManagerRef,

src/rustllvm/PassWrapper.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ LLVMRustCreateTargetMachine(const char *triple,
6868
Reloc::Model RM,
6969
CodeGenOpt::Level OptLevel,
7070
bool EnableSegmentedStacks,
71-
bool UseSoftFloat) {
71+
bool UseSoftFloat,
72+
bool NoFramePointerElim) {
7273
std::string Error;
7374
Triple Trip(Triple::normalize(triple));
7475
const llvm::Target *TheTarget = TargetRegistry::lookupTarget(Trip.getTriple(),
@@ -79,7 +80,7 @@ LLVMRustCreateTargetMachine(const char *triple,
7980
}
8081

8182
TargetOptions Options;
82-
Options.NoFramePointerElim = true;
83+
Options.NoFramePointerElim = NoFramePointerElim;
8384
Options.EnableSegmentedStacks = EnableSegmentedStacks;
8485
Options.FloatABIType = FloatABI::Default;
8586
Options.UseSoftFloat = UseSoftFloat;

src/test/debug-info/function-prologue-stepping-no-split-stack.rs

-3
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,3 @@ fn main() {
244244
while_expr(40, 41, 42);
245245
loop_expr(43, 44, 45);
246246
}
247-
248-
249-

0 commit comments

Comments
 (0)