[PATCH] D103052: Do not patch FDE symbols in RuntimeDyld, on targets that use non-absolute symbol relocations in `.eh_frame`

Cody Tapscott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 24 15:12:30 PDT 2021


topolarity created this revision.
topolarity added a reviewer: lhames.
Herald added subscribers: pengfei, hiraditya, kristof.beyls.
topolarity requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Since processFDE adds a delta to the values in the FDE, it assumes that the relocations for the .eh_frame section have not been applied by RuntimeDyld. It expects instead that only the relocation addend has been written to the symbol locations, and that the section-to-section offset needs to be added.

However, there are platform differences that interfere with this:

1. X86-64 has DwarfFDESymbolsUseAbsDiff enabled in its AsmInfo, causing an absolute symbol to be emitted for the FDE pcStart.  Absolute symbols are skipped as a relocation by RuntimeDyld, so the processFDE function in RuntimeDyldMachO.cpp calculates the relocation correctly.
2. AArch64 has DwarfFDESymbolsUseAbsDiff disabled, so a relocation is emitted in the eh_frame section. Since this isn't absolute, the relocation is applied by RuntimeDyld. This means that processFDE ends up adding an additional section-to-section offset to the pcStart field, generating an incorrect FDE


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103052

Files:
  llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
  llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
  llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h
  llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h
  llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOX86_64.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103052.347515.patch
Type: text/x-patch
Size: 5881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210524/6b5c066e/attachment.bin>


More information about the llvm-commits mailing list