use std::ffi::CString;
-use rustc::hir::def_id::{DefId, LOCAL_CRATE};
-use rustc::hir::CodegenFnAttrFlags;
+use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc::session::config::{OptLevel, Sanitizer};
use rustc::session::Session;
use rustc::ty::layout::HasTyCtxt;
use rustc_data_structures::const_cstr;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::small_c_str::SmallCStr;
+use rustc_hir::def_id::{DefId, LOCAL_CRATE};
use rustc_target::abi::call::Conv;
use rustc_target::spec::PanicStrategy;
pub fn set_frame_pointer_elimination(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
if cx.sess().must_not_eliminate_frame_pointers() {
- llvm::AddFunctionAttrStringValue(
- llfn,
- llvm::AttributePlace::Function,
- const_cstr!("no-frame-pointer-elim"),
- const_cstr!("true"),
- );
+ if llvm_util::get_major_version() >= 8 {
+ llvm::AddFunctionAttrStringValue(
+ llfn,
+ llvm::AttributePlace::Function,
+ const_cstr!("frame-pointer"),
+ const_cstr!("all"),
+ );
+ } else {
+ llvm::AddFunctionAttrStringValue(
+ llfn,
+ llvm::AttributePlace::Function,
+ const_cstr!("no-frame-pointer-elim"),
+ const_cstr!("true"),
+ );
+ }
}
}