Add another macro, _LIBUNWIND_SUPPORT_DWARF_SECTION, that indicates
that the location and length of .eh_frame is known, and that .eh_frame
should be scanned to find an FDE. There are a few reasons to turn this
code off:
- When there is a valid .eh_frame_hdr section, scanning .eh_frame is unnecessary.
- When .eh_frame is located using PT_GNU_EH_FRAME, the length of the section is unknown.
- If the unwinder uses dl_iterate_phdr, then entries that are automatically added to DwarfFDECache would become invalid if the module containing the entry were unloaded. (On Apple systems, DwarfFDECache registers dyldUnloadHook to remove unloaded entries.)
- Omitting the dwarf_section and dwarf_section_length fields reduces memory use in the FrameHeaderCache.
For a bare-metal target, the location of both .eh_frame and
.eh_frame_hdr is known, but maybe the .eh_frame_hdr is unused/empty,
so enable both methods. .eh_frame is only scanned if the index is
unavailable.
Add a new dso_length field to track the length of the PT_LOAD segment
used by the FrameHeaderCache. Previously, the FrameHeaderCache used the
dwarf_section_length field for this purpose.
Fix the calculation of ehSectionEnd in CFI_Parser<A>::findFDE.
Above the dso_base field declaration, remove the redundant reference to
_LIBUNWIND_SUPPORT_DWARF_INDEX. If _LIBUNWIND_SUPPORT_DWARF_INDEX is
defined, then _LIBUNWIND_SUPPORT_DWARF_UNWIND is also defined.
Fixes PR36005 and PR46829.
clang-format: please reformat the code
62 diff lines are omitted. See full path.