about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/debuginfo
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2022-03-20 16:55:21 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2022-03-20 16:55:21 +0100
commitef4ce72919d1a16ad5aed4108d5abcf4d5c2cdc8 (patch)
tree5e6b18b3d26ff3fdf8ed1347edd8eb3b8a234a38 /compiler/rustc_codegen_cranelift/src/debuginfo
parentc7ce69faf2a7ea16c15d922985ca27ba70da30ee (diff)
parent370c397ec9169809e5ad270079712e0043514240 (diff)
downloadrust-ef4ce72919d1a16ad5aed4108d5abcf4d5c2cdc8.tar.gz
rust-ef4ce72919d1a16ad5aed4108d5abcf4d5c2cdc8.zip
Merge commit '370c397ec9169809e5ad270079712e0043514240' into sync_cg_clif-2022-03-20
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/debuginfo')
-rw-r--r--compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs1
-rw-r--r--compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs13
2 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs
index c7e15f81e03..476d6a54e12 100644
--- a/compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs
+++ b/compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs
@@ -110,7 +110,6 @@ impl<'tcx> DebugContext<'tcx> {
 
         entry.set(gimli::DW_AT_decl_file, AttributeValue::FileIndex(Some(file_id)));
         entry.set(gimli::DW_AT_decl_line, AttributeValue::Udata(loc.line as u64));
-        // FIXME: probably omit this
         entry.set(gimli::DW_AT_decl_column, AttributeValue::Udata(loc.col.to_usize() as u64));
     }
 
diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs
index e4f28338096..d26392c4913 100644
--- a/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs
+++ b/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs
@@ -81,6 +81,8 @@ impl UnwindContext {
 
     #[cfg(all(feature = "jit", not(windows)))]
     pub(crate) unsafe fn register_jit(self, jit_module: &cranelift_jit::JITModule) {
+        use std::mem::ManuallyDrop;
+
         let mut eh_frame = EhFrame::from(super::emit::WriterRelocate::new(self.endian));
         self.frame_table.write_eh_frame(&mut eh_frame).unwrap();
 
@@ -95,17 +97,16 @@ impl UnwindContext {
 
         // FIXME support unregistering unwind tables once cranelift-jit supports deallocating
         // individual functions
-        #[allow(unused_variables)]
-        let (eh_frame, eh_frame_len, _) = Vec::into_raw_parts(eh_frame);
+        let eh_frame = ManuallyDrop::new(eh_frame);
 
         // =======================================================================
-        // Everything after this line up to the end of the file is loosly based on
+        // Everything after this line up to the end of the file is loosely based on
         // https://github.com/bytecodealliance/wasmtime/blob/4471a82b0c540ff48960eca6757ccce5b1b5c3e4/crates/jit/src/unwind/systemv.rs
         #[cfg(target_os = "macos")]
         {
             // On macOS, `__register_frame` takes a pointer to a single FDE
-            let start = eh_frame;
-            let end = start.add(eh_frame_len);
+            let start = eh_frame.as_ptr();
+            let end = start.add(eh_frame.len());
             let mut current = start;
 
             // Walk all of the entries in the frame table and register them
@@ -124,7 +125,7 @@ impl UnwindContext {
         #[cfg(not(target_os = "macos"))]
         {
             // On other platforms, `__register_frame` will walk the FDEs until an entry of length 0
-            __register_frame(eh_frame);
+            __register_frame(eh_frame.as_ptr());
         }
     }
 }