Fix unwinding through assembly helpers
authorGeoff Norton <grompf@gmail.com>
Wed, 18 Mar 2015 21:06:02 +0000 (14:06 -0700)
committerGeoff Norton <grompf@gmail.com>
Wed, 18 Mar 2015 21:09:40 +0000 (14:09 -0700)
NESTED_ENTRY/NESTED_END assembly helpers are currently using cfi ops
that are not supported by Apple's compact unwind format.  Additionally
the apple linker appears to be doing the wrong thing, and mapping functions
like CallDescrWorkerInternal to an invalid compatc unwind encoding.  This
patch manually emits the __compact_unwind section manually for the affected
functions, and points the unwinder to parse the DWARF instead of using the
compact table.

src/pal/inc/unixasmmacros.inc

index 22b4f7e..4a9bf07 100644 (file)
@@ -94,6 +94,15 @@ C_FUNC(\Name\()_End):
 
 .macro NESTED_END Name, Section
         LEAF_END \Name, \Section
+#if defined(__APPLE__)
+        .section __LD,__compact_unwind,regular,debug
+        .quad C_FUNC(\Name)
+        .set C_FUNC(\Name\()_Size), C_FUNC(\Name\()_End) - C_FUNC(\Name)
+        .long C_FUNC(\Name\()_Size)
+        .long 0x04000000 # DWARF
+        .quad 0
+        .quad 0
+#endif
 .endm
 
 .macro END_PROLOGUE