[all-commits] [llvm/llvm-project] 977d62: [lld-macho] Support EH frames under arm64

Jez Ng via All-commits all-commits at lists.llvm.org
Wed Jun 8 20:41:46 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 977d62c33e3343a394777c1754682761eebb66cd
      https://github.com/llvm/llvm-project/commit/977d62c33e3343a394777c1754682761eebb66cd
  Author: Jez Ng <jezng at fb.com>
  Date:   2022-06-08 (Wed, 08 Jun 2022)

  Changed paths:
    M lld/MachO/InputFiles.cpp
    A lld/test/MachO/Inputs/eh-frame-arm64-r.o
    M lld/test/MachO/eh-frame.s

  Log Message:
  -----------
  [lld-macho] Support EH frames under arm64

For arm64, llvm-mc emits relocations for the target function
address like so:

  ltmp:
    <CIE start>
    ...
    <CIE end>
    ... multiple FDEs ...
    <FDE start>
    <target function address - (ltmp + pcrel offset)>
    ...

If any of the FDEs in `multiple FDEs` get dead-stripped, then `FDE start`
will move to an earlier address, and `ltmp + pcrel offset` will no longer
reflect an accurate pcrel value. To avoid this problem, we "canonicalize"
our relocation by adding an `EH_Frame` symbol at `FDE start`, and updating
the reloc to be `target function address - (EH_Frame + new pcrel offset)`.

Reviewed By: #lld-macho, Roger

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




More information about the All-commits mailing list