[libunwind][DWARF] Fix end of .eh_frame calculation
* When .eh_frame is located using .eh_frame_hdr (PT_GNU_EH_FRAME), the
start of .eh_frame is known, but not the size. In this case, the
unwinder must rely on a terminator present at the end of .eh_frame.
Set dwarf_section_length to UINTPTR_MAX to indicate this.
* Add a new field, text_segment_length, that the FrameHeaderCache uses
to track the size of the PT_LOAD segment indicated by dso_base.
* Compute ehSectionEnd by adding sectionLength to ehSectionStart,
never to fdeHint.
Fixes PR46829.
Differential Revision: https://reviews.llvm.org/D87750
Cr-Mirrored-From: https://chromium.googlesource.com/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: fb1abe00635c1ec28e55921709904d5ca2e86a74
diff --git a/test/frameheadercache_test.pass.cpp b/test/frameheadercache_test.pass.cpp
index 7f2d8e2..15c7c67 100644
--- a/test/frameheadercache_test.pass.cpp
+++ b/test/frameheadercache_test.pass.cpp
@@ -16,7 +16,7 @@
#include "../src/AddressSpace.hpp"
#define kBaseAddr 0xFFF000
-#define kDwarfSectionLength 0xFF
+#define kTextSegmentLength 0xFF
using namespace libunwind;
@@ -32,7 +32,7 @@
UnwindInfoSections UIS;
UIS.dso_base = kBaseAddr;
- UIS.dwarf_section_length = kDwarfSectionLength;
+ UIS.text_segment_length = kTextSegmentLength;
dl_iterate_cb_data CBData;
// Unused by the cache.
CBData.addressSpace = nullptr;
@@ -58,7 +58,7 @@
abort();
// Add enough things to the cache that the entry is evicted.
for (int i = 0; i < 9; i++) {
- UIS.dso_base = kBaseAddr + (kDwarfSectionLength * i);
+ UIS.dso_base = kBaseAddr + (kTextSegmentLength * i);
FHC.add(&UIS);
}
CBData.targetAddr = kBaseAddr;