Skip to content

Commit 3c0907c

Browse files
committed
add -Z emit-stack-sizes
1 parent c3a1a0d commit 3c0907c

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
@@ -1385,6 +1385,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
13851385
"run the self profiler"),
13861386
profile_json: bool = (false, parse_bool, [UNTRACKED],
13871387
"output a json file with profiler results"),
1388+
emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
1389+
"emits a section containing stack size metadata"),
13881390
}
13891391

13901392
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
@@ -196,6 +196,7 @@ pub fn target_machine_factory(sess: &Session, find_features: bool)
196196
let features = CString::new(features).unwrap();
197197
let is_pie_binary = !find_features && is_pie_binary(sess);
198198
let trap_unreachable = sess.target.target.options.trap_unreachable;
199+
let emit_stack_size_section = sess.opts.debugging_opts.emit_stack_sizes;
199200

200201
let asm_comments = sess.asm_comments();
201202

@@ -213,6 +214,7 @@ pub fn target_machine_factory(sess: &Session, find_features: bool)
213214
trap_unreachable,
214215
singlethread,
215216
asm_comments,
217+
emit_stack_size_section,
216218
)
217219
};
218220

src/librustc_codegen_llvm/llvm/ffi.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,8 @@ extern "C" {
14601460
DataSections: bool,
14611461
TrapUnreachable: bool,
14621462
Singlethread: bool,
1463-
AsmComments: bool)
1463+
AsmComments: bool,
1464+
EmitStackSizeSection: bool)
14641465
-> Option<&'static mut TargetMachine>;
14651466
pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
14661467
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)