Skip to content

Commit 805e058

Browse files
committed
add -Z emit-stack-sizes
1 parent 994cdd9 commit 805e058

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

src/librustc/session/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
13561356
"run the self profiler"),
13571357
profile_json: bool = (false, parse_bool, [UNTRACKED],
13581358
"output a json file with profiler results"),
1359+
emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
1360+
"emits a section containing stack size metadata"),
13591361
}
13601362

13611363
pub fn default_lib_output() -> CrateType {

src/librustc_codegen_llvm/back/write.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ pub fn target_machine_factory(sess: &Session, find_features: bool)
195195
let features = CString::new(features).unwrap();
196196
let is_pie_binary = !find_features && is_pie_binary(sess);
197197
let trap_unreachable = sess.target.target.options.trap_unreachable;
198+
let emit_stack_size_section = sess.opts.debugging_opts.emit_stack_sizes;
198199

199200
let asm_comments = sess.asm_comments();
200201

@@ -212,6 +213,7 @@ pub fn target_machine_factory(sess: &Session, find_features: bool)
212213
trap_unreachable,
213214
singlethread,
214215
asm_comments,
216+
emit_stack_size_section,
215217
)
216218
};
217219

src/librustc_codegen_llvm/llvm/ffi.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,8 @@ extern "C" {
14661466
DataSections: bool,
14671467
TrapUnreachable: bool,
14681468
Singlethread: bool,
1469-
AsmComments: bool)
1469+
AsmComments: bool,
1470+
EmitStackSizeSection: bool)
14701471
-> Option<&'static mut TargetMachine>;
14711472
pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
14721473
pub fn LLVMRustAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>, M: &'a Module);

src/rustllvm/PassWrapper.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
373373
bool DataSections,
374374
bool TrapUnreachable,
375375
bool Singlethread,
376-
bool AsmComments) {
376+
bool AsmComments,
377+
bool EmitStackSizeSection) {
377378

378379
auto OptLevel = fromRust(RustOptLevel);
379380
auto RM = fromRust(RustReloc);
@@ -411,6 +412,8 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
411412
}
412413

413414
#if LLVM_VERSION_GE(6, 0)
415+
Options.EmitStackSizeSection = EmitStackSizeSection;
416+
414417
Optional<CodeModel::Model> CM;
415418
#else
416419
CodeModel::Model CM = CodeModel::Model::Default;

0 commit comments

Comments
 (0)