To calculate a correct PC offset we need to apply the target address from the eh_frame.
This fixes the following bugs:
https://bugs.llvm.org/show_bug.cgi?id=27249
https://bugs.llvm.org/show_bug.cgi?id=46414
Paths 
  |  Differential  D100328  
Fix bug in .eh_frame/.debug_frame PC offset calculation for DW_EH_PE_pcrel ClosedPublic Authored by aorlov on Apr 12 2021, 10:34 AM. 
Details Summary To calculate a correct PC offset we need to apply the target address from the eh_frame. This fixes the following bugs: 
Diff Detail 
 Event TimelineComment Actions LG. The stored address is used as EHFrameAddress in llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp 1134           // Decode the LSDA if the CIE augmentation string said we should.                                                                                                                                                       
1135           if (Cie->getLSDAPointerEncoding() != DW_EH_PE_omit) {
1136             LSDAAddress = Data.getEncodedPointer(                                                                                                                                                                                 
1137                 &Offset, Cie->getLSDAPointerEncoding(),
1138                 EHFrameAddress ? Offset + EHFrameAddress : 0);
1139           }
 This revision is now accepted and ready to land.Apr 14 2021, 4:37 PM MaskRay retitled this revision from Fixed bug in eh_frame PC offset calculation for DW_EH_PE_pcrel to Fixed bug in .eh_frame/.debug_frame PC offset calculation for DW_EH_PE_pcrel.Apr 14 2021, 4:40 PM MaskRay retitled this revision from Fixed bug in .eh_frame/.debug_frame PC offset calculation for DW_EH_PE_pcrel to Fix bug in .eh_frame/.debug_frame PC offset calculation for DW_EH_PE_pcrel. Closed by commit rG49cbf4cd85a9: Fix bug in .eh_frame/.debug_frame PC offset calculation for DW_EH_PE_pcrel (authored by aorlov).  ·  Explain WhyApr 15 2021, 4:06 AM This revision was automatically updated to reflect the committed changes. 
Revision Contents 
 
Diff 337699 lld/test/ELF/eh-frame-hdr-augmentation.s
 llvm/include/llvm/DebugInfo/DWARF/DWARFSection.h
 llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
 llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
 llvm/test/tools/llvm-objdump/MachO/eh_frame-arm64.test
  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
= 0