From 7d06bdd4a148ccb924cd6628a94ca8bc0d3611fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Inf=C3=BChr?= Date: Thu, 3 Nov 2016 10:53:13 +0100 Subject: [PATCH] set frame pointer elimination attribute for main The rustc-generated function `main` should respect the same config for frame pointer elimination as the rest of code. --- src/librustc_trans/base.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librustc_trans/base.rs b/src/librustc_trans/base.rs index 977ababbf5688..47b6fdc740a34 100644 --- a/src/librustc_trans/base.rs +++ b/src/librustc_trans/base.rs @@ -1196,6 +1196,9 @@ pub fn maybe_create_entry_wrapper(ccx: &CrateContext) { } let llfn = declare::declare_cfn(ccx, "main", llfty); + // `main` should respect same config for frame pointer elimination as rest of code + attributes::set_frame_pointer_elimination(ccx, llfn); + let llbb = unsafe { llvm::LLVMAppendBasicBlockInContext(ccx.llcx(), llfn, "top\0".as_ptr() as *const _) };