about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-01-26 11:39:05 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-04-07 16:29:04 +0000
commit39b25b3d714d463a6803a64f437f1b9ba8ced7b8 (patch)
tree8ef3e0644e073fcace3989f17ef2fca36fd60148
parent0f1ee59ea579527f82a69f3564bba5c3ee2a69dd (diff)
downloadrust-39b25b3d714d463a6803a64f437f1b9ba8ced7b8.tar.gz
rust-39b25b3d714d463a6803a64f437f1b9ba8ced7b8.zip
Don't emit unwind tables on macOS
They don't work anyway as object misses support for emitting the
particular format macOS expects. And on arm64 macOS it causes
compilation to abort due to an unsupported relocation type.

Fixes rust-lang/rustc_codegen_cranelift#1371
-rw-r--r--src/debuginfo/unwind.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/debuginfo/unwind.rs b/src/debuginfo/unwind.rs
index 96ab7a29205..eebd181341d 100644
--- a/src/debuginfo/unwind.rs
+++ b/src/debuginfo/unwind.rs
@@ -38,6 +38,14 @@ impl UnwindContext {
     }
 
     pub(crate) fn add_function(&mut self, func_id: FuncId, context: &Context, isa: &dyn TargetIsa) {
+        if let target_lexicon::OperatingSystem::MacOSX { .. } = isa.triple().operating_system {
+            // The object crate doesn't currently support DW_GNU_EH_PE_absptr, which macOS
+            // requires for unwinding tables. In addition on arm64 it currently doesn't
+            // support 32bit relocations as we currently use for the unwinding table.
+            // See gimli-rs/object#415 and rust-lang/rustc_codegen_cranelift#1371
+            return;
+        }
+
         let unwind_info = if let Some(unwind_info) =
             context.compiled_code().unwrap().create_unwind_info(isa).unwrap()
         {