diff --git a/src/mono/mono/mini/mini-llvm-cpp.cpp b/src/mono/mono/mini/mini-llvm-cpp.cpp index 0ca6853d29ec6..86fca1c8eef68 100644 --- a/src/mono/mono/mini/mini-llvm-cpp.cpp +++ b/src/mono/mono/mini/mini-llvm-cpp.cpp @@ -454,6 +454,14 @@ mono_llvm_add_func_attr (LLVMValueRef func, AttrKind kind) unwrap (func)->addAttribute (AttributeList::FunctionIndex, convert_attr (kind)); } +void +mono_llvm_add_func_attr_nv (LLVMValueRef func, const char *attr_name, const char *attr_value) +{ + AttrBuilder NewAttrs; + NewAttrs.addAttribute (attr_name, attr_value); + unwrap (func)->addAttributes (AttributeList::FunctionIndex, NewAttrs); +} + void mono_llvm_add_param_attr (LLVMValueRef param, AttrKind kind) { diff --git a/src/mono/mono/mini/mini-llvm-cpp.h b/src/mono/mono/mini/mini-llvm-cpp.h index 2ba11511c3c6d..9c2e6d060efcc 100644 --- a/src/mono/mono/mini/mini-llvm-cpp.h +++ b/src/mono/mono/mini/mini-llvm-cpp.h @@ -140,6 +140,9 @@ mono_llvm_set_alignment_ret (LLVMValueRef val, int alignment); void mono_llvm_add_func_attr (LLVMValueRef func, AttrKind kind); +void +mono_llvm_add_func_attr_nv (LLVMValueRef func, const char *attr_name, const char *attr_value); + void mono_llvm_add_param_attr (LLVMValueRef param, AttrKind kind); diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index 0881f9a11901f..00cd31913b952 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -8559,6 +8559,9 @@ emit_method_inner (EmitContext *ctx) mono_llvm_add_func_attr (method, LLVM_ATTR_UW_TABLE); + if (cfg->disable_omit_fp) + mono_llvm_add_func_attr_nv (method, "no-frame-pointer-elim", "true"); + if (cfg->compile_aot) { if (is_externally_callable (ctx, cfg->method)) { LLVMSetLinkage (method, LLVMExternalLinkage);