[PATCH] D123276: [lld-macho] Use fewer indirections in UnwindInfo implementation

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 6 20:55:38 PDT 2022


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added projects: lld-macho, All.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The previous implementation of UnwindInfoSection materialized
all the compact unwind entries & applied their relocations, then parsed
the resulting data to generate the final unwind info. This design had
some unfortunate conseqeuences: since relocations can only be applied
after their referents have had addresses assigned, operations that need
to happen before address assignment must contort themselves. (See
D113582: [lld-macho] Support renaming of LSDA section <https://reviews.llvm.org/D113582> and observe how this diff greatly simplifies it.)

Moreover, it made synthesizing new compact unwind entries awkward.
Handling PR50300 will require us to do this synthesis, and is the main
motivation behind this diff.

Previously, instead of generating a new CompactUnwindEntry directly, we
would have had to generate a ConcatInputSection with a number of
`Reloc`s that would then get "flattened" into a CompactUnwindEntry.

This diff introduces an internal representation of `CompactUnwindEntry`
(the former `CompactUnwindEntry` has been renamed to
`CompactUnwindLayout`). The new CompactUnwindEntry stores references to
its personality symbol and LSDA section directly, without the use of
`Reloc` structs.

In addition to being easier to work with, this diff also allows us to
handle unwind info whose personality symbols are located in sections
placed after the `__unwind_info`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123276

Files:
  lld/MachO/InputFiles.cpp
  lld/MachO/UnwindInfoSection.cpp
  lld/test/MachO/compact-unwind.s
  lld/test/MachO/invalid/compact-unwind-bad-reloc.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123276.421081.patch
Type: text/x-patch
Size: 14864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220407/fb793718/attachment.bin>


More information about the llvm-commits mailing list