Skip to content

Commit 1e23c5c

Browse files
committed
auto merge of #11879 : thestinger/rust/frame-pointer, r=alexcrichton
This is still used for Rust code (`Options.NoFramePointerElim = true`).
2 parents dfb6116 + cb263e8 commit 1e23c5c

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed

mk/platform.mk

-7
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ endef
2626
$(foreach t,$(CFG_TARGET),$(eval $(call DEF_OSTYPE_VAR,$(t))))
2727
$(foreach t,$(CFG_TARGET),$(info cfg: os for $(t) is $(OSTYPE_$(t))))
2828

29-
# FIXME: no-omit-frame-pointer is just so that task_start_wrapper
30-
# has a frame pointer and the stack walker can understand it. Turning off
31-
# frame pointers everywhere is overkill
32-
CFG_GCCISH_CFLAGS += -fno-omit-frame-pointer
33-
3429
# On Darwin, we need to run dsymutil so the debugging information ends
3530
# up in the right place. On other platforms, it automatically gets
3631
# embedded into the executable, so use a no-op command.
@@ -160,7 +155,6 @@ CFG_DEF_SUFFIX_x86_64-unknown-linux-gnu := .linux.def
160155
CFG_LLC_FLAGS_x86_64-unknown-linux-gnu :=
161156
CFG_INSTALL_NAME_x86_64-unknown-linux-gnu =
162157
CFG_LIBUV_LINK_FLAGS_x86_64-unknown-linux-gnu =
163-
CFG_LLVM_BUILD_ENV_x86_64-unknown-linux-gnu="CXXFLAGS=-fno-omit-frame-pointer"
164158
CFG_EXE_SUFFIX_x86_64-unknown-linux-gnu =
165159
CFG_WINDOWSY_x86_64-unknown-linux-gnu :=
166160
CFG_UNIXY_x86_64-unknown-linux-gnu := 1
@@ -188,7 +182,6 @@ CFG_DEF_SUFFIX_i686-unknown-linux-gnu := .linux.def
188182
CFG_LLC_FLAGS_i686-unknown-linux-gnu :=
189183
CFG_INSTALL_NAME_i686-unknown-linux-gnu =
190184
CFG_LIBUV_LINK_FLAGS_i686-unknown-linux-gnu =
191-
CFG_LLVM_BUILD_ENV_i686-unknown-linux-gnu="CXXFLAGS=-fno-omit-frame-pointer"
192185
CFG_EXE_SUFFIX_i686-unknown-linux-gnu =
193186
CFG_WINDOWSY_i686-unknown-linux-gnu :=
194187
CFG_UNIXY_i686-unknown-linux-gnu := 1

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
@@ -1733,7 +1733,8 @@ pub mod llvm {
17331733
Reloc: RelocMode,
17341734
Level: CodeGenOptLevel,
17351735
EnableSegstk: bool,
1736-
UseSoftFP: bool) -> TargetMachineRef;
1736+
UseSoftFP: bool,
1737+
NoFramePointerElim: bool) -> TargetMachineRef;
17371738
pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
17381739
pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
17391740
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)