diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs index 9ce012502446d..17d1d565df4f8 100644 --- a/src/librustc/driver/config.rs +++ b/src/librustc/driver/config.rs @@ -390,6 +390,8 @@ cgoptions!( "divide crate into N units to optimize in parallel"), remark: Passes = (SomePasses(Vec::new()), parse_passes, "print remarks for these optimization passes (space separated, or \"all\")"), + no_stack_check: bool = (false, parse_bool, + "disable checks for stack exhaustion (a memory-safety hazard!)"), ) pub fn build_codegen_options(matches: &getopts::Matches) -> CodegenOptions diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index bfe66de12b189..69fabaf7173ab 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -204,7 +204,7 @@ pub fn decl_fn(ccx: &CrateContext, name: &str, cc: llvm::CallConv, // Function addresses in Rust are never significant, allowing functions to be merged. llvm::SetUnnamedAddr(llfn, true); - if ccx.is_split_stack_supported() { + if ccx.is_split_stack_supported() && !ccx.sess().opts.cg.no_stack_check { set_split_stack(llfn); }