Handle overflow beyond the 127 common encodings limit
authorGreg McGary <gkm@fb.com>
Mon, 7 Dec 2020 06:33:38 +0000 (22:33 -0800)
committerGreg McGary <gkm@fb.com>
Sat, 19 Dec 2020 22:54:37 +0000 (14:54 -0800)
commit99930719c66df9a8b67f3575d251b182c9cc8ee9
treeabfab498a785e862de2644c31b16b2538bdb4184
parentc043f5055e8968ed17d2763e47862c42050302e3
Handle overflow beyond the 127 common encodings limit

The common encodings table holds only 127 entries. The encodings index for compact entries is 8 bits wide, and indexes 127..255 are stored locally to each second-level page. Prior to this diff, lld would `fatal()` if encodings overflowed the 127 limit.

This diff populates a per-second-level-page encodings table as needed. When the per-page encodings table hits its limit, we must terminate the page. If such early termination would consume fewer entries than a regular (non-compact) encoding page, then we prefer the regular format.

Caveat: one reason the common-encoding table might overflow is because of DWARF debug-info references, which are not yet implemented and will come with a later diff.

Differential Revision: https://reviews.llvm.org/D93267
lld/MachO/UnwindInfoSection.cpp
lld/MachO/UnwindInfoSection.h
lld/test/MachO/tools/generate-cfi-funcs.py
lld/test/MachO/tools/validate-unwind-info.py