]> git.lizzy.rs Git - rust.git/commitdiff
add -Z emit-stack-sizes
authorJorge Aparicio <jorge@japaric.io>
Thu, 13 Sep 2018 17:43:15 +0000 (19:43 +0200)
committerJorge Aparicio <jorge@japaric.io>
Wed, 26 Sep 2018 13:21:26 +0000 (15:21 +0200)
src/librustc/session/config.rs
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/llvm/ffi.rs
src/rustllvm/PassWrapper.cpp

index 8fa15d48a5dc9692f3fdfa38b71f9f34d8ae4814..eb779e6382f4bebb5e7418f7645329cea222cc66 100644 (file)
@@ -1385,6 +1385,8 @@ fn parse_cross_lang_lto(slot: &mut CrossLangLto, v: Option<&str>) -> bool {
           "run the self profiler"),
     profile_json: bool = (false, parse_bool, [UNTRACKED],
           "output a json file with profiler results"),
+    emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
+          "emits a section containing stack size metadata"),
 }
 
 pub fn default_lib_output() -> CrateType {
index 447b505e79c62c55c5d1f22392915bad232b8db0..02ef690b942333c8f44ed8576fd863eeceba265e 100644 (file)
@@ -196,6 +196,7 @@ pub fn target_machine_factory(sess: &Session, find_features: bool)
     let features = CString::new(features).unwrap();
     let is_pie_binary = !find_features && is_pie_binary(sess);
     let trap_unreachable = sess.target.target.options.trap_unreachable;
+    let emit_stack_size_section = sess.opts.debugging_opts.emit_stack_sizes;
 
     let asm_comments = sess.asm_comments();
 
@@ -213,6 +214,7 @@ pub fn target_machine_factory(sess: &Session, find_features: bool)
                 trap_unreachable,
                 singlethread,
                 asm_comments,
+                emit_stack_size_section,
             )
         };
 
index a5f4137c62b14e6e30c0bf3d7c91807ed602b243..845f2fa9f45a6a90207ca4f688f9fc59c20ebb1b 100644 (file)
@@ -1460,7 +1460,8 @@ pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
                                        DataSections: bool,
                                        TrapUnreachable: bool,
                                        Singlethread: bool,
-                                       AsmComments: bool)
+                                       AsmComments: bool,
+                                       EmitStackSizeSection: bool)
                                        -> Option<&'static mut TargetMachine>;
     pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
     pub fn LLVMRustAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>, M: &'a Module);
index 5c4bb61781ed1367b99cdb91ba42275336a01dd5..06f75d981e3d6c8405503942e9da1734636acfce 100644 (file)
@@ -373,7 +373,8 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
     bool DataSections,
     bool TrapUnreachable,
     bool Singlethread,
-    bool AsmComments) {
+    bool AsmComments,
+    bool EmitStackSizeSection) {
 
   auto OptLevel = fromRust(RustOptLevel);
   auto RM = fromRust(RustReloc);
@@ -411,6 +412,8 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
   }
 
 #if LLVM_VERSION_GE(6, 0)
+  Options.EmitStackSizeSection = EmitStackSizeSection;
+
   Optional<CodeModel::Model> CM;
 #else
   CodeModel::Model CM = CodeModel::Model::Default;