Skip to content

Commit 329f045

Browse files
committed
rustc: Enable segmented stacks in LLVM when --stack-growth is on
1 parent c9003d3 commit 329f045

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

src/comp/back/link.rs

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ mod write {
9191
fn run_passes(sess: session::session, llmod: ModuleRef, output: str) {
9292
let opts = sess.get_opts();
9393
if opts.time_llvm_passes { llvm::LLVMRustEnableTimePasses(); }
94+
if opts.stack_growth { llvm::LLVMRustEnableSegmentedStacks(); }
9495
link_intrinsics(sess, llmod);
9596
let pm = mk_pass_manager();
9697
let td = mk_target_data(x86::get_data_layout());

src/comp/lib/llvm.rs

+2
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,8 @@ native "c-stack-cdecl" mod llvm = "rustllvm" {
868868

869869
/** Turn on LLVM pass-timing. */
870870
fn LLVMRustEnableTimePasses();
871+
/** Turn on LLVM segmented stacks. */
872+
fn LLVMRustEnableSegmentedStacks();
871873

872874
/** Print the pass timings since static dtors aren't picking them up. */
873875
fn LLVMRustPrintPassTimings();

src/rustllvm/RustWrapper.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,9 @@ extern "C" void LLVMRustPrintPassTimings() {
123123
raw_fd_ostream OS (2, false); // stderr.
124124
TimerGroup::printAll(OS);
125125
}
126+
127+
extern bool llvm::EnableSegmentedStacks;
128+
extern "C" void LLVMRustEnableSegmentedStacks() {
129+
EnableSegmentedStacks = true;
130+
}
131+

src/rustllvm/rustllvm.def.in

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LLVMRustGetHostTriple
66
LLVMRustConstSmallInt
77
LLVMRustParseBitcode
88
LLVMRustPrintPassTimings
9+
LLVMRustEnableSegmentedStacks
910
LLVMLinkModules
1011
LLVMCreateObjectFile
1112
LLVMDisposeObjectFile

0 commit comments

Comments
 (0)