Skip to content

Commit

Permalink
enable fp-elim when debug info is disabled
Browse files Browse the repository at this point in the history
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
  • Loading branch information
thestinger committed Jan 29, 2014
1 parent 17c42db commit cb263e8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ pub mod write {
};
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| {
Expand All @@ -137,7 +140,8 @@ pub mod write {
lib::llvm::RelocPIC,
OptLevel,
true,
use_softfp
use_softfp,
no_fp_elim
)
})
})
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/lib/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,8 @@ pub mod llvm {
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,
Expand Down
5 changes: 3 additions & 2 deletions src/rustllvm/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,3 @@ fn main() {
while_expr(40, 41, 42);
loop_expr(43, 44, 45);
}



5 comments on commit cb263e8

@bors
Copy link
Contributor

@bors bors commented on cb263e8 Jan 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on cb263e8 Jan 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging thestinger/rust/frame-pointer = cb263e8 into auto

@bors
Copy link
Contributor

@bors bors commented on cb263e8 Jan 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thestinger/rust/frame-pointer = cb263e8 merged ok, testing candidate = 1e23c5c

@bors
Copy link
Contributor

@bors bors commented on cb263e8 Jan 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on cb263e8 Jan 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 1e23c5c

Please sign in to comment.