Note that there is a triple indirection involved with
personalities and compact unwind:
- Two bits of each CU encoding are used as an offset into the personality array.
- Each entry of the personality array is an offset from the image base. The resulting address (after adding the image base) should point within the GOT.
- The corresponding GOT entry contains the actual pointer to the personality function.
To further complicate things, when the personality function is in the
object file (as opposed to a dylib), its references in
__compact_unwind may refer to it via a section + offset relocation
instead of a symbol relocation. Since our GOT implementation can only
create entries for symbols, we have to create a synthetic symbol at the
given section offset.
Is there an assert or check you can put into the code to verify this assumption?