]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libdw: Handle overflowed DW_SECT_INFO offsets in DWARF package file indexes
authorOmar Sandoval <osandov@fb.com>
Mon, 26 Feb 2024 19:32:51 +0000 (11:32 -0800)
committerMark Wielaard <mark@klomp.org>
Fri, 1 Mar 2024 14:46:53 +0000 (15:46 +0100)
commit3979362ef98db16d1c6fe8fb12ee6a966305da49
tree737175a327d12f48d0e2315f06a8763cbbf3fa20
parent94743d5239ea96a84f974c8ce02e4b4c43a84e13
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.

1: https://discourse.llvm.org/t/dwarf-dwp-4gb-limit/63902.

  * 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.

Signed-off-by: Omar Sandoval <osandov@fb.com>
libdw/dwarf_cu_dwp_section_info.c
libdw/dwarf_end.c
libdw/libdwP.h
tests/Makefile.am
tests/run-large-elf-file.sh
tests/testfile-dwp-4-cu-index-overflow.bz2 [new file with mode: 0755]
tests/testfile-dwp-4-cu-index-overflow.dwp.bz2 [new file with mode: 0644]
tests/testfile-dwp-5-cu-index-overflow.bz2 [new file with mode: 0755]
tests/testfile-dwp-5-cu-index-overflow.dwp.bz2 [new file with mode: 0644]
tests/testfile-dwp-cu-index-overflow.source [new file with mode: 0644]