[PATCH] D144999: [RFC][MC][MachO]Only emits compact-unwind format for "canonical" personality symbols. For the rest, use DWARFs.

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 11:05:15 PST 2023


jyknight added a comment.

In D144999#4165106 <https://reviews.llvm.org/D144999#4165106>, @oontvoo wrote:

> In D144999#4163617 <https://reviews.llvm.org/D144999#4163617>, @int3 wrote:
>
>>> One issue is that we need to emit ONLY dwarf-unwind for those functions which use nonstandard personalities, while femit-dwarf-unwind enables emitting both compact-unwind and dwarf unwind.
>>
>> So IMO the ideal design is that we emit both and have the linker fall back to DWARF unwind info if the number of personalities is too large.
>
> OK - this sounds like a reasonable behaviour.  👍

+1.

I initially had expected that we would not need any linker changes if the compiler emitted only compact-unwind. However, since we DO need to make a linker change in any case...might as well do this slightly more complex change, in order to get the better result.

The linker could choose the 3 compact-unwind personalities slots as follows:

1. First, choose all personalities which are used by functions having compact-unwind without a DWARF fallback. If there's >3 of these, error.
2. After that, sort personality fns by how often they're used, and fill in the remaining slots with the most popular functions.

(This does mean we need to preserve the eh_frame info for all functions even when they have compact-unwind too -- right now both are stored in the same Defined::unwindEntry field, since we only ever care about eh-frame unwind if the fn doesn't have compact-unwind)

For the assembler-side: I propose the default behavior ought to be:

1. For `__gxx_personality_v0` and `__objc_personality_v0` (but not `__gcc_personality_v0`), emit only compact unwind (or only DWARF where compact-unwind isn't possible) for each function -- not both. (This saves object-file size/build time for the most common languages).
2. For all other personalities, emit both compact-unwind+DWARF, so the linker can choose per above.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144999/new/

https://reviews.llvm.org/D144999



More information about the llvm-commits mailing list