[lld-macho] Canonicalize personality pointers in EH frames
authorJez Ng <jezng@fb.com>
Wed, 12 Oct 2022 03:50:46 +0000 (23:50 -0400)
committerJez Ng <jezng@fb.com>
Wed, 12 Oct 2022 03:50:46 +0000 (23:50 -0400)
commit7b45dfc6811a52ff4e9a6054dc276d70d77fddaf
tree9fb3113a2e13c7c2a3befb787a2c957df700b17b
parent41f5bbe18b5b162fe798b933deecc55f7cc29b92
[lld-macho] Canonicalize personality pointers in EH frames

We already do this for personality pointers referenced from compact
unwind entries; this patch extends that behavior to personalities
referenced via EH frames as well.

This reduces the number of distinct personalities we need in the final
binary, and helps us avoid hitting the "too many personalities" error.

I renamed `UnwindInfoSection::prepareRelocations()` to simply `prepare`
since we now do some non-reloc-specific stuff within.

Fixes #58277.

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D135728
lld/MachO/UnwindInfoSection.cpp
lld/MachO/UnwindInfoSection.h
lld/MachO/Writer.cpp
lld/test/MachO/eh-frame-personality-dedup.s [new file with mode: 0644]