Page MenuHomePhabricator

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:
https://bugs.llvm.org/show_bug.cgi?id=27249
https://bugs.llvm.org/show_bug.cgi?id=46414

Diff Detail

Event Timeline

aorlov created this revision.Apr 12 2021, 10:34 AM
aorlov requested review of this revision.Apr 12 2021, 10:34 AM
aorlov updated this revision to Diff 336972.Apr 12 2021, 3:05 PM
MaskRay accepted this revision.Apr 14 2021, 4:37 PM

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           }
llvm/include/llvm/DebugInfo/DWARF/DWARFSection.h
18

= 0

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.