[all-commits] [llvm/llvm-project] 82dcf3: [lld-macho] Use fewer indirections in UnwindInfo i...

Jez Ng via All-commits all-commits at lists.llvm.org
Fri Apr 8 20:49:24 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 82dcf3063697eba96b825e91f11a8e74c4c95cb1
      https://github.com/llvm/llvm-project/commit/82dcf3063697eba96b825e91f11a8e74c4c95cb1
  Author: Jez Ng <jezng at fb.com>
  Date:   2022-04-08 (Fri, 08 Apr 2022)

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

  Log Message:
  -----------
  [lld-macho] Use fewer indirections in UnwindInfo implementation

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} and observe how this diff greatly simplifies it.)

Moreover, it made synthesizing new compact unwind entries awkward.
Handling PR50956 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`.

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D123276




More information about the All-commits mailing list