libdw: Handle overflowed DW_SECT_INFO offsets in DWARF package file indexes
Meta uses DWARF package files for our large, statically-linked C++
applications. Some of our largest applications have more than 4GB in
.debug_info.dwo, but the section offsets in .debug_cu_index and
.debug_tu_index are 32 bits; see the discussion here [1]. We
implemented a workaround/extension for this in LLVM. Implement the
equivalent in libdw.
To test this, we need files with more than 4GB in .debug_info.dwo. I
created these artificially by editing GCC's assembly output. They
compress down to 6KB. I test them from run-large-elf-file.sh to take
advantage of the existing checks for large file support.
* libdw/dwarf_end.c (dwarf_package_index_free): New function.
* tests/testfile-dwp-4-cu-index-overflow.bz2: New test file.
* tests/testfile-dwp-4-cu-index-overflow.dwp.bz2: New test file.
* tests/testfile-dwp-5-cu-index-overflow.bz2: New test file.
* tests/testfile-dwp-5-cu-index-overflow.dwp.bz2: New test file.
* tests/testfile-dwp-cu-index-overflow.source: New file.
* tests/run-large-elf-file.sh: Check
testfile-dwp-5-cu-index-overflow and
testfile-dwp-4-cu-index-overflow.