]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_codegen_llvm/attributes.rs
compiletest: Do not run debuginfo tests with gdb on msvc targets
[rust.git] / src / librustc_codegen_llvm / attributes.rs
index 816f5baddcbeeff75baf7937df4654537d623255..4ed4e8ac6efab44c3765ae77aea8e84493e3ce72 100644 (file)
@@ -2,8 +2,7 @@
 
 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;
@@ -13,6 +12,7 @@
 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;
 
@@ -66,12 +66,21 @@ fn naked(val: &'ll Value, is_naked: bool) {
 
 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"),
+            );
+        }
     }
 }