[PATCH] D124561: [lld-macho] Support EH frames under arm64

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 15:05:54 PDT 2022


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

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)`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124561

Files:
  lld/MachO/InputFiles.cpp
  lld/test/MachO/Inputs/eh-frame-arm64-r.o
  lld/test/MachO/eh-frame.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124561.425622.patch
Type: text/x-patch
Size: 5600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220427/7e30f8b0/attachment.bin>


More information about the llvm-commits mailing list